Skip to content

Commit

Permalink
Fix memory leak in SoftHSM::UnwrapKeySym.
Browse files Browse the repository at this point in the history
When using C_UnwrapKey with CKM_xxx_CBC_PAD, the unwrapping key and
cipher objects were not being recycled on success.
  • Loading branch information
dcoombs committed May 30, 2022
1 parent ac70dc3 commit fbca80b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/SoftHSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6812,9 +6812,10 @@ CK_RV SoftHSM::UnwrapKeySym
CK_RV rv = CKR_OK;
if (!cipher->unwrapKey(unwrappingkey, mode, wrapped, keydata))
rv = CKR_GENERAL_ERROR;
cipher->recycleKey(unwrappingkey);
CryptoFactory::i()->recycleSymmetricAlgorithm(cipher);
}

cipher->recycleKey(unwrappingkey);
CryptoFactory::i()->recycleSymmetricAlgorithm(cipher);
return rv;
}

Expand Down

0 comments on commit fbca80b

Please sign in to comment.