| Index: net/cert/ct_log_verifier.cc
|
| diff --git a/net/cert/ct_log_verifier.cc b/net/cert/ct_log_verifier.cc
|
| index 1c9374dfd941baf7bcff7bad5cfa8fbda633f788..f008963b53ff6684df16e4ff963a4158a30477a6 100644
|
| --- a/net/cert/ct_log_verifier.cc
|
| +++ b/net/cert/ct_log_verifier.cc
|
| @@ -19,38 +19,42 @@ scoped_ptr<CTLogVerifier> CTLogVerifier::Create(
|
| return result.Pass();
|
| }
|
|
|
| -bool CTLogVerifier::Verify(const ct::LogEntry& entry,
|
| - const ct::SignedCertificateTimestamp& sct) {
|
| +CTLogVerifier::VerifyResult CTLogVerifier::Verify(
|
| + const ct::LogEntry& entry,
|
| + const ct::SignedCertificateTimestamp& sct) {
|
| if (sct.log_id != key_id()) {
|
| DVLOG(1) << "SCT is not signed by this log.";
|
| - return false;
|
| + return CTLogVerifier::SCT_NOT_FROM_THIS_LOG;
|
| }
|
|
|
| if (sct.signature.hash_algorithm != hash_algorithm_) {
|
| DVLOG(1) << "Mismatched hash algorithm. Expected " << hash_algorithm_
|
| << ", got " << sct.signature.hash_algorithm << ".";
|
| - return false;
|
| + return CTLogVerifier::SCT_ALGORITHM_MISMATCH;
|
| }
|
|
|
| if (sct.signature.signature_algorithm != signature_algorithm_) {
|
| DVLOG(1) << "Mismatched sig algorithm. Expected " << signature_algorithm_
|
| << ", got " << sct.signature.signature_algorithm << ".";
|
| - return false;
|
| + return CTLogVerifier::SCT_ALGORITHM_MISMATCH;
|
| }
|
|
|
| std::string serialized_log_entry;
|
| if (!ct::EncodeLogEntry(entry, &serialized_log_entry)) {
|
| DVLOG(1) << "Unable to serialize entry.";
|
| - return false;
|
| + return CTLogVerifier::SCT_DATA_SERIALIZATION_FAILED;
|
| }
|
| std::string serialized_data;
|
| if (!ct::EncodeV1SCTSignedData(sct.timestamp, serialized_log_entry,
|
| sct.extensions, &serialized_data)) {
|
| DVLOG(1) << "Unable to create SCT to verify.";
|
| - return false;
|
| + return CTLogVerifier::SCT_DATA_SERIALIZATION_FAILED;
|
| }
|
|
|
| - return VerifySignature(serialized_data, sct.signature.signature_data);
|
| + if (VerifySignature(serialized_data, sct.signature.signature_data))
|
| + return CTLogVerifier::SCT_VERIFIED_OK;
|
| +
|
| + return CTLogVerifier::SCT_VERIFICATION_FAILED;
|
| }
|
|
|
| } // namespace net
|
|
|