chachapoly: add test for parameter validation
Also fix two bugs found by the new tests.
Also remove redundant test case dependency declarations while at it.
diff --git a/library/chachapoly.c b/library/chachapoly.c
index 9ca21b3..fd05886 100644
--- a/library/chachapoly.c
+++ b/library/chachapoly.c
@@ -202,7 +202,7 @@
const unsigned char *input,
unsigned char *output )
{
- if ( ( ctx == NULL ) || ( input == NULL ) || ( output == NULL ) )
+ if ( ctx == NULL )
{
return( MBEDTLS_ERR_CHACHAPOLY_BAD_INPUT_DATA );
}
@@ -339,6 +339,9 @@
size_t i;
int diff;
+ if( tag == NULL )
+ return( MBEDTLS_ERR_CHACHAPOLY_BAD_INPUT_DATA );
+
if( ( ret = mbedtls_chachapoly_crypt_and_tag( ctx,
MBEDTLS_CHACHAPOLY_DECRYPT, length, nonce,
aad, aad_len, input, output, check_tag ) ) != 0 )