mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-21 21:36:21 +01: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:
parent
2aca236881
commit
a8fa8b8f96
3 changed files with 58 additions and 18 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue