Add psa_tls12_prf_set_other_key() function to store other secret input
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
c4b814a9c2
commit
23650286ac
@ -5219,6 +5219,28 @@ static psa_status_t psa_tls12_prf_set_key( psa_tls12_prf_key_derivation_t *prf,
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
static psa_status_t psa_tls12_prf_set_other_key( psa_tls12_prf_key_derivation_t *prf,
|
||||
const uint8_t *data,
|
||||
size_t data_length )
|
||||
{
|
||||
if( prf->state != PSA_TLS12_PRF_STATE_SEED_SET )
|
||||
return( PSA_ERROR_BAD_STATE );
|
||||
|
||||
if( data_length != 0 )
|
||||
{
|
||||
prf->other_secret = mbedtls_calloc( 1, data_length );
|
||||
if( prf->other_secret == NULL )
|
||||
return( PSA_ERROR_INSUFFICIENT_MEMORY );
|
||||
|
||||
memcpy( prf->other_secret, data, data_length );
|
||||
prf->other_secret_length = data_length;
|
||||
}
|
||||
|
||||
prf->state = PSA_TLS12_PRF_STATE_OTHER_KEY_SET;
|
||||
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
|
||||
static psa_status_t psa_tls12_prf_set_label( psa_tls12_prf_key_derivation_t *prf,
|
||||
const uint8_t *data,
|
||||
size_t data_length )
|
||||
@ -5252,6 +5274,8 @@ static psa_status_t psa_tls12_prf_input( psa_tls12_prf_key_derivation_t *prf,
|
||||
return( psa_tls12_prf_set_seed( prf, data, data_length ) );
|
||||
case PSA_KEY_DERIVATION_INPUT_SECRET:
|
||||
return( psa_tls12_prf_set_key( prf, data, data_length ) );
|
||||
case PSA_KEY_DERIVATION_INPUT_OTHER_SECRET:
|
||||
return( psa_tls12_prf_set_other_key( prf, data, data_length ) );
|
||||
case PSA_KEY_DERIVATION_INPUT_LABEL:
|
||||
return( psa_tls12_prf_set_label( prf, data, data_length ) );
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user