| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/ssl_client_socket_impl.h" | 5 #include "net/socket/ssl_client_socket_impl.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <openssl/bio.h> | 8 #include <openssl/bio.h> |
| 9 #include <openssl/bytestring.h> | 9 #include <openssl/bytestring.h> |
| 10 #include <openssl/err.h> | 10 #include <openssl/err.h> |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 std::unique_ptr<base::Value> NetLogPrivateKeyOperationCallback( | 106 std::unique_ptr<base::Value> NetLogPrivateKeyOperationCallback( |
| 107 SSLPrivateKey::Type type, | 107 SSLPrivateKey::Type type, |
| 108 SSLPrivateKey::Hash hash, | 108 SSLPrivateKey::Hash hash, |
| 109 NetLogCaptureMode mode) { | 109 NetLogCaptureMode mode) { |
| 110 std::string type_str; | 110 std::string type_str; |
| 111 switch (type) { | 111 switch (type) { |
| 112 case SSLPrivateKey::Type::RSA: | 112 case SSLPrivateKey::Type::RSA: |
| 113 type_str = "RSA"; | 113 type_str = "RSA"; |
| 114 break; | 114 break; |
| 115 case SSLPrivateKey::Type::ECDSA: | 115 case SSLPrivateKey::Type::ECDSA_P256: |
| 116 type_str = "ECDSA"; | 116 type_str = "ECDSA_P256"; |
| 117 break; |
| 118 case SSLPrivateKey::Type::ECDSA_P384: |
| 119 type_str = "ECDSA_P384"; |
| 120 break; |
| 121 case SSLPrivateKey::Type::ECDSA_P521: |
| 122 type_str = "ECDSA_P521"; |
| 117 break; | 123 break; |
| 118 } | 124 } |
| 119 | 125 |
| 120 std::string hash_str; | 126 std::string hash_str; |
| 121 switch (hash) { | 127 switch (hash) { |
| 122 case SSLPrivateKey::Hash::MD5_SHA1: | 128 case SSLPrivateKey::Hash::MD5_SHA1: |
| 123 hash_str = "MD5_SHA1"; | 129 hash_str = "MD5_SHA1"; |
| 124 break; | 130 break; |
| 125 case SSLPrivateKey::Hash::SHA1: | 131 case SSLPrivateKey::Hash::SHA1: |
| 126 hash_str = "SHA1"; | 132 hash_str = "SHA1"; |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 for (NextProto allowed : ssl_config_.renego_allowed_for_protos) { | 2049 for (NextProto allowed : ssl_config_.renego_allowed_for_protos) { |
| 2044 if (negotiated_protocol_ == allowed) | 2050 if (negotiated_protocol_ == allowed) |
| 2045 return true; | 2051 return true; |
| 2046 } | 2052 } |
| 2047 return false; | 2053 return false; |
| 2048 } | 2054 } |
| 2049 | 2055 |
| 2050 int SSLClientSocketImpl::PrivateKeyTypeCallback() { | 2056 int SSLClientSocketImpl::PrivateKeyTypeCallback() { |
| 2051 switch (ssl_config_.client_private_key->GetType()) { | 2057 switch (ssl_config_.client_private_key->GetType()) { |
| 2052 case SSLPrivateKey::Type::RSA: | 2058 case SSLPrivateKey::Type::RSA: |
| 2053 return EVP_PKEY_RSA; | 2059 return NID_rsaEncryption; |
| 2054 case SSLPrivateKey::Type::ECDSA: | 2060 case SSLPrivateKey::Type::ECDSA_P256: |
| 2055 return EVP_PKEY_EC; | 2061 return NID_X9_62_prime256v1; |
| 2062 case SSLPrivateKey::Type::ECDSA_P384: |
| 2063 return NID_secp384r1; |
| 2064 case SSLPrivateKey::Type::ECDSA_P521: |
| 2065 return NID_secp521r1; |
| 2056 } | 2066 } |
| 2057 NOTREACHED(); | 2067 NOTREACHED(); |
| 2058 return EVP_PKEY_NONE; | 2068 return NID_undef; |
| 2059 } | 2069 } |
| 2060 | 2070 |
| 2061 size_t SSLClientSocketImpl::PrivateKeyMaxSignatureLenCallback() { | 2071 size_t SSLClientSocketImpl::PrivateKeyMaxSignatureLenCallback() { |
| 2062 return ssl_config_.client_private_key->GetMaxSignatureLengthInBytes(); | 2072 return ssl_config_.client_private_key->GetMaxSignatureLengthInBytes(); |
| 2063 } | 2073 } |
| 2064 | 2074 |
| 2065 ssl_private_key_result_t SSLClientSocketImpl::PrivateKeySignDigestCallback( | 2075 ssl_private_key_result_t SSLClientSocketImpl::PrivateKeySignDigestCallback( |
| 2066 uint8_t* out, | 2076 uint8_t* out, |
| 2067 size_t* out_len, | 2077 size_t* out_len, |
| 2068 size_t max_out, | 2078 size_t max_out, |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2286 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && | 2296 if (ERR_GET_REASON(info->error_code) == SSL_R_TLSV1_ALERT_ACCESS_DENIED && |
| 2287 !certificate_requested_) { | 2297 !certificate_requested_) { |
| 2288 net_error = ERR_SSL_PROTOCOL_ERROR; | 2298 net_error = ERR_SSL_PROTOCOL_ERROR; |
| 2289 } | 2299 } |
| 2290 } | 2300 } |
| 2291 | 2301 |
| 2292 return net_error; | 2302 return net_error; |
| 2293 } | 2303 } |
| 2294 | 2304 |
| 2295 } // namespace net | 2305 } // namespace net |
| OLD | NEW |