@@ -10347,15 +10347,10 @@ int WP11_RsaPKCSPSS_Verify(unsigned char* sig, word32 sigLen,
1034710347 pss -> hashType , pss -> saltLen , 0 );
1034810348 if (ret == 0 )
1034910349 * stat = 1 ;
10350- /* Both can indicate that the verification failed */
10351- if (ret == BAD_PADDING_E || ret == PSS_SALTLEN_E ) {
10352- * stat = 0 ;
10353- ret = 0 ;
10354- }
1035510350 }
10356- /* Make sure bad padding returns success, but verify failed.
10351+ /* Make sure bad padding/salt length returns success, but verify failed.
1035710352 * Calling code expects this. */
10358- if (ret == BAD_PADDING_E ) {
10353+ if (ret == BAD_PADDING_E || ret == PSS_SALTLEN_E ) {
1035910354 ret = 0 ;
1036010355 * stat = 0 ;
1036110356 }
@@ -10716,7 +10711,7 @@ int WP11_EC_Derive(unsigned char* point, word32 pointLen, unsigned char* key,
1071610711 ecc_key pubKey ;
1071710712 unsigned char * x963Data = point ;
1071810713 word32 x963Len = pointLen ;
10719- int dataLen ;
10714+ word32 expectedPointLen ;
1072010715 int i = 0 ;
1072110716#if defined(ECC_TIMING_RESISTANT ) && (!defined(HAVE_FIPS ) || \
1072210717 (defined(HAVE_FIPS_VERSION ) && (HAVE_FIPS_VERSION > 2 )))
@@ -10738,13 +10733,13 @@ int WP11_EC_Derive(unsigned char* point, word32 pointLen, unsigned char* key,
1073810733 }
1073910734 }
1074010735 if (i < (int )pointLen ) {
10741- dataLen = point [i ++ ];
10742- if (dataLen == (int )(pointLen - i )) {
10736+ expectedPointLen = priv -> data .ecKey -> dp -> size * 2 + 1 ;
10737+ if (pointLen > expectedPointLen ) {
10738+ x963Len = point [i ++ ];
1074310739 x963Data = point + i ;
10744- x963Len = dataLen ;
1074510740 }
1074610741 else {
10747- /* Length mismatch, treat as raw X9.63 data */
10742+ /* Treat as raw X9.63 data */
1074810743 x963Data = point ;
1074910744 x963Len = pointLen ;
1075010745 }
0 commit comments