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

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
This commit is contained in:
Manuel Pégourié-Gonnard
2018-06-04 12:18:19 +02:00
parent 26c3b0a4b1
commit 3dc62a0a9b
5 changed files with 53 additions and 54 deletions

View File

@@ -491,9 +491,8 @@ int main( int argc, char *argv[] )
mbedtls_chachapoly_setkey( &chachapoly, tmp );
TIME_AND_TSC( title,
mbedtls_chachapoly_crypt_and_tag( &chachapoly,
MBEDTLS_CHACHAPOLY_ENCRYPT, BUFSIZE, tmp,
NULL, 0, buf, buf, tmp ) );
mbedtls_chachapoly_encrypt_and_tag( &chachapoly,
BUFSIZE, tmp, NULL, 0, buf, buf, tmp ) );
mbedtls_chachapoly_free( &chachapoly );
}