Skip to content

Commit

Permalink
ec/rsa: fix key export logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gotthardp committed Jul 21, 2023
1 parent ff40b6f commit eaa01f1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/tpm2-provider-keymgmt-ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ tpm2_ec_keymgmt_export(void *keydata, int selection,
if (pkey == NULL)
return 0;

if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
return 0;

curve_nid = tpm2_ecc_curve_to_nid(TPM2_PKEY_EC_CURVE(pkey));

pubsize = tpm2_ecc_point_to_uncompressed(
Expand Down
3 changes: 3 additions & 0 deletions src/tpm2-provider-keymgmt-rsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,9 @@ tpm2_rsa_keymgmt_export(void *keydata, int selection,
if (pkey == NULL)
return 0;

if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0)
return 0;

OSSL_PARAM params[3], *p = params;
#if !defined(WORDS_BIGENDIAN)
unsigned char *n = NULL;
Expand Down

0 comments on commit eaa01f1

Please sign in to comment.