Skip to content

Commit dc491c4

Browse files
committed
Fall back to the exported EC point for PKCS11 verify when label or ID lookup finds none
1 parent e19a1a4 commit dc491c4

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

wolfcrypt/src/wc_pkcs11.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3949,14 +3949,22 @@ static int Pkcs11ECDSA_Verify(Pkcs11Session* session, wc_CryptoInfo* info)
39493949
ret = Pkcs11GetEccParams(session, publicKey, key);
39503950
}
39513951
}
3952-
else if (!mp_iszero(key->pubkey.x)) {
3952+
else if (!mp_iszero(key->pubkey.x) || !mp_iszero(key->pubkey.y)) {
39533953
ret = Pkcs11CreateEccPublicKey(&publicKey, session, key,
39543954
CKA_VERIFY);
39553955
sessionKey = 1;
39563956
}
39573957
else
39583958
ret = Pkcs11FindEccKey(&publicKey, CKO_PUBLIC_KEY, session,
39593959
info->pk.eccsign.key, CKA_VERIFY);
3960+
3961+
/* keygen destroys the token public key, so fall back to the point. */
3962+
if (ret != 0 && (key->labelLen > 0 || key->idLen > 0) &&
3963+
(!mp_iszero(key->pubkey.x) || !mp_iszero(key->pubkey.y))) {
3964+
ret = Pkcs11CreateEccPublicKey(&publicKey, session, key,
3965+
CKA_VERIFY);
3966+
sessionKey = 1;
3967+
}
39603968
}
39613969

39623970
if (ret == 0) {

0 commit comments

Comments
 (0)