File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -189,9 +189,12 @@ static LTC_INLINE int s_rsa_key_valid_crypt(ltc_rsa_op_checked *check)
189189 return s_rsa_key_valid_rsa_params (check );
190190}
191191
192- static LTC_INLINE int s_rsa_check_prng (ltc_rsa_op_parameters * params )
192+ static LTC_INLINE int s_rsa_check_prng (ltc_rsa_op op , ltc_rsa_op_parameters * params )
193193{
194- if (params -> padding != LTC_PKCS_1_PSS )
194+ /* Only PSS signing needs a PRNG, v1.5 signing is deterministic.
195+ * All encryption needs a PRNG (OAEP seed, v1.5 EME random padding). */
196+ if ((op & LTC_RSA_OP_SIGN ) == LTC_RSA_OP_SIGN
197+ && params -> padding != LTC_PKCS_1_PSS )
195198 return CRYPT_OK ;
196199 if (params -> prng == NULL )
197200 return CRYPT_INVALID_PRNG ;
@@ -211,7 +214,7 @@ int rsa_key_valid_op(ltc_rsa_op op, ltc_rsa_op_checked *check)
211214 check -> params -> params .pss_oaep = check -> params -> padding == LTC_PKCS_1_OAEP
212215 || check -> params -> padding == LTC_PKCS_1_PSS ;
213216 if ((op & LTC_RSA_OP_SEND ) == LTC_RSA_OP_SEND ) {
214- if ((err = s_rsa_check_prng (check -> params )) != CRYPT_OK ) {
217+ if ((err = s_rsa_check_prng (op , check -> params )) != CRYPT_OK ) {
215218 return err ;
216219 }
217220 }
You can’t perform that action at this time.
0 commit comments