Skip to content

Commit

Permalink
Merge pull request #7870 from anhu/pkcs7_correct_issuer
Browse files Browse the repository at this point in the history
Ensure correct issuer is copied into PKCS7 struct during verification
  • Loading branch information
douzzer authored Aug 15, 2024
2 parents 8b57e3e + 498dada commit 39a4780
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions wolfcrypt/src/pkcs7.c
Original file line number Diff line number Diff line change
Expand Up @@ -4187,14 +4187,18 @@ static int wc_PKCS7_EcdsaVerify(PKCS7* pkcs7, byte* sig, int sigSz,
} while (ret == WC_NO_ERR_TRACE(WC_PENDING_E));
#endif

FreeDecodedCert(dCert);
wc_ecc_free(key);

if (ret == 0 && res == 1) {
/* found signer that successfully verified signature */
verified = 1;
XMEMCPY(pkcs7->issuerSubjKeyId, dCert->extSubjKeyId, KEYID_SIZE);
pkcs7->verifyCert = pkcs7->cert[i];
pkcs7->verifyCertSz = pkcs7->certSz[i];
}

wc_ecc_free(key);
FreeDecodedCert(dCert);

if (ret == 0 && res == 1) {
break;
}
}
Expand Down

0 comments on commit 39a4780

Please sign in to comment.