From 29b43737ba22ce86934cc5f63107b14cd0eb8f79 Mon Sep 17 00:00:00 2001 From: Andres AG Date: Wed, 7 Dec 2016 16:08:04 +0000 Subject: [PATCH] Fix unused variable/function compilation warnings This PR fixes a number of unused variable/function compilation warnings that arise when using a config.h that does not define the macro POLARSSL_PEM_PARSE_C. --- ChangeLog | 3 +++ library/pem.c | 2 +- library/x509_csr.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4cfcfeb43..2e25e1ca9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ Bugfix * Fixed multiple buffer overreads in mbedtls_pem_read_buffer() when parsing the input string in PEM format to extract the different components. Found by Eyal Itkin. + * Fix unused variable/function compilation warnings in pem.c and x509_csr.c + that are reported when building mbed TLS with a config.h that does not + define POLARSSL_PEM_PARSE_C. #562 = mbed TLS 1.3.18 branch 2016-10-17 diff --git a/library/pem.c b/library/pem.c index 1fe238726..b2c16c292 100644 --- a/library/pem.c +++ b/library/pem.c @@ -45,12 +45,12 @@ #define polarssl_free free #endif +#if defined(POLARSSL_PEM_PARSE_C) /* 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_PEM_PARSE_C) void pem_init( pem_context *ctx ) { memset( ctx, 0, sizeof( pem_context ) ); diff --git a/library/x509_csr.c b/library/x509_csr.c index 558b078b7..9bdfe884f 100644 --- a/library/x509_csr.c +++ b/library/x509_csr.c @@ -260,8 +260,8 @@ int x509_csr_parse_der( x509_csr *csr, */ int x509_csr_parse( x509_csr *csr, const unsigned char *buf, size_t buflen ) { - int ret; #if defined(POLARSSL_PEM_PARSE_C) + int ret; size_t use_len; pem_context pem; #endif