Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ta/pkcs11/src/processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,17 @@ size_t get_object_key_bit_size(struct pkcs11_object *obj)

return a_size * 8;
case PKCS11_CKK_EC:
case PKCS11_CKK_EC_EDWARDS:
if (get_attribute_ptr(attrs, PKCS11_CKA_EC_PARAMS,
&a_ptr, &a_size) || !a_ptr)
return 0;

return ec_params2tee_keysize(a_ptr, a_size);
case PKCS11_CKK_EC_EDWARDS:
if (get_attribute_ptr(attrs, PKCS11_CKA_EC_POINT, NULL,
&a_size))
return 0;

return a_size * 8;
default:
TEE_Panic(0);
return 0;
Expand Down
9 changes: 2 additions & 7 deletions ta/pkcs11/src/processing_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,16 +713,15 @@ enum pkcs11_rc generate_eddsa_keys(struct pkcs11_attribute_head *proc_params,
void *a_ptr = NULL;
uint32_t a_size = 0;
uint32_t tee_size = 0;
uint32_t tee_curve = 0;
TEE_ObjectHandle tee_obj = TEE_HANDLE_NULL;
TEE_Attribute tee_key_attr[1] = { };
TEE_Result res = TEE_ERROR_GENERIC;

if (!proc_params || !*pub_head || !*priv_head)
return PKCS11_CKR_TEMPLATE_INCONSISTENT;

if (remove_empty_attribute(pub_head, PKCS11_CKA_EC_POINT) ||
remove_empty_attribute(priv_head, PKCS11_CKA_VALUE) ||
remove_empty_attribute(priv_head, PKCS11_CKA_EC_POINT) ||
remove_empty_attribute(priv_head, PKCS11_CKA_EC_PARAMS)) {
EMSG("Unexpected attribute(s) found");
trace_attributes("public-key", *pub_head);
Expand All @@ -740,10 +739,6 @@ enum pkcs11_rc generate_eddsa_keys(struct pkcs11_attribute_head *proc_params,
if (!tee_size)
return PKCS11_CKR_ATTRIBUTE_TYPE_INVALID;

tee_curve = ec_params2tee_curve(a_ptr, a_size);

TEE_InitValueAttribute(tee_key_attr, TEE_ATTR_ECC_CURVE, tee_curve, 1);

res = TEE_AllocateTransientObject(TEE_TYPE_ED25519_KEYPAIR, tee_size,
&tee_obj);
if (res) {
Expand All @@ -757,7 +752,7 @@ enum pkcs11_rc generate_eddsa_keys(struct pkcs11_attribute_head *proc_params,
goto out;
}

res = TEE_GenerateKey(tee_obj, tee_size, tee_key_attr, 1);
res = TEE_GenerateKey(tee_obj, tee_size, NULL, 0);
if (res) {
rc = tee2pkcs_error(res);
goto out;
Expand Down