mirror of
https://github.com/cuberite/polarssl.git
synced 2025-10-03 18:43:38 -04:00
derive_output() test: fix code style
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
2503f7e4cb
commit
38647defa8
@ -6956,7 +6956,7 @@ void derive_output( int alg_arg,
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case PSA_KEY_DERIVATION_INPUT_SECRET:
|
case PSA_KEY_DERIVATION_INPUT_SECRET:
|
||||||
switch ( key_input_type )
|
switch( key_input_type )
|
||||||
{
|
{
|
||||||
case 0: // input bytes
|
case 0: // input bytes
|
||||||
PSA_ASSERT( psa_key_derivation_input_bytes(
|
PSA_ASSERT( psa_key_derivation_input_bytes(
|
||||||
@ -6972,15 +6972,16 @@ void derive_output( int alg_arg,
|
|||||||
inputs[i]->x, inputs[i]->len,
|
inputs[i]->x, inputs[i]->len,
|
||||||
&keys[i] ) );
|
&keys[i] ) );
|
||||||
|
|
||||||
if ( PSA_ALG_IS_TLS12_PSK_TO_MS( alg ) )
|
if( PSA_ALG_IS_TLS12_PSK_TO_MS( alg ) )
|
||||||
{
|
{
|
||||||
PSA_ASSERT( psa_get_key_attributes( keys[i], &attributes1 ) );
|
PSA_ASSERT( psa_get_key_attributes( keys[i], &attributes1 ) );
|
||||||
TEST_ASSERT( PSA_BITS_TO_BYTES( psa_get_key_bits( &attributes1 ) ) <=
|
TEST_ASSERT( PSA_BITS_TO_BYTES( psa_get_key_bits( &attributes1 ) ) <=
|
||||||
PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE );
|
PSA_TLS12_PSK_TO_MS_PSK_MAX_SIZE );
|
||||||
}
|
}
|
||||||
|
|
||||||
PSA_ASSERT( psa_key_derivation_input_key(
|
PSA_ASSERT( psa_key_derivation_input_key( &operation,
|
||||||
&operation, steps[i], keys[i] ) );
|
steps[i],
|
||||||
|
keys[i] ) );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TEST_ASSERT( ! "default case not supported" );
|
TEST_ASSERT( ! "default case not supported" );
|
||||||
@ -6988,12 +6989,14 @@ void derive_output( int alg_arg,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PSA_KEY_DERIVATION_INPUT_OTHER_SECRET:
|
case PSA_KEY_DERIVATION_INPUT_OTHER_SECRET:
|
||||||
switch ( other_key_input_type )
|
switch( other_key_input_type )
|
||||||
{
|
{
|
||||||
case 0: // input bytes
|
case 0: // input bytes
|
||||||
TEST_EQUAL( psa_key_derivation_input_bytes(
|
TEST_EQUAL( psa_key_derivation_input_bytes( &operation,
|
||||||
&operation, steps[i],
|
steps[i],
|
||||||
inputs[i]->x, inputs[i]->len ), statuses[i] );
|
inputs[i]->x,
|
||||||
|
inputs[i]->len ),
|
||||||
|
statuses[i] );
|
||||||
break;
|
break;
|
||||||
case 1: // input key
|
case 1: // input key
|
||||||
psa_set_key_usage_flags( &attributes2, PSA_KEY_USAGE_DERIVE );
|
psa_set_key_usage_flags( &attributes2, PSA_KEY_USAGE_DERIVE );
|
||||||
@ -7001,15 +7004,17 @@ void derive_output( int alg_arg,
|
|||||||
psa_set_key_type( &attributes2, PSA_KEY_TYPE_DERIVE );
|
psa_set_key_type( &attributes2, PSA_KEY_TYPE_DERIVE );
|
||||||
|
|
||||||
// other secret of type RAW_DATA passed with input_key
|
// other secret of type RAW_DATA passed with input_key
|
||||||
if ( statuses[i] == PSA_ERROR_INVALID_ARGUMENT )
|
if( statuses[i] == PSA_ERROR_INVALID_ARGUMENT )
|
||||||
psa_set_key_type( &attributes2, PSA_KEY_TYPE_RAW_DATA );
|
psa_set_key_type( &attributes2, PSA_KEY_TYPE_RAW_DATA );
|
||||||
|
|
||||||
PSA_ASSERT( psa_import_key( &attributes2,
|
PSA_ASSERT( psa_import_key( &attributes2,
|
||||||
inputs[i]->x, inputs[i]->len,
|
inputs[i]->x, inputs[i]->len,
|
||||||
&keys[i] ) );
|
&keys[i] ) );
|
||||||
|
|
||||||
TEST_EQUAL( psa_key_derivation_input_key(
|
TEST_EQUAL( psa_key_derivation_input_key( &operation,
|
||||||
&operation, steps[i], keys[i] ), statuses[i] );
|
steps[i],
|
||||||
|
keys[i] ),
|
||||||
|
statuses[i] );
|
||||||
break;
|
break;
|
||||||
case 2: // key agreement
|
case 2: // key agreement
|
||||||
psa_set_key_usage_flags( &attributes3, PSA_KEY_USAGE_DERIVE );
|
psa_set_key_usage_flags( &attributes3, PSA_KEY_USAGE_DERIVE );
|
||||||
@ -7017,8 +7022,8 @@ void derive_output( int alg_arg,
|
|||||||
psa_set_key_type( &attributes3, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1) );
|
psa_set_key_type( &attributes3, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1) );
|
||||||
|
|
||||||
PSA_ASSERT( psa_import_key( &attributes3,
|
PSA_ASSERT( psa_import_key( &attributes3,
|
||||||
inputs[i]->x, inputs[i]->len,
|
inputs[i]->x, inputs[i]->len,
|
||||||
&keys[i] ) );
|
&keys[i] ) );
|
||||||
|
|
||||||
TEST_EQUAL( psa_key_derivation_key_agreement(
|
TEST_EQUAL( psa_key_derivation_key_agreement(
|
||||||
&operation,
|
&operation,
|
||||||
@ -7035,8 +7040,8 @@ void derive_output( int alg_arg,
|
|||||||
size_t key_agreement_output_length;
|
size_t key_agreement_output_length;
|
||||||
|
|
||||||
PSA_ASSERT( psa_import_key( &attributes3,
|
PSA_ASSERT( psa_import_key( &attributes3,
|
||||||
inputs[i]->x, inputs[i]->len,
|
inputs[i]->x, inputs[i]->len,
|
||||||
&keys[i] ) );
|
&keys[i] ) );
|
||||||
|
|
||||||
PSA_ASSERT( psa_raw_key_agreement(
|
PSA_ASSERT( psa_raw_key_agreement(
|
||||||
PSA_ALG_ECDH,
|
PSA_ALG_ECDH,
|
||||||
@ -7055,7 +7060,7 @@ void derive_output( int alg_arg,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( statuses[i] != PSA_SUCCESS )
|
if( statuses[i] != PSA_SUCCESS )
|
||||||
goto exit;
|
goto exit;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user