Simplify Input usage macros
Also ensure they are used in test data rather than values Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
parent
df00695bfc
commit
4768a30d9b
2 changed files with 12 additions and 23 deletions
|
@ -1,33 +1,33 @@
|
|||
PKCS#12 derive key : Zero length password and hash
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":1:"":1:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_GIVEN_INPUT:"":USE_GIVEN_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: NULL password and hash
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":0:"":0:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_NULL_INPUT:"":USE_NULL_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: Zero length password
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":1:"0123456789abcdef":1:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_GIVEN_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: NULL password
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":0:"0123456789abcdef":1:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"":USE_NULL_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: Invalid length NULL password
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":2:"0123456789abcdef":1:3:MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_NULL_INPUT:"0123456789abcdef":USE_GIVEN_INPUT:3:MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
|
||||
|
||||
PKCS#12 derive key: Zero length hash
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":1:"":1:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"":USE_GIVEN_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: NULL hash
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":1:"":0:3:0
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"":USE_NULL_INPUT:3:0
|
||||
|
||||
PKCS#12 derive key: Invalid length NULL hash
|
||||
depends_on:MBEDTLS_MD5_C
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":1:"0123456789abcdef":2:3:MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
|
||||
pkcs12_derive_key:MBEDTLS_MD_MD5:48:"0123456789abcdef":USE_GIVEN_INPUT:"0123456789abcdef":USE_NULL_INPUT:3:MBEDTLS_ERR_PKCS12_BAD_INPUT_DATA
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ typedef enum
|
|||
{
|
||||
USE_NULL_INPUT = 0,
|
||||
USE_GIVEN_INPUT = 1,
|
||||
USE_NULL_INPUT_WITH_SIZE = 2,
|
||||
} input_usage_method_t;
|
||||
|
||||
/* END_HEADER */
|
||||
|
@ -32,24 +31,14 @@ void pkcs12_derive_key( int md_type, int key_size_arg,
|
|||
size_t key_size = key_size_arg;
|
||||
|
||||
if( password_usage == USE_GIVEN_INPUT )
|
||||
{
|
||||
password = password_arg->x;
|
||||
password_len = password_arg->len;
|
||||
}
|
||||
else if( password_usage == USE_NULL_INPUT_WITH_SIZE )
|
||||
{
|
||||
password_len = password_arg->len;
|
||||
}
|
||||
|
||||
password_len = password_arg->len;
|
||||
|
||||
if( salt_usage == USE_GIVEN_INPUT )
|
||||
{
|
||||
salt = salt_arg->x;
|
||||
salt_len = salt_arg->len;
|
||||
}
|
||||
else if( salt_usage == USE_NULL_INPUT_WITH_SIZE )
|
||||
{
|
||||
salt_len = salt_arg->len;
|
||||
}
|
||||
|
||||
salt_len = salt_arg->len;
|
||||
|
||||
ASSERT_ALLOC( output_data, key_size );
|
||||
|
||||
|
|
Loading…
Reference in a new issue