fix: free EVP_MD and EVP_PKEY_CTX before switch in verify()#97
fix: free EVP_MD and EVP_PKEY_CTX before switch in verify()#97toddr-bot wants to merge 0 commit into
Conversation
|
@toddr-bot rebase |
|
@Koan-Bot review |
PR Review — fix: free EVP_MD and EVP_PKEY_CTX before switch in verify()The fix is correct: 🟡 Important1. Mid-block Move the declaration into the 🟢 Suggestions1. Pre-existing error-path leaks from CHECK_OPEN_SSL not addressed ( Checklist
SummaryThe fix is correct: Automated review by Kōan |
Rebase: fix: free EVP_MD and EVP_PKEY_CTX before switch in verify()Branch Review feedback was analyzed and applied. Actions
Automated by Kōan |
fbdacdf to
a2db97c
Compare
What
Free
EVP_MDandEVP_PKEY_CTXobjects before the switch statement inverify()so they are actually reached.Why
On OpenSSL 3.x,
EVP_MD_free(md)andEVP_PKEY_CTX_free(ctx)were placed after the switch, but every branch exits the function:XSRETURN_YES,XSRETURN_NO, orcroakviaCHECK_OPEN_SSL(0). The cleanup was dead code — everyverify()call leaked both objects.How
Capture the
EVP_PKEY_verify()return value intoverify_result, callEVP_MD_free(md)andEVP_PKEY_CTX_free(ctx), then switch on the stored result. The legacy (pre-3.x)RSA_verifypath is unaffected — it doesn't allocate these objects.Testing
Full test suite passes (318 tests, 10 test files).
🤖 Generated with Claude Code
Quality Report
Changes: 1 file changed, 4 insertions(+), 5 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline