From ab8d58cb2d0653c84ca44a8d9e3486ed8b9de930 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Sun, 17 Jun 2018 14:39:30 +0300 Subject: [PATCH 1/3] Move definition of MBEDTLS_CIPHER_MODE_STREAM Move definition of `MBEDTLS_CIPHER_MODE_STREAM` to header file (`mbedtls_cipher_internal.h`), because it is used by more than one file. Raised by TrinityTonic in #1719 --- include/mbedtls/cipher_internal.h | 4 ++++ library/cipher.c | 5 ----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/mbedtls/cipher_internal.h b/include/mbedtls/cipher_internal.h index c6def0bef..56107cfff 100644 --- a/include/mbedtls/cipher_internal.h +++ b/include/mbedtls/cipher_internal.h @@ -34,6 +34,10 @@ #include "cipher.h" +#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) +#define MBEDTLS_CIPHER_MODE_STREAM +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/library/cipher.c b/library/cipher.c index a913913f0..7ae6c4ac5 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -65,11 +65,6 @@ #define mbedtls_free free #endif -#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) -#define MBEDTLS_CIPHER_MODE_STREAM -#endif - - #if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_CHACHAPOLY_C) /* Compare the contents of two buffers in constant time. * Returns 0 if the contents are bitwise identical, otherwise returns From da2a31237e341cb1b996d024a480e0270e9ec77d Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Sun, 17 Jun 2018 14:51:59 +0300 Subject: [PATCH 2/3] Add entry in ChangeLog Add entry in ChangeLog for compilation error fix of #1719 --- ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog b/ChangeLog index 44533d2ae..4ed7490b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ Bugfix return value. Found by @davidwu2000. #839 * Fix a memory leak in mbedtls_x509_csr_parse(), found by catenacyber, Philippe Antoine. Fixes #1623. + * Fix compilation error when MBEDTLS_ARC4_C is disabled and + MBEDTLS_CIPHER_NULL_CIPHER is enabled. Found by TrinityTonic in #1719. Changes * Change the shebang line in Perl scripts to look up perl in the PATH. From 3fa6c2760e6546314b80057cbc712fbb1efe8af5 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Wed, 27 Jun 2018 18:33:13 +0300 Subject: [PATCH 3/3] Move definition to cipher.h Define `MBEDTLS_CIPHER_MODE_STREAM` for `MBEDTLS_CIPHER_NULL_CIPHER` as well, in cipher.h. Remove redundant definition in `cipher_internal.h` --- include/mbedtls/cipher.h | 2 +- include/mbedtls/cipher_internal.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/include/mbedtls/cipher.h b/include/mbedtls/cipher.h index a1f4738a9..ea0ce983f 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -45,7 +45,7 @@ #define MBEDTLS_CIPHER_MODE_WITH_PADDING #endif -#if defined(MBEDTLS_ARC4_C) +#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) #define MBEDTLS_CIPHER_MODE_STREAM #endif diff --git a/include/mbedtls/cipher_internal.h b/include/mbedtls/cipher_internal.h index 56107cfff..c6def0bef 100644 --- a/include/mbedtls/cipher_internal.h +++ b/include/mbedtls/cipher_internal.h @@ -34,10 +34,6 @@ #include "cipher.h" -#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) -#define MBEDTLS_CIPHER_MODE_STREAM -#endif - #ifdef __cplusplus extern "C" { #endif