Properly translate a TPM ECC signature verify error for compatibility.

pull/311/head
David Garske 2023-11-27 16:16:40 -08:00
parent ef59d06bc5
commit b2457e45e7
1 changed files with 9 additions and 3 deletions

View File

@ -240,9 +240,15 @@ int wolfTPM2_CryptoDevCb(int devId, wc_CryptoInfo* info, void* ctx)
rc = wolfTPM2_VerifyHash(tlsCtx->dev, &eccPub,
sigRS, rLen + sLen,
info->pk.eccverify.hash, info->pk.eccverify.hashlen);
if (rc == 0 && info->pk.eccverify.res) {
*info->pk.eccverify.res = 1;
if (info->pk.eccverify.res) {
if ((rc & TPM_RC_SIGNATURE) == TPM_RC_SIGNATURE) {
/* mark invalid signature */
*info->pk.eccverify.res = 0;
rc = 0;
}
else if (rc == 0) {
*info->pk.eccverify.res = 1;
}
}
wolfTPM2_UnloadHandle(tlsCtx->dev, &eccPub.handle);