Skip to content

Commit

Permalink
CKK_EC_EDWARDS: EC_PARAMS containing oID
Browse files Browse the repository at this point in the history
Support for tokens that specify Edwards curves using the oID
selection.

Signed-off-by: Florian Wernli <[email protected]>
  • Loading branch information
Florian Wernli authored and simo5 committed Dec 5, 2023
1 parent 891c5ae commit 412fe7c
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,26 @@ static CK_RV pre_process_ec_key_data(P11PROV_OBJ *key)
key->data.key.bit_size = ED448_BIT_SIZE;
key->data.key.size = ED448_BYTE_SIZE;
} else {
return CKR_KEY_INDIGESTIBLE;
const unsigned char *p = attr->pValue;
ASN1_OBJECT *asn1_obj = d2i_ASN1_OBJECT(NULL, &p, attr->ulValueLen);
if (asn1_obj == NULL) {
return CKR_KEY_INDIGESTIBLE;
}
int nid = OBJ_obj2nid(asn1_obj);
ASN1_OBJECT_free(asn1_obj);
if (nid == NID_ED25519) {
curve_name = ED25519;
curve_nid = NID_ED25519;
key->data.key.bit_size = ED25519_BIT_SIZE;
key->data.key.size = ED25519_BYTE_SIZE;
} else if (nid == NID_ED448) {
curve_name = ED448;
curve_nid = NID_ED448;
key->data.key.bit_size = ED448_BIT_SIZE;
key->data.key.size = ED448_BYTE_SIZE;
} else {
return CKR_KEY_INDIGESTIBLE;
}
}
} else {
return CKR_KEY_INDIGESTIBLE;
Expand Down

0 comments on commit 412fe7c

Please sign in to comment.