From 3dfbf406e5be03743618910a0a4fa13cc429ba1c 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 | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/mbedtls/cipher_internal.h b/include/mbedtls/cipher_internal.h index 6c58bcc52..88baa82b4 100644 --- a/include/mbedtls/cipher_internal.h +++ b/include/mbedtls/cipher_internal.h @@ -33,6 +33,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 cf82a8258..fe34929c2 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -45,10 +45,6 @@ #include "mbedtls/ccm.h" #endif -#if defined(MBEDTLS_ARC4_C) || defined(MBEDTLS_CIPHER_NULL_CIPHER) -#define MBEDTLS_CIPHER_MODE_STREAM -#endif - /* Implementation that should never be optimized out by the compiler */ static void mbedtls_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; From d7593a5b730aec02de5e0948ae48504c44bd8810 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 588b833e8..46379b2cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ mbed TLS ChangeLog (Sorted per branch, date) += mbed TLS x.x.xx branch released xxxx-xx-xx + +Bugfix + * Fix compilation error when MBEDTLS_ARC4_C is disabled and + MBEDTLS_CIPHER_NULL_CIPHER is enabled. Found by TrinityTonic in #1719. + = mbed TLS 2.1.13 branch released 2018-06-18 Bugfix From 112e32230e92ea5204ee24457549a0ecc3ac3ff6 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 464c4adae..e4ed36a83 100644 --- a/include/mbedtls/cipher.h +++ b/include/mbedtls/cipher.h @@ -42,7 +42,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 88baa82b4..6c58bcc52 100644 --- a/include/mbedtls/cipher_internal.h +++ b/include/mbedtls/cipher_internal.h @@ -33,10 +33,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