Skip to content

Commit 510e0ec

Browse files
raghuncstateWilliam Roberts
authored andcommitted
rsa: fix OAEP padding decryption
With OpenSSL 1.1.1, using RSA OAEP as rsa_padding_mode failed with error that the padding mode was unknown. This is because the OpenSSL EVP_PKEY_METH for decryption, pkey_rsa_decrypt(), calls the RSA decrypt method with RSA_NO_PADDING as padding, and then checks the OAEP padding after raw decryption. This patch fixes the use of OAEP decryption by allow RSA_NO_PADDING as an accepted padding value and uses inScheme to the TPM as TPM_ALG_NULL, allowing RSA OAEP decryption to work correctly. Signed-off-by: Raghu Krishnamurthy <raghupathyk@nvidia.com>
1 parent 9b64650 commit 510e0ec

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tpm2-tss-engine-rsa.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ rsa_priv_dec(int flen, const unsigned char *from, unsigned char *to, RSA * rsa,
251251
inScheme.scheme = TPM2_ALG_OAEP;
252252
inScheme.details.oaep.hashAlg = TPM2_ALG_SHA1;
253253
break;
254+
case RSA_NO_PADDING:
255+
inScheme.scheme = TPM2_ALG_NULL;
256+
break;
254257
default:
255258
ERR(rsa_priv_dec, TPM2TSS_R_PADDING_UNKNOWN);
256259
goto error;

0 commit comments

Comments
 (0)