1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-31 00:03:07 +03:00

libmbedcrypto: Fix chacha20-poly1305

Previously, the mbed TLS implementation wouldn't be use at all when
available, being the internal implementation always used instead.

This corrects few bugs and makes the mbed TLS implementation to be used
when ChaCha20 and Poly1305 are available.

This also makes the constant time comparison to be used when checking
the authentication tag.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Anderson Toshiyuki Sasaki
2020-12-11 19:33:14 +01:00
parent c50cfe7fc7
commit d4258d1461
3 changed files with 20 additions and 8 deletions

View File

@ -272,6 +272,12 @@ endif (GCRYPT_FOUND)
if (MBEDTLS_FOUND)
set(HAVE_LIBMBEDCRYPTO 1)
set(HAVE_ECC 1)
set(CMAKE_REQUIRED_INCLUDES "${MBEDTLS_INCLUDE_DIR}/mbedtls")
check_include_file(chacha20.h HAVE_MBEDTLS_CHACHA20_H)
check_include_file(poly1305.h HAVE_MBEDTLS_POLY1305_H)
unset(CMAKE_REQUIRED_INCLUDES)
endif (MBEDTLS_FOUND)
if (CMAKE_USE_PTHREADS_INIT)