Add PSA PAKE wrappers

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2022-06-01 18:17:22 +02:00 committed by Przemek Stekiel
parent 56b8d23ca1
commit 7da8c56b84
2 changed files with 118 additions and 0 deletions

View file

@ -412,6 +412,51 @@ psa_status_t psa_driver_wrapper_key_agreement(
size_t shared_secret_size,
size_t *shared_secret_length);
/*
* PAKE functions.
*/
psa_status_t psa_driver_wrapper_pake_setup(
psa_pake_operation_t *operation,
const psa_pake_cipher_suite_t *cipher_suite);
psa_status_t psa_driver_wrapper_pake_set_password_key(
psa_pake_operation_t *operation,
mbedtls_svc_key_id_t password);
psa_status_t psa_driver_wrapper_pake_set_user(
psa_pake_operation_t *operation,
const uint8_t *user_id,
size_t user_id_len);
psa_status_t psa_driver_wrapper_pake_set_peer(
psa_pake_operation_t *operation,
const uint8_t *peer_id,
size_t peer_id_len);
psa_status_t psa_driver_wrapper_pake_set_role(
psa_pake_operation_t *operation,
psa_pake_role_t role);
psa_status_t psa_driver_wrapper_pake_output(
psa_pake_operation_t *operation,
psa_pake_step_t step,
uint8_t *output,
size_t output_size,
size_t *output_length);
psa_status_t psa_driver_wrapper_pake_input(
psa_pake_operation_t *operation,
psa_pake_step_t step,
const uint8_t *input,
size_t input_length);
psa_status_t psa_driver_wrapper_pake_get_implicit_key(
psa_pake_operation_t *operation,
psa_key_derivation_operation_t *output);
psa_status_t psa_driver_wrapper_pake_abort(
psa_pake_operation_t *operation);
#endif /* PSA_CRYPTO_DRIVER_WRAPPERS_H */
/* End of automatically generated file. */

View file

@ -28,6 +28,7 @@
#include "psa_crypto_driver_wrappers.h"
#include "psa_crypto_hash.h"
#include "psa_crypto_mac.h"
#include "psa_crypto_pake.h"
#include "psa_crypto_rsa.h"
#include "mbedtls/platform.h"
@ -2808,4 +2809,76 @@ psa_status_t psa_driver_wrapper_key_agreement(
}
}
#if defined(MBEDTLS_PSA_BUILTIN_PAKE)
psa_status_t psa_driver_wrapper_pake_setup(
psa_pake_operation_t *operation,
const psa_pake_cipher_suite_t *cipher_suite )
{
return( mbedtls_psa_pake_setup( operation, cipher_suite ) );
}
psa_status_t psa_driver_wrapper_pake_set_password_key(
psa_pake_operation_t *operation,
mbedtls_svc_key_id_t password )
{
return( mbedtls_psa_pake_set_password_key( operation, password ) );
}
psa_status_t psa_driver_wrapper_pake_set_user(
psa_pake_operation_t *operation,
const uint8_t *user_id,
size_t user_id_len )
{
return( mbedtls_psa_pake_set_user( operation, user_id, user_id_len ) );
}
psa_status_t psa_driver_wrapper_pake_set_peer(
psa_pake_operation_t *operation,
const uint8_t *peer_id,
size_t peer_id_len )
{
return( mbedtls_psa_pake_set_peer( operation, peer_id, peer_id_len ) );
}
psa_status_t psa_driver_wrapper_pake_set_role(
psa_pake_operation_t *operation,
psa_pake_role_t role )
{
return( mbedtls_psa_pake_set_role( operation, role ) );
}
psa_status_t psa_driver_wrapper_pake_output(
psa_pake_operation_t *operation,
psa_pake_step_t step,
uint8_t *output,
size_t output_size,
size_t *output_length )
{
return( mbedtls_psa_pake_output( operation, step, output,
output_size, output_length ) );
}
psa_status_t psa_driver_wrapper_pake_input(
psa_pake_operation_t *operation,
psa_pake_step_t step,
const uint8_t *input,
size_t input_length )
{
return( mbedtls_psa_pake_input( operation, step, input, input_length ) );
}
psa_status_t psa_driver_wrapper_pake_get_implicit_key(
psa_pake_operation_t *operation,
psa_key_derivation_operation_t *output )
{
return( mbedtls_psa_pake_get_implicit_key( operation, output ) );
}
psa_status_t psa_driver_wrapper_pake_abort(
psa_pake_operation_t * operation )
{
return( mbedtls_psa_pake_abort( operation ) );
}
#endif /* MBEDTLS_PSA_BUILTIN_PAKE */
#endif /* MBEDTLS_PSA_CRYPTO_C */