Skip to content

Commit

Permalink
EC keys: unconditionally fetch EC_POINT
Browse files Browse the repository at this point in the history
- vendor optimization (e.g. Thales Luna) to have CKA_EC_POINT in
  CKO_PRIVATE_KEY
- avoids having to store the public key
- for future optimization: skip find_associated_obj if EC key
  already has EC_POINT
- libp11 equivalent: OpenSC/libp11@281ccb3

Signed-off-by: S-P Chan <[email protected]>
  • Loading branch information
space88man committed Feb 22, 2024
1 parent 8055658 commit 41a049e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,12 @@ static CK_RV fetch_ec_key(P11PROV_CTX *ctx, P11PROV_SESSION *session,
FA_SET_BUF_ALLOC(attrs, num, CKA_EC_PARAMS, true);
if (key->class == CKO_PUBLIC_KEY) {
FA_SET_BUF_ALLOC(attrs, num, CKA_EC_POINT, true);
} else {
/* known vendor optimization to avoid storing
* EC public key on HSM; can avoid
* find_associated_obj later
*/
FA_SET_BUF_ALLOC(attrs, num, CKA_EC_POINT, false);
}
FA_SET_BUF_ALLOC(attrs, num, CKA_ID, false);
FA_SET_BUF_ALLOC(attrs, num, CKA_LABEL, false);
Expand Down

0 comments on commit 41a049e

Please sign in to comment.