| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ | 11 #ifndef WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ |
| 12 #define WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ | 12 #define WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <memory> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "webrtc/base/buffer.h" | 18 #include "webrtc/base/buffer.h" |
| 18 #include "webrtc/base/sslstreamadapter.h" | 19 #include "webrtc/base/sslstreamadapter.h" |
| 19 #include "webrtc/base/opensslidentity.h" | 20 #include "webrtc/base/opensslidentity.h" |
| 20 | 21 |
| 21 typedef struct ssl_st SSL; | 22 typedef struct ssl_st SSL; |
| 22 typedef struct ssl_ctx_st SSL_CTX; | 23 typedef struct ssl_ctx_st SSL_CTX; |
| 23 typedef struct ssl_cipher_st SSL_CIPHER; | 24 typedef struct ssl_cipher_st SSL_CIPHER; |
| 24 typedef struct x509_store_ctx_st X509_STORE_CTX; | 25 typedef struct x509_store_ctx_st X509_STORE_CTX; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ~OpenSSLStreamAdapter() override; | 63 ~OpenSSLStreamAdapter() override; |
| 63 | 64 |
| 64 void SetIdentity(SSLIdentity* identity) override; | 65 void SetIdentity(SSLIdentity* identity) override; |
| 65 | 66 |
| 66 // Default argument is for compatibility | 67 // Default argument is for compatibility |
| 67 void SetServerRole(SSLRole role = SSL_SERVER) override; | 68 void SetServerRole(SSLRole role = SSL_SERVER) override; |
| 68 bool SetPeerCertificateDigest(const std::string& digest_alg, | 69 bool SetPeerCertificateDigest(const std::string& digest_alg, |
| 69 const unsigned char* digest_val, | 70 const unsigned char* digest_val, |
| 70 size_t digest_len) override; | 71 size_t digest_len) override; |
| 71 | 72 |
| 72 rtc::scoped_ptr<SSLCertificate> GetPeerCertificate() const override; | 73 std::unique_ptr<SSLCertificate> GetPeerCertificate() const override; |
| 73 | 74 |
| 74 int StartSSLWithServer(const char* server_name) override; | 75 int StartSSLWithServer(const char* server_name) override; |
| 75 int StartSSLWithPeer() override; | 76 int StartSSLWithPeer() override; |
| 76 void SetMode(SSLMode mode) override; | 77 void SetMode(SSLMode mode) override; |
| 77 void SetMaxProtocolVersion(SSLProtocolVersion version) override; | 78 void SetMaxProtocolVersion(SSLProtocolVersion version) override; |
| 78 | 79 |
| 79 StreamResult Read(void* data, | 80 StreamResult Read(void* data, |
| 80 size_t data_len, | 81 size_t data_len, |
| 81 size_t* read, | 82 size_t* read, |
| 82 int* error) override; | 83 int* error) override; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED | 178 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED |
| 178 // Whether the SSL negotiation is blocked on needing to read or | 179 // Whether the SSL negotiation is blocked on needing to read or |
| 179 // write to the wrapped stream. | 180 // write to the wrapped stream. |
| 180 bool ssl_read_needs_write_; | 181 bool ssl_read_needs_write_; |
| 181 bool ssl_write_needs_read_; | 182 bool ssl_write_needs_read_; |
| 182 | 183 |
| 183 SSL* ssl_; | 184 SSL* ssl_; |
| 184 SSL_CTX* ssl_ctx_; | 185 SSL_CTX* ssl_ctx_; |
| 185 | 186 |
| 186 // Our key and certificate, mostly useful in peer-to-peer mode. | 187 // Our key and certificate, mostly useful in peer-to-peer mode. |
| 187 scoped_ptr<OpenSSLIdentity> identity_; | 188 std::unique_ptr<OpenSSLIdentity> identity_; |
| 188 // in traditional mode, the server name that the server's certificate | 189 // in traditional mode, the server name that the server's certificate |
| 189 // must specify. Empty in peer-to-peer mode. | 190 // must specify. Empty in peer-to-peer mode. |
| 190 std::string ssl_server_name_; | 191 std::string ssl_server_name_; |
| 191 // The certificate that the peer must present or did present. Initially | 192 // The certificate that the peer must present or did present. Initially |
| 192 // null in traditional mode, until the connection is established. | 193 // null in traditional mode, until the connection is established. |
| 193 scoped_ptr<OpenSSLCertificate> peer_certificate_; | 194 std::unique_ptr<OpenSSLCertificate> peer_certificate_; |
| 194 // In peer-to-peer mode, the digest of the certificate that | 195 // In peer-to-peer mode, the digest of the certificate that |
| 195 // the peer must present. | 196 // the peer must present. |
| 196 Buffer peer_certificate_digest_value_; | 197 Buffer peer_certificate_digest_value_; |
| 197 std::string peer_certificate_digest_algorithm_; | 198 std::string peer_certificate_digest_algorithm_; |
| 198 | 199 |
| 199 // OpenSSLAdapter::custom_verify_callback_ result | 200 // OpenSSLAdapter::custom_verify_callback_ result |
| 200 bool custom_verification_succeeded_; | 201 bool custom_verification_succeeded_; |
| 201 | 202 |
| 202 // The DtlsSrtp ciphers | 203 // The DtlsSrtp ciphers |
| 203 std::string srtp_ciphers_; | 204 std::string srtp_ciphers_; |
| 204 | 205 |
| 205 // Do DTLS or not | 206 // Do DTLS or not |
| 206 SSLMode ssl_mode_; | 207 SSLMode ssl_mode_; |
| 207 | 208 |
| 208 // Max. allowed protocol version | 209 // Max. allowed protocol version |
| 209 SSLProtocolVersion ssl_max_version_; | 210 SSLProtocolVersion ssl_max_version_; |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 ///////////////////////////////////////////////////////////////////////////// | 213 ///////////////////////////////////////////////////////////////////////////// |
| 213 | 214 |
| 214 } // namespace rtc | 215 } // namespace rtc |
| 215 | 216 |
| 216 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ | 217 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ |
| OLD | NEW |