Skip to content

Commit cefdd99

Browse files
Vge0rgembolivar-nordic
authored andcommitted
[nrf noup] Add driver_wrapper call for derivation
-This adds a psa_driver_wrapper call for the PSA psa_key_derivation_key_agreement API. Without this patch the psa_key_derivation APIs will never reach the PSA drivers (Oberon, CC3XX) and they will only support the software implementation. This patch is a noupp because we expect the Mbed TLS project to add this change in a later release. Ref: NCSDK-13564 Signed-off-by: Georgios Vasilakis <georgios.vasilakis@nordicsemi.no>
1 parent 68dfba6 commit cefdd99

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

library/psa_crypto.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5321,12 +5321,30 @@ static psa_status_t psa_key_agreement_internal( psa_key_derivation_operation_t *
53215321

53225322
/* Step 1: run the secret agreement algorithm to generate the shared
53235323
* secret. */
5324-
status = psa_key_agreement_raw_internal( ka_alg,
5325-
private_key,
5326-
peer_key, peer_key_length,
5327-
shared_secret,
5328-
sizeof( shared_secret ),
5329-
&shared_secret_length );
5324+
psa_key_attributes_t attributes = {
5325+
.core = private_key->attr
5326+
};
5327+
5328+
status = psa_driver_wrapper_key_agreement( &attributes,
5329+
private_key->key.data,
5330+
private_key->key.bytes,
5331+
peer_key,
5332+
peer_key_length,
5333+
shared_secret,
5334+
sizeof( shared_secret ),
5335+
&shared_secret_length,
5336+
ka_alg );
5337+
5338+
if( status == PSA_ERROR_NOT_SUPPORTED )
5339+
{
5340+
status = psa_key_agreement_raw_internal( ka_alg,
5341+
private_key,
5342+
peer_key, peer_key_length,
5343+
shared_secret,
5344+
sizeof( shared_secret ),
5345+
&shared_secret_length );
5346+
}
5347+
53305348
if( status != PSA_SUCCESS )
53315349
goto exit;
53325350

0 commit comments

Comments
 (0)