1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

poly1305: add test for parameter validation

Also fix two validation bugs found while adding the tests.

Also handle test dependencies the right way while at it.
This commit is contained in:
Manuel Pégourié-Gonnard
2018-05-10 10:12:36 +02:00
parent 2aca236881
commit a8fa8b8f96
3 changed files with 58 additions and 18 deletions

View File

@@ -259,7 +259,7 @@ void mbedtls_poly1305_free( mbedtls_poly1305_context *ctx )
int mbedtls_poly1305_starts( mbedtls_poly1305_context *ctx,
const unsigned char key[32] )
{
if ( ctx == NULL )
if ( ctx == NULL || key == NULL )
{
return( MBEDTLS_ERR_POLY1305_BAD_INPUT_DATA );
}
@@ -417,7 +417,7 @@ int mbedtls_poly1305_mac( const unsigned char key[32],
cleanup:
mbedtls_poly1305_free( &ctx );
return( 0 );
return( result );
}
#endif /* MBEDTLS_POLY1305_ALT */