Merge pull request #5192 from daverodgman/development_2.x

Backport 2.x: PSA error code fix
This commit is contained in:
Manuel Pégourié-Gonnard 2021-11-17 13:09:43 +01:00 committed by GitHub
commit 1a3201a7b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View file

@ -4282,6 +4282,9 @@ psa_status_t psa_key_derivation_output_key( const psa_key_attributes_t *attribut
if( psa_get_key_bits( attributes ) == 0 ) if( psa_get_key_bits( attributes ) == 0 )
return( PSA_ERROR_INVALID_ARGUMENT ); return( PSA_ERROR_INVALID_ARGUMENT );
if( operation->alg == PSA_ALG_NONE )
return( PSA_ERROR_BAD_STATE );
if( ! operation->can_output_key ) if( ! operation->can_output_key )
return( PSA_ERROR_NOT_PERMITTED ); return( PSA_ERROR_NOT_PERMITTED );

View file

@ -3246,7 +3246,7 @@ PSA key derivation: HKDF-SHA-256, bad key type, key output
depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_256 depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_256
# Whether we get NOT_PERMITTED or BAD_STATE for the output is an implementation # Whether we get NOT_PERMITTED or BAD_STATE for the output is an implementation
# detail. # detail.
derive_input:PSA_ALG_HKDF(PSA_ALG_SHA_256):PSA_KEY_DERIVATION_INPUT_SALT:PSA_KEY_TYPE_NONE:"":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_SECRET:PSA_KEY_TYPE_RAW_DATA:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":PSA_ERROR_INVALID_ARGUMENT:PSA_KEY_DERIVATION_INPUT_INFO:PSA_KEY_TYPE_NONE:"":PSA_ERROR_BAD_STATE:PSA_KEY_TYPE_RAW_DATA:PSA_ERROR_NOT_PERMITTED derive_input:PSA_ALG_HKDF(PSA_ALG_SHA_256):PSA_KEY_DERIVATION_INPUT_SALT:PSA_KEY_TYPE_NONE:"":PSA_SUCCESS:PSA_KEY_DERIVATION_INPUT_SECRET:PSA_KEY_TYPE_RAW_DATA:"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b":PSA_ERROR_INVALID_ARGUMENT:PSA_KEY_DERIVATION_INPUT_INFO:PSA_KEY_TYPE_NONE:"":PSA_ERROR_BAD_STATE:PSA_KEY_TYPE_RAW_DATA:PSA_ERROR_BAD_STATE
PSA key derivation: HKDF-SHA-256, direct secret, direct output PSA key derivation: HKDF-SHA-256, direct secret, direct output
depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_256 depends_on:PSA_WANT_ALG_HKDF:PSA_WANT_ALG_SHA_256

View file

@ -4464,7 +4464,7 @@ void derive_input( int alg_arg,
if( output_key_type != PSA_KEY_TYPE_NONE ) if( output_key_type != PSA_KEY_TYPE_NONE )
{ {
psa_reset_key_attributes( &attributes ); psa_reset_key_attributes( &attributes );
psa_set_key_type( &attributes, PSA_KEY_TYPE_RAW_DATA ); psa_set_key_type( &attributes, output_key_type );
psa_set_key_bits( &attributes, 8 ); psa_set_key_bits( &attributes, 8 );
actual_output_status = actual_output_status =
psa_key_derivation_output_key( &attributes, &operation, psa_key_derivation_output_key( &attributes, &operation,