Skip to content

Commit 7824c79

Browse files
Netanel GonenCruz Monrreal II
authored andcommitted
support in more types then just RSA_KEYPAIR
if the type is not supported the psa_crypto will return the error code for unsupported
1 parent fb4441f commit 7824c79

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

components/TARGET_PSA/services/crypto/COMPONENT_PSA_SRV_IPC/psa_crypto_spm.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,18 +1003,13 @@ psa_status_t psa_generate_key(psa_key_slot_t key,
10031003
in_vec[1].base = &bits;
10041004
in_vec[1].len = sizeof(size_t);
10051005

1006-
/* currently the parameter argument is used only for RSA keypair
1007-
and ignored in other cases. support for other algorithms
1008-
may be added later*/
1009-
if (PSA_KEY_TYPE_RSA_KEYPAIR == type) {
1010-
in_vec[2].base = parameters;
1011-
/* size of parameter is unsigned integer as defined in header */
1012-
in_vec[2].len = parameters_size;
1013-
} else { // currenty ignored for non RSA case
1014-
in_vec[2].base = NULL;
1015-
in_vec[2].len = 0;
1006+
if (((parameters == NULL) && (parameters_size != 0)) || ((parameters != NULL) && (parameters_size == 0))) {
1007+
return (PSA_ERROR_INVALID_ARGUMENT);
10161008
}
10171009

1010+
in_vec[2].base = parameters;
1011+
in_vec[2].len = parameters_size;
1012+
10181013
handle = psa_connect(PSA_KEY_MNG_ID, MINOR_VER);
10191014
if (handle <= 0) {
10201015
return (PSA_ERROR_COMMUNICATION_FAILURE);

0 commit comments

Comments
 (0)