| 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 class OpenSSLIdentity; | 55 class OpenSSLIdentity; |
| 56 | 56 |
| 57 /////////////////////////////////////////////////////////////////////////////// | 57 /////////////////////////////////////////////////////////////////////////////// |
| 58 | 58 |
| 59 class OpenSSLStreamAdapter : public SSLStreamAdapter { | 59 class OpenSSLStreamAdapter : public SSLStreamAdapter { |
| 60 public: | 60 public: |
| 61 explicit OpenSSLStreamAdapter(StreamInterface* stream); | 61 explicit OpenSSLStreamAdapter(StreamInterface* stream); |
| 62 ~OpenSSLStreamAdapter() override; | 62 ~OpenSSLStreamAdapter() override; |
| 63 | 63 |
| 64 void SetIdentity(SSLIdentity* identity) override; | 64 void SetCertificate( |
| 65 const scoped_refptr<webrtc::DtlsCertificate>& certificate) 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 bool GetPeerCertificate(SSLCertificate** cert) const override; | 73 bool GetPeerCertificate(SSLCertificate** cert) const override; |
| 73 | 74 |
| 74 int StartSSLWithServer(const char* server_name) override; | 75 int StartSSLWithServer(const char* server_name) override; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 SSLRole role_; | 175 SSLRole role_; |
| 175 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED | 176 int ssl_error_code_; // valid when state_ == SSL_ERROR or SSL_CLOSED |
| 176 // Whether the SSL negotiation is blocked on needing to read or | 177 // Whether the SSL negotiation is blocked on needing to read or |
| 177 // write to the wrapped stream. | 178 // write to the wrapped stream. |
| 178 bool ssl_read_needs_write_; | 179 bool ssl_read_needs_write_; |
| 179 bool ssl_write_needs_read_; | 180 bool ssl_write_needs_read_; |
| 180 | 181 |
| 181 SSL* ssl_; | 182 SSL* ssl_; |
| 182 SSL_CTX* ssl_ctx_; | 183 SSL_CTX* ssl_ctx_; |
| 183 | 184 |
| 184 // Our key and certificate, mostly useful in peer-to-peer mode. | 185 // Contains our key and certificate, mostly useful in peer-to-peer mode. |
| 185 scoped_ptr<OpenSSLIdentity> identity_; | 186 scoped_refptr<webrtc::DtlsCertificate> certificate_; |
| 186 // in traditional mode, the server name that the server's certificate | 187 // in traditional mode, the server name that the server's certificate |
| 187 // must specify. Empty in peer-to-peer mode. | 188 // must specify. Empty in peer-to-peer mode. |
| 188 std::string ssl_server_name_; | 189 std::string ssl_server_name_; |
| 189 // The certificate that the peer must present or did present. Initially | 190 // The certificate that the peer must present or did present. Initially |
| 190 // null in traditional mode, until the connection is established. | 191 // null in traditional mode, until the connection is established. |
| 191 scoped_ptr<OpenSSLCertificate> peer_certificate_; | 192 scoped_ptr<OpenSSLCertificate> peer_certificate_; |
| 192 // In peer-to-peer mode, the digest of the certificate that | 193 // In peer-to-peer mode, the digest of the certificate that |
| 193 // the peer must present. | 194 // the peer must present. |
| 194 Buffer peer_certificate_digest_value_; | 195 Buffer peer_certificate_digest_value_; |
| 195 std::string peer_certificate_digest_algorithm_; | 196 std::string peer_certificate_digest_algorithm_; |
| 196 | 197 |
| 197 // OpenSSLAdapter::custom_verify_callback_ result | 198 // OpenSSLAdapter::custom_verify_callback_ result |
| 198 bool custom_verification_succeeded_; | 199 bool custom_verification_succeeded_; |
| 199 | 200 |
| 200 // The DtlsSrtp ciphers | 201 // The DtlsSrtp ciphers |
| 201 std::string srtp_ciphers_; | 202 std::string srtp_ciphers_; |
| 202 | 203 |
| 203 // Do DTLS or not | 204 // Do DTLS or not |
| 204 SSLMode ssl_mode_; | 205 SSLMode ssl_mode_; |
| 205 | 206 |
| 206 // Max. allowed protocol version | 207 // Max. allowed protocol version |
| 207 SSLProtocolVersion ssl_max_version_; | 208 SSLProtocolVersion ssl_max_version_; |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 ///////////////////////////////////////////////////////////////////////////// | 211 ///////////////////////////////////////////////////////////////////////////// |
| 211 | 212 |
| 212 } // namespace rtc | 213 } // namespace rtc |
| 213 | 214 |
| 214 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ | 215 #endif // WEBRTC_BASE_OPENSSLSTREAMADAPTER_H__ |
| OLD | NEW |