mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 23:25:44 +01:00
Allow empty arguments in some CCM functions' parameter validation
This commit is contained in:
parent
fd42d531ba
commit
ff8a0989c8
@ -323,9 +323,9 @@ int mbedtls_ccm_star_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
|
|||||||
{
|
{
|
||||||
CCM_VALIDATE_RET( ctx != NULL );
|
CCM_VALIDATE_RET( ctx != NULL );
|
||||||
CCM_VALIDATE_RET( iv != NULL );
|
CCM_VALIDATE_RET( iv != NULL );
|
||||||
CCM_VALIDATE_RET( add != NULL );
|
CCM_VALIDATE_RET( add_len == 0 || add != NULL );
|
||||||
CCM_VALIDATE_RET( input != NULL );
|
CCM_VALIDATE_RET( length == 0 || input != NULL );
|
||||||
CCM_VALIDATE_RET( output != NULL );
|
CCM_VALIDATE_RET( length == 0 || output != NULL );
|
||||||
CCM_VALIDATE_RET( tag != NULL );
|
CCM_VALIDATE_RET( tag != NULL );
|
||||||
return( ccm_auth_crypt( ctx, CCM_ENCRYPT, length, iv, iv_len,
|
return( ccm_auth_crypt( ctx, CCM_ENCRYPT, length, iv, iv_len,
|
||||||
add, add_len, input, output, tag, tag_len ) );
|
add, add_len, input, output, tag, tag_len ) );
|
||||||
@ -339,9 +339,9 @@ int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length,
|
|||||||
{
|
{
|
||||||
CCM_VALIDATE_RET( ctx != NULL );
|
CCM_VALIDATE_RET( ctx != NULL );
|
||||||
CCM_VALIDATE_RET( iv != NULL );
|
CCM_VALIDATE_RET( iv != NULL );
|
||||||
CCM_VALIDATE_RET( add != NULL );
|
CCM_VALIDATE_RET( add_len == 0 || add != NULL );
|
||||||
CCM_VALIDATE_RET( input != NULL );
|
CCM_VALIDATE_RET( length == 0 || input != NULL );
|
||||||
CCM_VALIDATE_RET( output != NULL );
|
CCM_VALIDATE_RET( length == 0 || output != NULL );
|
||||||
CCM_VALIDATE_RET( tag != NULL );
|
CCM_VALIDATE_RET( tag != NULL );
|
||||||
if( tag_len == 0 )
|
if( tag_len == 0 )
|
||||||
return( MBEDTLS_ERR_CCM_BAD_INPUT );
|
return( MBEDTLS_ERR_CCM_BAD_INPUT );
|
||||||
@ -366,9 +366,9 @@ int mbedtls_ccm_star_auth_decrypt( mbedtls_ccm_context *ctx, size_t length,
|
|||||||
|
|
||||||
CCM_VALIDATE_RET( ctx != NULL );
|
CCM_VALIDATE_RET( ctx != NULL );
|
||||||
CCM_VALIDATE_RET( iv != NULL );
|
CCM_VALIDATE_RET( iv != NULL );
|
||||||
CCM_VALIDATE_RET( add != NULL );
|
CCM_VALIDATE_RET( add_len == 0 || add != NULL );
|
||||||
CCM_VALIDATE_RET( input != NULL );
|
CCM_VALIDATE_RET( length == 0 || input != NULL );
|
||||||
CCM_VALIDATE_RET( output != NULL );
|
CCM_VALIDATE_RET( length == 0 || output != NULL );
|
||||||
CCM_VALIDATE_RET( tag != NULL );
|
CCM_VALIDATE_RET( tag != NULL );
|
||||||
|
|
||||||
if( ( ret = ccm_auth_crypt( ctx, CCM_DECRYPT, length,
|
if( ( ret = ccm_auth_crypt( ctx, CCM_DECRYPT, length,
|
||||||
|
Loading…
Reference in New Issue
Block a user