Validate tag pointer in ccm function.
Signed-off-by: Mateusz Starzyk <mateusz.starzyk@mobica.com>
This commit is contained in:
parent
1bda9451ef
commit
c8bdf36a72
2 changed files with 3 additions and 5 deletions
|
@ -478,6 +478,7 @@ int mbedtls_ccm_finish( mbedtls_ccm_context *ctx,
|
|||
ret = mbedtls_ccm_crypt( ctx, 0, 16, ctx->y, ctx->y );
|
||||
if( ret != 0 )
|
||||
return ret;
|
||||
if( tag != NULL )
|
||||
memcpy( tag, ctx->y, tag_len );
|
||||
mbedtls_ccm_clear_state(ctx);
|
||||
|
||||
|
|
|
@ -48,9 +48,6 @@ static int check_multipart( mbedtls_ccm_context *ctx,
|
|||
mbedtls_free( output );
|
||||
output = NULL;
|
||||
|
||||
if( tag->len == 0 )
|
||||
ASSERT_ALLOC( output, 16 );
|
||||
else
|
||||
ASSERT_ALLOC( output, tag->len );
|
||||
TEST_EQUAL( 0, mbedtls_ccm_finish( ctx, output, tag->len ) );
|
||||
ASSERT_COMPARE( output, tag->len, tag->x, tag->len );
|
||||
|
|
Loading…
Reference in a new issue