From 62e1d6712b5fbf545cc94dbdc19eb5a7333d98ad Mon Sep 17 00:00:00 2001 From: Piyush Shah Date: Tue, 5 May 2020 21:52:56 +0530 Subject: [PATCH] mbedtls: Add config options for chacha20, poly1305 and chachapoly --- components/mbedtls/Kconfig | 19 +++++++++++++++++++ .../mbedtls/port/include/mbedtls/esp_config.h | 18 ++++++++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/components/mbedtls/Kconfig b/components/mbedtls/Kconfig index 5c055fc8e5..906ca66741 100644 --- a/components/mbedtls/Kconfig +++ b/components/mbedtls/Kconfig @@ -695,6 +695,25 @@ menu "mbedTLS" # end of Elliptic Curve options + config MBEDTLS_POLY1305_C + bool "Poly1305 MAC algorithm" + default n + help + Enable support for Poly1305 MAC algorithm. + + config MBEDTLS_CHACHA20_C + bool "Chacha20 stream cipher" + default n + help + Enable support for Chacha20 stream cipher. + + config MBEDTLS_CHACHAPOLY_C + bool "ChaCha20-Poly1305 AEAD algorithm" + default n + depends on MBEDTLS_CHACHA20_C && MBEDTLS_POLY1305_C + help + Enable support for ChaCha20-Poly1305 AEAD algorithm + menuconfig MBEDTLS_SECURITY_RISKS bool "Show configurations with potential security risks" default n diff --git a/components/mbedtls/port/include/mbedtls/esp_config.h b/components/mbedtls/port/include/mbedtls/esp_config.h index f89b8c9d89..d9893694da 100644 --- a/components/mbedtls/port/include/mbedtls/esp_config.h +++ b/components/mbedtls/port/include/mbedtls/esp_config.h @@ -1452,24 +1452,28 @@ /** * \def MBEDTLS_CHACHA20_C * - * Disable the ChaCha20 stream cipher. + * Enable the ChaCha20 stream cipher. * * Module: library/chacha20.c */ -#ifdef MBEDTLS_CHACHA20_C +#ifdef CONFIG_MBEDTLS_CHACHA20_C +#define MBEDTLS_CHACHA20_C +#else #undef MBEDTLS_CHACHA20_C #endif /** * \def MBEDTLS_CHACHAPOLY_C * - * Disable the ChaCha20-Poly1305 AEAD algorithm. + * Enable the ChaCha20-Poly1305 AEAD algorithm. * * Module: library/chachapoly.c * * This module requires: MBEDTLS_CHACHA20_C, MBEDTLS_POLY1305_C */ -#ifdef MBEDTLS_CHACHAPOLY_C +#ifdef CONFIG_MBEDTLS_CHACHAPOLY_C +#define MBEDTLS_CHACHAPOLY_C +#else #undef MBEDTLS_CHACHAPOLY_C #endif @@ -1932,12 +1936,14 @@ /** * \def MBEDTLS_POLY1305_C * - * Disable the Poly1305 MAC algorithm. + * Enable the Poly1305 MAC algorithm. * * Module: library/poly1305.c * Caller: library/chachapoly.c */ -#ifdef MBEDTLS_POLY1305_C +#ifdef CONFIG_MBEDTLS_POLY1305_C +#define MBEDTLS_POLY1305_C +#else #undef MBEDTLS_POLY1305_C #endif