diff --git a/src/objects.c b/src/objects.c index 8b523a43..671fa5a0 100644 --- a/src/objects.c +++ b/src/objects.c @@ -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;