chachapoly: force correct mode for integrated API
Allowing DECRYPT with crypt_and_tag is a risk as people might fail to check
the tag correctly (or at all). So force them to use auth_decrypt() instead.
See also https://github.com/ARMmbed/mbedtls/pull/1668
diff --git a/library/cipher.c b/library/cipher.c
index cf10094..5a96e2b 100644
--- a/library/cipher.c
+++ b/library/cipher.c
@@ -992,8 +992,7 @@
}
*olen = ilen;
- return( mbedtls_chachapoly_crypt_and_tag( ctx->cipher_ctx,
- MBEDTLS_CHACHAPOLY_ENCRYPT,
+ return( mbedtls_chachapoly_encrypt_and_tag( ctx->cipher_ctx,
ilen, iv, ad, ad_len, input, output, tag ) );
}
#endif /* MBEDTLS_CHACHAPOLY_C */