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.
diff --git a/library/poly1305.c b/library/poly1305.c
index 542a850..0aa4533 100644
--- a/library/poly1305.c
+++ b/library/poly1305.c
@@ -259,7 +259,7 @@
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 @@
cleanup:
mbedtls_poly1305_free( &ctx );
- return( 0 );
+ return( result );
}
#endif /* MBEDTLS_POLY1305_ALT */