| OLD | NEW |
| 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 <openssl/bytestring.h> | 9 #include <openssl/bytestring.h> |
| 10 #include <openssl/obj.h> | 10 #include <openssl/obj.h> |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 X509_EXTENSION_free(sk_X509_EXTENSION_delete(leaf_copy_exts, i)); | 217 X509_EXTENSION_free(sk_X509_EXTENSION_delete(leaf_copy_exts, i)); |
| 218 X509_CINF_set_modified(leaf_copy->cert_info); | 218 X509_CINF_set_modified(leaf_copy->cert_info); |
| 219 break; | 219 break; |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 std::string to_be_signed; | 223 std::string to_be_signed; |
| 224 int len = i2d_X509_CINF(leaf_copy->cert_info, NULL); | 224 int len = i2d_X509_CINF(leaf_copy->cert_info, NULL); |
| 225 if (len < 0) | 225 if (len < 0) |
| 226 return false; | 226 return false; |
| 227 uint8_t* ptr = reinterpret_cast<uint8_t*>(WriteInto(&to_be_signed, len + 1)); | 227 uint8_t* ptr = |
| 228 reinterpret_cast<uint8_t*>(base::WriteInto(&to_be_signed, len + 1)); |
| 228 if (i2d_X509_CINF(leaf_copy->cert_info, &ptr) < 0) | 229 if (i2d_X509_CINF(leaf_copy->cert_info, &ptr) < 0) |
| 229 return false; | 230 return false; |
| 230 | 231 |
| 231 // Extract the issuer's public key. | 232 // Extract the issuer's public key. |
| 232 std::string issuer_der; | 233 std::string issuer_der; |
| 233 if (!X509Certificate::GetDEREncoded(issuer, &issuer_der)) | 234 if (!X509Certificate::GetDEREncoded(issuer, &issuer_der)) |
| 234 return ScopedX509(); | 235 return ScopedX509(); |
| 235 base::StringPiece issuer_key; | 236 base::StringPiece issuer_key; |
| 236 if (!asn1::ExtractSPKIFromDERCert(issuer_der, &issuer_key)) | 237 if (!asn1::ExtractSPKIFromDERCert(issuer_der, &issuer_key)) |
| 237 return false; | 238 return false; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions)) | 355 if (!x509_exts || ptr != CBS_data(&extensions) + CBS_len(&extensions)) |
| 355 return false; | 356 return false; |
| 356 | 357 |
| 357 return GetSCTListFromX509_EXTENSIONS( | 358 return GetSCTListFromX509_EXTENSIONS( |
| 358 x509_exts.get(), kOCSPExtensionOid, sizeof(kOCSPExtensionOid), sct_list); | 359 x509_exts.get(), kOCSPExtensionOid, sizeof(kOCSPExtensionOid), sct_list); |
| 359 } | 360 } |
| 360 | 361 |
| 361 } // namespace ct | 362 } // namespace ct |
| 362 | 363 |
| 363 } // namespace net | 364 } // namespace net |
| OLD | NEW |