Fix warning with MD/SHA ALT implementation

backport of e217cee

see #239
This commit is contained in:
Manuel Pégourié-Gonnard 2015-08-31 11:22:01 +02:00
parent 121f7c9475
commit aa4e55bd23
7 changed files with 18 additions and 12 deletions

View file

@ -1,5 +1,11 @@
PolarSSL ChangeLog PolarSSL ChangeLog
= Version 1.2.16 released 2015-??-??
Bugfix
* Fix unused function warning when using MBEDTLS_MDx_ALT or
MBEDTLS_SHAxxx_ALT (found by Henrik) (#239)
= Version 1.2.15 released 2015-08-10 = Version 1.2.15 released 2015-08-10
Security Security

View file

@ -36,13 +36,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_MD2_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_MD2_ALT)
static const unsigned char PI_SUBST[256] = static const unsigned char PI_SUBST[256] =
{ {
0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36,

View file

@ -36,13 +36,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_MD4_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_MD4_ALT)
/* /*
* 32-bit integer manipulation macros (little endian) * 32-bit integer manipulation macros (little endian)
*/ */

View file

@ -35,13 +35,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_MD5_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_MD5_ALT)
/* /*
* 32-bit integer manipulation macros (little endian) * 32-bit integer manipulation macros (little endian)
*/ */

View file

@ -35,13 +35,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_SHA1_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_SHA1_ALT)
/* /*
* 32-bit integer manipulation macros (big endian) * 32-bit integer manipulation macros (big endian)
*/ */

View file

@ -35,13 +35,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_SHA2_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_SHA2_ALT)
/* /*
* 32-bit integer manipulation macros (big endian) * 32-bit integer manipulation macros (big endian)
*/ */

View file

@ -35,13 +35,13 @@
#include <stdio.h> #include <stdio.h>
#endif #endif
#if !defined(POLARSSL_SHA4_ALT)
/* Implementation that should never be optimized out by the compiler */ /* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) { static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0; volatile unsigned char *p = v; while( n-- ) *p++ = 0;
} }
#if !defined(POLARSSL_SHA4_ALT)
/* /*
* 64-bit integer manipulation macros (big endian) * 64-bit integer manipulation macros (big endian)
*/ */