Skip to content

Commit

Permalink
Bug 1088140 - support RSA-PSS signatures on certificates in the certi…
Browse files Browse the repository at this point in the history
…ficate verifier r=jschanck

Differential Revision: https://phabricator.services.mozilla.com/D141780
  • Loading branch information
mozkeeler committed Mar 24, 2022
1 parent caf282f commit 7cd2342
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 0 deletions.
8 changes: 8 additions & 0 deletions security/apps/AppTrustDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ Result AppTrustDomain::VerifyRSAPKCS1SignedData(Input data,
subjectPublicKeyInfo, nullptr);
}

Result AppTrustDomain::VerifyRSAPSSSignedData(Input data,
DigestAlgorithm digestAlgorithm,
Input signature,
Input subjectPublicKeyInfo) {
return VerifyRSAPSSSignedDataNSS(data, digestAlgorithm, signature,
subjectPublicKeyInfo, nullptr);
}

Result AppTrustDomain::CheckECDSACurveIsAcceptable(
EndEntityOrCA /*endEntityOrCA*/, NamedCurve curve) {
switch (curve) {
Expand Down
4 changes: 4 additions & 0 deletions security/apps/AppTrustDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ class AppTrustDomain final : public mozilla::pkix::TrustDomain {
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;
virtual Result VerifyRSAPSSSignedData(
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;
virtual Result CheckECDSACurveIsAcceptable(
mozilla::pkix::EndEntityOrCA endEntityOrCA,
mozilla::pkix::NamedCurve curve) override;
Expand Down
7 changes: 7 additions & 0 deletions security/certverifier/NSSCertDBTrustDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,13 @@ Result NSSCertDBTrustDomain::VerifyRSAPKCS1SignedData(
subjectPublicKeyInfo, mPinArg);
}

Result NSSCertDBTrustDomain::VerifyRSAPSSSignedData(
Input data, DigestAlgorithm digestAlgorithm, Input signature,
Input subjectPublicKeyInfo) {
return VerifyRSAPSSSignedDataNSS(data, digestAlgorithm, signature,
subjectPublicKeyInfo, mPinArg);
}

Result NSSCertDBTrustDomain::CheckECDSACurveIsAcceptable(
EndEntityOrCA /*endEntityOrCA*/, NamedCurve curve) {
switch (curve) {
Expand Down
5 changes: 5 additions & 0 deletions security/certverifier/NSSCertDBTrustDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ class NSSCertDBTrustDomain : public mozilla::pkix::TrustDomain {
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;

virtual Result VerifyRSAPSSSignedData(
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;

virtual Result CheckECDSACurveIsAcceptable(
mozilla::pkix::EndEntityOrCA endEntityOrCA,
mozilla::pkix::NamedCurve curve) override;
Expand Down
7 changes: 7 additions & 0 deletions security/certverifier/OCSPVerificationTrustDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ Result OCSPVerificationTrustDomain::VerifyRSAPKCS1SignedData(
data, digestAlgorithm, signature, subjectPublicKeyInfo);
}

Result OCSPVerificationTrustDomain::VerifyRSAPSSSignedData(
Input data, DigestAlgorithm digestAlgorithm, Input signature,
Input subjectPublicKeyInfo) {
return mCertDBTrustDomain.VerifyRSAPSSSignedData(
data, digestAlgorithm, signature, subjectPublicKeyInfo);
}

Result OCSPVerificationTrustDomain::CheckECDSACurveIsAcceptable(
EndEntityOrCA aEEOrCA, NamedCurve aCurve) {
return mCertDBTrustDomain.CheckECDSACurveIsAcceptable(aEEOrCA, aCurve);
Expand Down
5 changes: 5 additions & 0 deletions security/certverifier/OCSPVerificationTrustDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class OCSPVerificationTrustDomain : public mozilla::pkix::TrustDomain {
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;

virtual Result VerifyRSAPSSSignedData(
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;

virtual Result CheckECDSACurveIsAcceptable(
mozilla::pkix::EndEntityOrCA endEntityOrCA,
mozilla::pkix::NamedCurve curve) override;
Expand Down
4 changes: 4 additions & 0 deletions security/ct/CTLogVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ class SignatureParamsTrustDomain final : public TrustDomain {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
}

Result VerifyRSAPSSSignedData(Input, DigestAlgorithm, Input, Input) override {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
}

Result CheckValidityIsAcceptable(Time, Time, EndEntityOrCA,
KeyPurposeId) override {
return Result::FATAL_ERROR_LIBRARY_FAILURE;
Expand Down
8 changes: 8 additions & 0 deletions security/ct/tests/gtest/CTTestUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,14 @@ class OCSPExtensionTrustDomain : public TrustDomain {
subjectPublicKeyInfo, nullptr);
}

pkix::Result VerifyRSAPSSSignedData(Input data,
DigestAlgorithm digestAlgorithm,
Input signature,
Input subjectPublicKeyInfo) override {
return VerifyRSAPSSSignedDataNSS(data, digestAlgorithm, signature,
subjectPublicKeyInfo, nullptr);
}

pkix::Result CheckValidityIsAcceptable(Time, Time, EndEntityOrCA,
KeyPurposeId) override {
ADD_FAILURE();
Expand Down
8 changes: 8 additions & 0 deletions security/manager/ssl/CSTrustDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ Result CSTrustDomain::VerifyRSAPKCS1SignedData(Input data,
subjectPublicKeyInfo, nullptr);
}

Result CSTrustDomain::VerifyRSAPSSSignedData(Input data,
DigestAlgorithm digestAlgorithm,
Input signature,
Input subjectPublicKeyInfo) {
return VerifyRSAPSSSignedDataNSS(data, digestAlgorithm, signature,
subjectPublicKeyInfo, nullptr);
}

Result CSTrustDomain::CheckECDSACurveIsAcceptable(EndEntityOrCA endEntityOrCA,
NamedCurve curve) {
switch (curve) {
Expand Down
4 changes: 4 additions & 0 deletions security/manager/ssl/CSTrustDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ class CSTrustDomain final : public mozilla::pkix::TrustDomain {
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;
virtual Result VerifyRSAPSSSignedData(
mozilla::pkix::Input data, mozilla::pkix::DigestAlgorithm digestAlgorithm,
mozilla::pkix::Input signature,
mozilla::pkix::Input subjectPublicKeyInfo) override;
virtual Result CheckECDSACurveIsAcceptable(
mozilla::pkix::EndEntityOrCA endEntityOrCA,
mozilla::pkix::NamedCurve curve) override;
Expand Down
5 changes: 5 additions & 0 deletions security/manager/ssl/nsNSSIOLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,11 @@ class ClientAuthCertNonverifyingTrustDomain final : public TrustDomain {
Input subjectPublicKeyInfo) override {
return Success;
}
virtual mozilla::pkix::Result VerifyRSAPSSSignedData(
Input data, DigestAlgorithm, Input signature,
Input subjectPublicKeyInfo) override {
return Success;
}
virtual mozilla::pkix::Result CheckECDSACurveIsAcceptable(
EndEntityOrCA endEntityOrCA, NamedCurve curve) override {
return Success;
Expand Down

0 comments on commit 7cd2342

Please sign in to comment.