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

Unified Diff: net/cert/internal/verify_signed_data_unittest.cc

Issue 2289363004: Add error information to VerifySignedData(). (Closed)
Patch Set: checkpoint Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: net/cert/internal/verify_signed_data_unittest.cc
diff --git a/net/cert/internal/verify_signed_data_unittest.cc b/net/cert/internal/verify_signed_data_unittest.cc
index ba0fab2c21541fb634b7e649e381a03953371bb2..85d07fc5ea2442c4bbf776da9431e2ba39fccee8 100644
--- a/net/cert/internal/verify_signed_data_unittest.cc
+++ b/net/cert/internal/verify_signed_data_unittest.cc
@@ -7,6 +7,7 @@
#include <memory>
#include <set>
+#include "net/cert/internal/cert_errors.h"
#include "net/cert/internal/signature_algorithm.h"
#include "net/cert/internal/signature_policy.h"
#include "net/cert/internal/test_helpers.h"
@@ -65,10 +66,12 @@ void RunTestCaseUsingPolicy(VerifyResult expected_result,
bool expected_result_bool = expected_result == SUCCESS;
+ // TODO(crbug.com/634443): Verify the returned errors.
+ CertErrors errors;
EXPECT_EQ(expected_result_bool,
VerifySignedData(*signature_algorithm, der::Input(&signed_data),
signature_value_bit_string,
- der::Input(&public_key), policy));
+ der::Input(&public_key), policy, &errors));
}
// RunTestCase() is the same as RunTestCaseUsingPolicy(), only it uses a
@@ -215,7 +218,8 @@ TEST(VerifySignedDataTest, EcdsaPrime256v1Sha512UnusedBitsSignature) {
// This policy rejects specifically secp384r1 curves.
class RejectSecp384r1Policy : public SignaturePolicy {
public:
- bool IsAcceptableCurveForEcdsa(int curve_nid) const override {
+ bool IsAcceptableCurveForEcdsa(int curve_nid,
+ CertErrors* errors) const override {
if (curve_nid == NID_secp384r1)
return false;
return true;
@@ -253,8 +257,8 @@ class RejectSha512 : public SignaturePolicy {
public:
RejectSha512() : SignaturePolicy() {}
- bool IsAcceptableSignatureAlgorithm(
- const SignatureAlgorithm& algorithm) const override {
+ bool IsAcceptableSignatureAlgorithm(const SignatureAlgorithm& algorithm,
+ CertErrors* errors) const override {
if (algorithm.algorithm() == SignatureAlgorithmId::RsaPss &&
algorithm.ParamsForRsaPss()->mgf1_hash() == DigestAlgorithm::Sha512) {
return false;
@@ -263,8 +267,8 @@ class RejectSha512 : public SignaturePolicy {
return algorithm.digest() != DigestAlgorithm::Sha512;
}
- bool IsAcceptableModulusLengthForRsa(
- size_t modulus_length_bits) const override {
+ bool IsAcceptableModulusLengthForRsa(size_t modulus_length_bits,
+ CertErrors* errors) const override {
return true;
}
};

Powered by Google App Engine
This is Rietveld 408576698