From e217ceea38725a861870ed67a1ddf6aefd4eb813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 31 Aug 2015 11:22:01 +0200 Subject: [PATCH] Fix warning with MD/SHA ALT implementation backport of 8b2641d see #239 --- ChangeLog | 2 ++ library/md2.c | 4 ++-- library/md4.c | 4 ++-- library/md5.c | 4 ++-- library/sha1.c | 4 ++-- library/sha256.c | 4 ++-- library/sha512.c | 4 ++-- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c369ce55..b22fdde8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,8 @@ Bugfix result trying to unlock an unlocked mutex on invalid input (found by Fredrik Axelsson) (#257) * Fix -Wshadow warnings (found by hnrkp) (#240) + * Fix unused function warning when using MBEDTLS_MDx_ALT or + MBEDTLS_SHAxxx_ALT (found by Henrik) (#239) = mbed TLS 1.3.12 released 2015-08-11 diff --git a/library/md2.c b/library/md2.c index 17569c0a8..110cd95bc 100644 --- a/library/md2.c +++ b/library/md2.c @@ -51,13 +51,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_MD2_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_MD2_ALT) - static const unsigned char PI_SUBST[256] = { 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, diff --git a/library/md4.c b/library/md4.c index d33cc520a..8754d2f52 100644 --- a/library/md4.c +++ b/library/md4.c @@ -51,13 +51,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_MD4_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_MD4_ALT) - /* * 32-bit integer manipulation macros (little endian) */ diff --git a/library/md5.c b/library/md5.c index 49f0674fb..8c7ed1fc3 100644 --- a/library/md5.c +++ b/library/md5.c @@ -50,13 +50,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_MD5_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_MD5_ALT) - /* * 32-bit integer manipulation macros (little endian) */ diff --git a/library/sha1.c b/library/sha1.c index fca6109bb..44de8727e 100644 --- a/library/sha1.c +++ b/library/sha1.c @@ -50,13 +50,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_SHA1_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_SHA1_ALT) - /* * 32-bit integer manipulation macros (big endian) */ diff --git a/library/sha256.c b/library/sha256.c index 2b4b7e132..674fdf25e 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -50,13 +50,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_SHA256_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_SHA256_ALT) - /* * 32-bit integer manipulation macros (big endian) */ diff --git a/library/sha512.c b/library/sha512.c index 4074d33d9..bd607e0ca 100644 --- a/library/sha512.c +++ b/library/sha512.c @@ -56,13 +56,13 @@ #endif /* POLARSSL_PLATFORM_C */ #endif /* POLARSSL_SELF_TEST */ +#if !defined(POLARSSL_SHA512_ALT) + /* Implementation that should never be optimized out by the compiler */ static void polarssl_zeroize( void *v, size_t n ) { volatile unsigned char *p = v; while( n-- ) *p++ = 0; } -#if !defined(POLARSSL_SHA512_ALT) - /* * 64-bit integer manipulation macros (big endian) */