mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-27 06:35:22 +00:00
Reduce indentation need by checking negative case first
Signed-off-by: Steven Cooreman <steven.cooreman@silabs.com>
This commit is contained in:
parent
43e4a406d9
commit
054bf7f2a0
@ -173,8 +173,12 @@ psa_status_t test_opaque_export_key(
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
{
|
||||
if( key_length == sizeof( psa_drv_slot_number_t ) )
|
||||
if( key_length != sizeof( psa_drv_slot_number_t ) )
|
||||
{
|
||||
/* Test driver does not support generic opaque key handling yet. */
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
/* Assume this is a builtin key based on the key material length. */
|
||||
psa_drv_slot_number_t slot_number = *( ( psa_drv_slot_number_t* ) key );
|
||||
|
||||
@ -227,12 +231,6 @@ psa_status_t test_opaque_export_key(
|
||||
default:
|
||||
return( PSA_ERROR_DOES_NOT_EXIST );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Test driver does not support generic opaque key handling yet. */
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
}
|
||||
|
||||
psa_status_t test_transparent_export_public_key(
|
||||
@ -295,8 +293,12 @@ psa_status_t test_opaque_export_public_key(
|
||||
const uint8_t *key, size_t key_length,
|
||||
uint8_t *data, size_t data_size, size_t *data_length )
|
||||
{
|
||||
if( key_length == sizeof( psa_drv_slot_number_t ) )
|
||||
if( key_length != sizeof( psa_drv_slot_number_t ) )
|
||||
{
|
||||
/* Test driver does not support generic opaque key handling yet. */
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
|
||||
/* Assume this is a builtin key based on the key material length. */
|
||||
psa_drv_slot_number_t slot_number = *( ( psa_drv_slot_number_t* ) key );
|
||||
switch( slot_number )
|
||||
@ -324,12 +326,6 @@ psa_status_t test_opaque_export_public_key(
|
||||
default:
|
||||
return( PSA_ERROR_DOES_NOT_EXIST );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Test driver does not support generic opaque key handling yet. */
|
||||
return( PSA_ERROR_NOT_SUPPORTED );
|
||||
}
|
||||
}
|
||||
|
||||
/* The opaque test driver exposes two built-in keys when builtin key support is
|
||||
|
Loading…
x
Reference in New Issue
Block a user