diff --git a/library/cipher.c b/library/cipher.c index b51a40bcc..71fa6f535 100644 --- a/library/cipher.c +++ b/library/cipher.c @@ -69,9 +69,13 @@ #define MBEDTLS_CIPHER_MODE_STREAM #endif + +#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_AEAD_CHACHA20_POLY1305_C) /* Compare the contents of two buffers in constant time. * Returns 0 if the contents are bitwise identical, otherwise returns - * a non-zero value. */ + * a non-zero value. + * This is currently only used by GCM and ChaCha20+Poly1305. + */ static int mbedtls_constant_time_memcmp( const void *v1, const void *v2, size_t len ) { const unsigned char *p1 = (const unsigned char*) v1; @@ -84,6 +88,7 @@ static int mbedtls_constant_time_memcmp( const void *v1, const void *v2, size_t return (int)diff; } +#endif /* MBEDTLS_GCM_C || MBEDTLS_AEAD_CHACHA20_POLY1305_C */ static int supported_init = 0;