THE SSL type
| 611 | |
| 612 | // THE SSL type |
| 613 | class SSL { |
| 614 | Crypto crypto_; // agreed crypto agents |
| 615 | Security secure_; // Connection and Session parms |
| 616 | States states_; // Record and HandShake states |
| 617 | sslHashes hashes_; // handshake, finished hashes |
| 618 | Socket socket_; // socket wrapper |
| 619 | Buffers buffers_; // buffered handshakes and data |
| 620 | Log log_; // logger |
| 621 | bool quietShutdown_; |
| 622 | |
| 623 | // optimization variables |
| 624 | bool has_data_; // buffered data ready? |
| 625 | public: |
| 626 | SSL(SSL_CTX* ctx); |
| 627 | |
| 628 | // gets and uses |
| 629 | const Crypto& getCrypto() const; |
| 630 | const Security& getSecurity() const; |
| 631 | const States& getStates() const; |
| 632 | const sslHashes& getHashes() const; |
| 633 | const sslFactory& getFactory() const; |
| 634 | const Socket& getSocket() const; |
| 635 | YasslError GetError() const; |
| 636 | bool GetMultiProtocol() const; |
| 637 | bool CompressionOn() const; |
| 638 | |
| 639 | Crypto& useCrypto(); |
| 640 | Security& useSecurity(); |
| 641 | States& useStates(); |
| 642 | sslHashes& useHashes(); |
| 643 | Socket& useSocket(); |
| 644 | Log& useLog(); |
| 645 | Buffers& useBuffers(); |
| 646 | |
| 647 | bool HasData() const; |
| 648 | bool GetQuietShutdown() const; |
| 649 | |
| 650 | // sets |
| 651 | void set_pending(Cipher suite); |
| 652 | void set_random(const opaque*, ConnectionEnd); |
| 653 | void set_sessionID(const opaque*); |
| 654 | void set_session(SSL_SESSION*); |
| 655 | void set_preMaster(const opaque*, uint); |
| 656 | void set_masterSecret(const opaque*); |
| 657 | void SetError(YasslError); |
| 658 | int SetCompression(); |
| 659 | void UnSetCompression(); |
| 660 | void SetQuietShutdown(bool mode); |
| 661 | |
| 662 | // helpers |
| 663 | bool isTLS() const; |
| 664 | bool isTLSv1_1() const; |
| 665 | void order_error(); |
| 666 | void makeMasterSecret(); |
| 667 | void makeTLSMasterSecret(); |
| 668 | void addData(input_buffer* data); |
| 669 | void fillData(Data&); |
| 670 | void PeekData(Data&); |