Index: net/ssl/openssl_ssl_util.cc |
diff --git a/net/ssl/openssl_ssl_util.cc b/net/ssl/openssl_ssl_util.cc |
index c3988b4648733ed26a9527d6dcff36a410f98e6f..8071da64f5ac38153d54241bb81b15f7d418fbea 100644 |
--- a/net/ssl/openssl_ssl_util.cc |
+++ b/net/ssl/openssl_ssl_util.cc |
@@ -227,15 +227,17 @@ int GetNetSSLVersion(SSL* ssl) { |
bssl::UniquePtr<X509> OSCertHandleToOpenSSL( |
X509Certificate::OSCertHandle os_handle) { |
-#if defined(USE_OPENSSL_CERTS) |
+#if BUILDFLAG(USE_BYTE_CERTS) |
+ return bssl::UniquePtr<X509>(X509_parse_from_buffer(os_handle)); |
+#elif defined(USE_OPENSSL_CERTS) |
return bssl::UniquePtr<X509>(X509Certificate::DupOSCertHandle(os_handle)); |
-#else // !defined(USE_OPENSSL_CERTS) |
+#else // !defined(USE_OPENSSL_CERTS) && !BUILDFLAG(USE_BYTE_CERTS) |
std::string der_encoded; |
if (!X509Certificate::GetDEREncoded(os_handle, &der_encoded)) |
return bssl::UniquePtr<X509>(); |
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_encoded.data()); |
return bssl::UniquePtr<X509>(d2i_X509(NULL, &bytes, der_encoded.size())); |
-#endif // defined(USE_OPENSSL_CERTS) |
+#endif // defined(USE_OPENSSL_CERTS) && BUILDFLAG(USE_BYTE_CERTS) |
} |
bssl::UniquePtr<STACK_OF(X509)> OSCertHandlesToOpenSSL( |