Skip to content

Commit db35c62

Browse files
committed
psa: Add get/set domain parameters
DSA and static DH need extra domain parameters. Instead of passing these in with the keys themselves, add get and set functions to set and retrieve this information about keys.
1 parent 12f67ad commit db35c62

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

include/psa/crypto.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,26 @@ psa_status_t psa_get_key_information(psa_key_handle_t handle,
369369
psa_key_type_t *type,
370370
size_t *bits);
371371

372+
/**
373+
*
374+
* Format for the domain parameters varies by the key type.
375+
* Must call before import key. If you want, you can call before generate key
376+
* or use extra to pass the domain parameters.
377+
*
378+
* Bad state error if called after imported or generated key already.
379+
*/
380+
psa_status_t psa_set_key_domain_parameters(uint8_t *data,
381+
size_t data_size,
382+
size_t data_length);
383+
384+
/**
385+
*
386+
* It gets the domain parameters. 8-)
387+
*/
388+
psa_status_t psa_get_key_domain_parameters(uint8_t *data,
389+
size_t data_size,
390+
size_t *data_length);
391+
372392
/**
373393
* \brief Export a key in binary format.
374394
*

library/psa_crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ psa_status_t psa_import_key_into_slot( psa_key_slot_t *slot,
722722
}
723723

724724
/* Retrieve an empty key slot (slot with no key data, but possibly
725-
* with some metadata such as a policy). */
725+
* with some metadata such as a policy or domain parameters). */
726726
static psa_status_t psa_get_empty_key_slot( psa_key_handle_t handle,
727727
psa_key_slot_t **p_slot )
728728
{

0 commit comments

Comments
 (0)