OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/merkle_tree_leaf.h" | 5 #include "net/cert/merkle_tree_leaf.h" |
6 | 6 |
7 #include "crypto/sha2.h" | 7 #include "crypto/sha2.h" |
8 #include "net/cert/ct_objects_extractor.h" | 8 #include "net/cert/ct_objects_extractor.h" |
9 #include "net/cert/ct_serialization.h" | 9 #include "net/cert/ct_serialization.h" |
10 #include "net/cert/x509_certificate.h" | 10 #include "net/cert/x509_certificate.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 *out = crypto::SHA256HashString(leaf_in_tls_format); | 30 *out = crypto::SHA256HashString(leaf_in_tls_format); |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 bool GetMerkleTreeLeaf(const X509Certificate* cert, | 34 bool GetMerkleTreeLeaf(const X509Certificate* cert, |
35 const SignedCertificateTimestamp* sct, | 35 const SignedCertificateTimestamp* sct, |
36 MerkleTreeLeaf* merkle_tree_leaf) { | 36 MerkleTreeLeaf* merkle_tree_leaf) { |
37 if (sct->origin == SignedCertificateTimestamp::SCT_EMBEDDED) { | 37 if (sct->origin == SignedCertificateTimestamp::SCT_EMBEDDED) { |
38 if (cert->GetIntermediateCertificates().empty() || | 38 if (cert->GetIntermediateCertificates().empty() || |
39 !GetPrecertLogEntry(cert->os_cert_handle(), | 39 !GetPrecertSignedEntry(cert->os_cert_handle(), |
40 cert->GetIntermediateCertificates().front(), | 40 cert->GetIntermediateCertificates().front(), |
41 &merkle_tree_leaf->log_entry)) { | 41 &merkle_tree_leaf->signed_entry)) { |
42 return false; | 42 return false; |
43 } | 43 } |
44 } else { | 44 } else { |
45 if (!GetX509LogEntry(cert->os_cert_handle(), | 45 if (!GetX509SignedEntry(cert->os_cert_handle(), |
46 &merkle_tree_leaf->log_entry)) { | 46 &merkle_tree_leaf->signed_entry)) { |
47 return false; | 47 return false; |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 merkle_tree_leaf->timestamp = sct->timestamp; | 51 merkle_tree_leaf->timestamp = sct->timestamp; |
52 merkle_tree_leaf->extensions = sct->extensions; | 52 merkle_tree_leaf->extensions = sct->extensions; |
53 return true; | 53 return true; |
54 } | 54 } |
55 | 55 |
56 } // namespace ct | 56 } // namespace ct |
57 | 57 |
58 } // namespace net | 58 } // namespace net |
OLD | NEW |