Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: net/socket/ssl_server_socket_impl.cc

Issue 2786173003: Convert android to use X509CertificateBytes instead of X509CertificateOpenSSL. (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/ct_objects_extractor.cc ('k') | net/ssl/openssl_client_key_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_server_socket_impl.cc
diff --git a/net/socket/ssl_server_socket_impl.cc b/net/socket/ssl_server_socket_impl.cc
index 9b3cfd303d1a48e407e7ba8565d706b7f87189bc..24fc2bf35c294b6d6826742cdb6541a29456f810 100644
--- a/net/socket/ssl_server_socket_impl.cc
+++ b/net/socket/ssl_server_socket_impl.cc
@@ -643,7 +643,12 @@ SSLServerContextImpl::SSLServerContextImpl(
// Set certificate and private key.
DCHECK(cert_->os_cert_handle());
-#if defined(USE_OPENSSL_CERTS)
+#if BUILDFLAG(USE_BYTE_CERTS)
+ bssl::UniquePtr<X509> x509(X509_parse_from_buffer(cert_->os_cert_handle()));
+ CHECK(x509);
+ // On success, SSL_CTX_use_certificate acquires a reference to |x509|.
+ CHECK(SSL_CTX_use_certificate(ssl_ctx_.get(), x509.get()));
+#elif defined(USE_OPENSSL_CERTS)
CHECK(SSL_CTX_use_certificate(ssl_ctx_.get(), cert_->os_cert_handle()));
#else
// Convert OSCertHandle to X509 structure.
@@ -659,7 +664,7 @@ SSLServerContextImpl::SSLServerContextImpl(
// On success, SSL_CTX_use_certificate acquires a reference to |x509|.
CHECK(SSL_CTX_use_certificate(ssl_ctx_.get(), x509.get()));
-#endif // USE_OPENSSL_CERTS
+#endif // USE_OPENSSL_CERTS && !USE_BYTE_CERTS
davidben 2017/04/11 23:42:45 You can simplify this a bit and SSL_CTX_use_certif
mattm 2017/04/12 23:07:45 Updated. Mind taking another look?
DCHECK(key_->key());
CHECK(SSL_CTX_use_PrivateKey(ssl_ctx_.get(), key_->key()));
« no previous file with comments | « net/cert/ct_objects_extractor.cc ('k') | net/ssl/openssl_client_key_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698