| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ssl/openssl_ssl_util.h" | 5 #include "net/ssl/openssl_ssl_util.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <openssl/err.h> | 8 #include <openssl/err.h> |
| 9 #include <openssl/ssl.h> | 9 #include <openssl/ssl.h> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 int GetNetSSLVersion(SSL* ssl) { | 209 int GetNetSSLVersion(SSL* ssl) { |
| 210 switch (SSL_version(ssl)) { | 210 switch (SSL_version(ssl)) { |
| 211 case TLS1_VERSION: | 211 case TLS1_VERSION: |
| 212 return SSL_CONNECTION_VERSION_TLS1; | 212 return SSL_CONNECTION_VERSION_TLS1; |
| 213 case TLS1_1_VERSION: | 213 case TLS1_1_VERSION: |
| 214 return SSL_CONNECTION_VERSION_TLS1_1; | 214 return SSL_CONNECTION_VERSION_TLS1_1; |
| 215 case TLS1_2_VERSION: | 215 case TLS1_2_VERSION: |
| 216 return SSL_CONNECTION_VERSION_TLS1_2; | 216 return SSL_CONNECTION_VERSION_TLS1_2; |
| 217 case TLS1_3_VERSION: |
| 218 return SSL_CONNECTION_VERSION_TLS1_3; |
| 217 default: | 219 default: |
| 218 NOTREACHED(); | 220 NOTREACHED(); |
| 219 return SSL_CONNECTION_VERSION_UNKNOWN; | 221 return SSL_CONNECTION_VERSION_UNKNOWN; |
| 220 } | 222 } |
| 221 } | 223 } |
| 222 | 224 |
| 223 ScopedX509 OSCertHandleToOpenSSL(X509Certificate::OSCertHandle os_handle) { | 225 ScopedX509 OSCertHandleToOpenSSL(X509Certificate::OSCertHandle os_handle) { |
| 224 #if defined(USE_OPENSSL_CERTS) | 226 #if defined(USE_OPENSSL_CERTS) |
| 225 return ScopedX509(X509Certificate::DupOSCertHandle(os_handle)); | 227 return ScopedX509(X509Certificate::DupOSCertHandle(os_handle)); |
| 226 #else // !defined(USE_OPENSSL_CERTS) | 228 #else // !defined(USE_OPENSSL_CERTS) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 238 for (size_t i = 0; i < os_handles.size(); i++) { | 240 for (size_t i = 0; i < os_handles.size(); i++) { |
| 239 ScopedX509 x509 = OSCertHandleToOpenSSL(os_handles[i]); | 241 ScopedX509 x509 = OSCertHandleToOpenSSL(os_handles[i]); |
| 240 if (!x509) | 242 if (!x509) |
| 241 return nullptr; | 243 return nullptr; |
| 242 sk_X509_push(stack.get(), x509.release()); | 244 sk_X509_push(stack.get(), x509.release()); |
| 243 } | 245 } |
| 244 return stack; | 246 return stack; |
| 245 } | 247 } |
| 246 | 248 |
| 247 } // namespace net | 249 } // namespace net |
| OLD | NEW |