diff options
Diffstat (limited to 'Swiften/TLS/OpenSSL/OpenSSLContext.h')
| -rw-r--r-- | Swiften/TLS/OpenSSL/OpenSSLContext.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Swiften/TLS/OpenSSL/OpenSSLContext.h b/Swiften/TLS/OpenSSL/OpenSSLContext.h index c18a6f4..885b1fe 100644 --- a/Swiften/TLS/OpenSSL/OpenSSLContext.h +++ b/Swiften/TLS/OpenSSL/OpenSSLContext.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <Swiften/Base/ByteArray.h> | 16 | #include <Swiften/Base/ByteArray.h> |
| 17 | #include <Swiften/TLS/CertificateWithKey.h> | 17 | #include <Swiften/TLS/CertificateWithKey.h> |
| 18 | #include <Swiften/TLS/TLSContext.h> | 18 | #include <Swiften/TLS/TLSContext.h> |
| 19 | #include <Swiften/TLS/TLSOptions.h> | ||
| 19 | 20 | ||
| 20 | namespace std { | 21 | namespace std { |
| 21 | template<> | 22 | template<> |
| @@ -38,7 +39,7 @@ namespace std { | |||
| 38 | namespace Swift { | 39 | namespace Swift { |
| 39 | class OpenSSLContext : public TLSContext, boost::noncopyable { | 40 | class OpenSSLContext : public TLSContext, boost::noncopyable { |
| 40 | public: | 41 | public: |
| 41 | OpenSSLContext(Mode mode); | 42 | OpenSSLContext(const TLSOptions& options, Mode mode); |
| 42 | virtual ~OpenSSLContext() override final; | 43 | virtual ~OpenSSLContext() override final; |
| 43 | 44 | ||
| 44 | void accept() override final; | 45 | void accept() override final; |
| @@ -60,7 +61,11 @@ namespace Swift { | |||
| 60 | virtual ByteArray getFinishMessage() const override final; | 61 | virtual ByteArray getFinishMessage() const override final; |
| 61 | virtual ByteArray getPeerFinishMessage() const override final; | 62 | virtual ByteArray getPeerFinishMessage() const override final; |
| 62 | 63 | ||
| 64 | void setX509StoreContext(X509_STORE_CTX *ptr) { x509_store_ctx = ptr; } | ||
| 65 | std::function<int (const TLSContext *)> getVerifyCertCallback() { return verifyCertCallback; } | ||
| 66 | |||
| 63 | private: | 67 | private: |
| 68 | bool configure(const TLSOptions& options); | ||
| 64 | static void ensureLibraryInitialized(); | 69 | static void ensureLibraryInitialized(); |
| 65 | static int handleServerNameCallback(SSL *ssl, int *ad, void *arg); | 70 | static int handleServerNameCallback(SSL *ssl, int *ad, void *arg); |
| 66 | static CertificateVerificationError::Type getVerificationErrorTypeForResult(int); | 71 | static CertificateVerificationError::Type getVerificationErrorTypeForResult(int); |
| @@ -81,5 +86,7 @@ namespace Swift { | |||
| 81 | BIO* readBIO_ = nullptr; | 86 | BIO* readBIO_ = nullptr; |
| 82 | BIO* writeBIO_ = nullptr; | 87 | BIO* writeBIO_ = nullptr; |
| 83 | bool abortTLSHandshake_ = false; | 88 | bool abortTLSHandshake_ = false; |
| 84 | }; | 89 | X509_STORE_CTX *x509_store_ctx = nullptr; |
| 90 | std::function<int (const TLSContext *)> verifyCertCallback = nullptr; | ||
| 91 | }; | ||
| 85 | } | 92 | } |
Swift