From 43f958b24df487a836ae53ab83c890a1982cb004 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Sun, 13 Dec 2020 14:55:14 +0100 Subject: [PATCH] Rename unnamespaced identifiers Rename the enum constants TLS12_PRF_xxx, which are declared in a public header but not intended for use in application code, to start with MBEDTLS_PSA_. Signed-off-by: Gilles Peskine --- include/psa/crypto_struct.h | 10 +++++----- library/psa_crypto.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/psa/crypto_struct.h b/include/psa/crypto_struct.h index 6a018e1f9..04ece6daa 100644 --- a/include/psa/crypto_struct.h +++ b/include/psa/crypto_struct.h @@ -228,11 +228,11 @@ typedef struct #if defined(MBEDTLS_MD_C) typedef enum { - TLS12_PRF_STATE_INIT, /* no input provided */ - TLS12_PRF_STATE_SEED_SET, /* seed has been set */ - TLS12_PRF_STATE_KEY_SET, /* key has been set */ - TLS12_PRF_STATE_LABEL_SET, /* label has been set */ - TLS12_PRF_STATE_OUTPUT /* output has been started */ + PSA_TLS12_PRF_STATE_INIT, /* no input provided */ + PSA_TLS12_PRF_STATE_SEED_SET, /* seed has been set */ + PSA_TLS12_PRF_STATE_KEY_SET, /* key has been set */ + PSA_TLS12_PRF_STATE_LABEL_SET, /* label has been set */ + PSA_TLS12_PRF_STATE_OUTPUT /* output has been started */ } psa_tls12_prf_key_derivation_state_t; typedef struct psa_tls12_prf_key_derivation_s diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 82b95dc6d..46fbf1f42 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -5839,7 +5839,7 @@ static psa_status_t psa_tls12_prf_set_seed( psa_tls12_prf_key_derivation_t *prf, const uint8_t *data, size_t data_length ) { - if( prf->state != TLS12_PRF_STATE_INIT ) + if( prf->state != PSA_TLS12_PRF_STATE_INIT ) return( PSA_ERROR_BAD_STATE ); if( data_length != 0 ) @@ -5852,7 +5852,7 @@ static psa_status_t psa_tls12_prf_set_seed( psa_tls12_prf_key_derivation_t *prf, prf->seed_length = data_length; } - prf->state = TLS12_PRF_STATE_SEED_SET; + prf->state = PSA_TLS12_PRF_STATE_SEED_SET; return( PSA_SUCCESS ); } @@ -5863,14 +5863,14 @@ static psa_status_t psa_tls12_prf_set_key( psa_tls12_prf_key_derivation_t *prf, size_t data_length ) { psa_status_t status; - if( prf->state != TLS12_PRF_STATE_SEED_SET ) + if( prf->state != PSA_TLS12_PRF_STATE_SEED_SET ) return( PSA_ERROR_BAD_STATE ); status = psa_hmac_setup_internal( &prf->hmac, data, data_length, hash_alg ); if( status != PSA_SUCCESS ) return( status ); - prf->state = TLS12_PRF_STATE_KEY_SET; + prf->state = PSA_TLS12_PRF_STATE_KEY_SET; return( PSA_SUCCESS ); } @@ -5879,7 +5879,7 @@ static psa_status_t psa_tls12_prf_set_label( psa_tls12_prf_key_derivation_t *prf const uint8_t *data, size_t data_length ) { - if( prf->state != TLS12_PRF_STATE_KEY_SET ) + if( prf->state != PSA_TLS12_PRF_STATE_KEY_SET ) return( PSA_ERROR_BAD_STATE ); if( data_length != 0 ) @@ -5892,7 +5892,7 @@ static psa_status_t psa_tls12_prf_set_label( psa_tls12_prf_key_derivation_t *prf prf->label_length = data_length; } - prf->state = TLS12_PRF_STATE_LABEL_SET; + prf->state = PSA_TLS12_PRF_STATE_LABEL_SET; return( PSA_SUCCESS ); }