File tree Expand file tree Collapse file tree 4 files changed +24
-9
lines changed
Expand file tree Collapse file tree 4 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -6329,7 +6329,7 @@ SymCryptRsaPssVerify(
63296329// pbHashValue) with the pkRsakey key using RSA PSS. The signature is input
63306330// in the pbSignature buffer.
63316331//
6332- // It returns SYMCRYPT_NO_ERROR if the verification suceeded or SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE
6332+ // It returns SYMCRYPT_NO_ERROR if the verification succeeded or SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE
63336333// if it failed.
63346334//
63356335// nfSignature is the number format of the signature (i.e. the pbSignature buffer). Currently
Original file line number Diff line number Diff line change @@ -1041,7 +1041,7 @@ SymCryptRsaPssVerifySignaturePadding(
10411041 {
10421042 if (pbPSSFormat [0 ] != 0 )
10431043 {
1044- scError = SYMCRYPT_INVALID_ARGUMENT ;
1044+ scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE ;
10451045 goto cleanup ;
10461046 }
10471047 pbPSSFormat ++ ;
@@ -1063,7 +1063,7 @@ SymCryptRsaPssVerifySignaturePadding(
10631063 pbPSSFormat [cbPSSFormat - 1 ] != 0xbc
10641064 )
10651065 {
1066- scError = SYMCRYPT_INVALID_ARGUMENT ;
1066+ scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE ;
10671067 goto cleanup ;
10681068 }
10691069
@@ -1103,15 +1103,15 @@ SymCryptRsaPssVerifySignaturePadding(
11031103 {
11041104 if (pbDBMask [i ] != 0x00 )
11051105 {
1106- scError = SYMCRYPT_INVALID_ARGUMENT ;
1106+ scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE ;
11071107 goto cleanup ;
11081108 }
11091109 }
11101110
11111111 // ensure the 0x01 byte is part of DB
11121112 if (pbDBMask [cbDB - cbSalt - 1 ] != 0x01 )
11131113 {
1114- scError = SYMCRYPT_INVALID_ARGUMENT ;
1114+ scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE ;
11151115 goto cleanup ;
11161116 }
11171117
@@ -1127,7 +1127,7 @@ SymCryptRsaPssVerifySignaturePadding(
11271127
11281128 if ( !SymCryptEqual (pbPSSFormat + cbDB , pbMPrimeHash , cbHashAlg ) )
11291129 {
1130- scError = SYMCRYPT_INVALID_ARGUMENT ;
1130+ scError = SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE ;
11311131 goto cleanup ;
11321132 }
11331133
Original file line number Diff line number Diff line change @@ -1823,7 +1823,7 @@ RsaSignImp<ImpCng, AlgRsaSignPss>::verify(
18231823 BCRYPT_PSS_PADDING_INFO paddingInfo;
18241824 PCCNG_HASH_INFO pInfo;
18251825
1826- pInfo = getHashInfo ( pcstrHashAlgName);
1826+ pInfo = getHashInfo ( pcstrHashAlgName);
18271827 paddingInfo.pszAlgId = pInfo->wideName ;
18281828 paddingInfo.cbSalt = u32Other;
18291829
@@ -1836,6 +1836,17 @@ RsaSignImp<ImpCng, AlgRsaSignPss>::verify(
18361836 (UINT32)cbSig,
18371837 BCRYPT_PAD_PSS );
18381838
1839+ // saml 2022/04:
1840+ // In order to update error message returned from SymCryptRsaPssVerify and not break
1841+ // multi-implementation test of SymCrypt vs. CNG, we must map STATUS_INVALID_SIGNATURE
1842+ // to STATUS_INVALID_PARAMETER for now.
1843+ // Once both CNG and SymCrypt are updated reliably we can reintroduce testing that the two
1844+ // error responses cohere - but for now they won't.
1845+ if ( ntStatus == STATUS_INVALID_SIGNATURE )
1846+ {
1847+ ntStatus = STATUS_INVALID_PARAMETER;
1848+ }
1849+
18391850 return ntStatus;
18401851}
18411852
Original file line number Diff line number Diff line change @@ -4440,9 +4440,13 @@ RsaSignImp<ImpSc, AlgRsaSignPss>::verify(
44404440 case SYMCRYPT_NO_ERROR:
44414441 ntStatus = STATUS_SUCCESS;
44424442 break ;
4443+ // saml 2022/04:
4444+ // In order to update error message returned from SymCryptRsaPssVerify and not break
4445+ // multi-implementation test of SymCrypt vs. CNG, we must map SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE
4446+ // to STATUS_INVALID_PARAMETER rather than STATUS_INVALID_SIGNATURE for now.
4447+ // Once both CNG and SymCrypt are updated reliably we can reintroduce testing that the two
4448+ // error responses cohere - but for now they won't.
44434449 case SYMCRYPT_SIGNATURE_VERIFICATION_FAILURE:
4444- ntStatus = STATUS_INVALID_SIGNATURE;
4445- break ;
44464450 case SYMCRYPT_INVALID_ARGUMENT:
44474451 ntStatus = STATUS_INVALID_PARAMETER;
44484452 break ;
You can’t perform that action at this time.
0 commit comments