Skip to content

Commit

Permalink
Fix for RSA failure with SVM enabled in openssl-3.2
Browse files Browse the repository at this point in the history
  - Description:
     - SVM case pointer directly copying to inputData.pData and doing padding
     - Decrypting data is not equal to plain text zero
  - Fix:
     - Before padding creating memory using qat_mem_alloc(),
     - And passing this address to padding API
     - Due to this we are verifying successfully in zero plain text case

Signed-off-by: Tirupatigopi Ravulapalli <[email protected]>
  • Loading branch information
ravulapx authored and Yogaraj-Alamenda committed Nov 5, 2024
1 parent 42c317a commit 78a41ef
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions qat_hw_rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ rsa_decrypt_op_buf_free(CpaCyRsaDecryptOpData * dec_op_data,
DEBUG("- Started\n");

if (dec_op_data) {
if (dec_op_data->inputData.pData && !qat_svm)
qaeCryptoMemFreeNonZero(dec_op_data->inputData.pData);
QAT_CLEANSE_MEMFREE_NONZERO_FLATBUFF(dec_op_data->inputData, qat_svm);

if (dec_op_data->pRecipientPrivateKey) {
key = &dec_op_data->pRecipientPrivateKey->privateKeyRep2;
Expand Down Expand Up @@ -510,12 +509,9 @@ build_decrypt_op_buf(int flen, const unsigned char *from, unsigned char *to,
return 0;
}

if (qat_svm)
(*dec_op_data)->inputData.pData = (Cpa8U *) from;
else
(*dec_op_data)->inputData.pData = (Cpa8U *) qaeCryptoMemAlloc(
((padding != RSA_NO_PADDING) && alloc_pad) ? rsa_len : flen,
__FILE__,__LINE__);
(*dec_op_data)->inputData.pData = (Cpa8U *) qat_mem_alloc(
((padding != RSA_NO_PADDING) && alloc_pad) ? rsa_len : flen, qat_svm,
__FILE__,__LINE__);

if (NULL == (*dec_op_data)->inputData.pData) {
WARN("Failed to allocate (*dec_op_data)->inputData.pData\n");
Expand Down

0 comments on commit 78a41ef

Please sign in to comment.