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

Side by Side Diff: net/cert/ct_objects_extractor.cc

Issue 2786173003: Convert android to use X509CertificateBytes instead of X509CertificateOpenSSL. (Closed)
Patch Set: ssl_server_socket_impl.cc simplifications 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 unified diff | Download patch
« no previous file with comments | « net/BUILD.gn ('k') | net/socket/ssl_server_socket_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cert/ct_objects_extractor.h" 5 #include "net/cert/ct_objects_extractor.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 23 matching lines...) Expand all
34 0xD6, 0x79, 0x02, 0x04, 0x05}; 34 0xD6, 0x79, 0x02, 0x04, 0x05};
35 35
36 bool StringEqualToCBS(const std::string& value1, const CBS* value2) { 36 bool StringEqualToCBS(const std::string& value1, const CBS* value2) {
37 if (CBS_len(value2) != value1.size()) 37 if (CBS_len(value2) != value1.size())
38 return false; 38 return false;
39 return memcmp(value1.data(), CBS_data(value2), CBS_len(value2)) == 0; 39 return memcmp(value1.data(), CBS_data(value2), CBS_len(value2)) == 0;
40 } 40 }
41 41
42 bssl::UniquePtr<X509> OSCertHandleToOpenSSL( 42 bssl::UniquePtr<X509> OSCertHandleToOpenSSL(
43 X509Certificate::OSCertHandle os_handle) { 43 X509Certificate::OSCertHandle os_handle) {
44 #if defined(USE_OPENSSL_CERTS) 44 #if BUILDFLAG(USE_BYTE_CERTS)
45 return bssl::UniquePtr<X509>(X509_parse_from_buffer(os_handle));
46 #elif defined(USE_OPENSSL_CERTS)
45 return bssl::UniquePtr<X509>(X509Certificate::DupOSCertHandle(os_handle)); 47 return bssl::UniquePtr<X509>(X509Certificate::DupOSCertHandle(os_handle));
46 #else 48 #else
47 std::string der_encoded; 49 std::string der_encoded;
48 if (!X509Certificate::GetDEREncoded(os_handle, &der_encoded)) 50 if (!X509Certificate::GetDEREncoded(os_handle, &der_encoded))
49 return bssl::UniquePtr<X509>(); 51 return bssl::UniquePtr<X509>();
50 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_encoded.data()); 52 const uint8_t* bytes = reinterpret_cast<const uint8_t*>(der_encoded.data());
51 return bssl::UniquePtr<X509>(d2i_X509(NULL, &bytes, der_encoded.size())); 53 return bssl::UniquePtr<X509>(d2i_X509(NULL, &bytes, der_encoded.size()));
52 #endif 54 #endif
53 } 55 }
54 56
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions)) 344 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions))
343 return false; 345 return false;
344 346
345 return GetSCTListFromX509_EXTENSIONS(x509_exts.get(), kOCSPExtensionOid, 347 return GetSCTListFromX509_EXTENSIONS(x509_exts.get(), kOCSPExtensionOid,
346 sizeof(kOCSPExtensionOid), sct_list); 348 sizeof(kOCSPExtensionOid), sct_list);
347 } 349 }
348 350
349 } // namespace ct 351 } // namespace ct
350 352
351 } // namespace net 353 } // namespace net
OLDNEW
« no previous file with comments | « net/BUILD.gn ('k') | net/socket/ssl_server_socket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698