mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 09:14:14 +01:00
Fix unused function warning under certain configurations.
I refactored some code into the function mbedtls_constant_time_memcmp in commit 7aad291 but this function is only used by GCM and AEAD_ChaCha20_Poly1305 to check the tags. So this function is now only enabled if either of these two ciphers is enabled.
This commit is contained in:
parent
dca6abb24b
commit
16b04ce641
@ -69,9 +69,13 @@
|
|||||||
#define MBEDTLS_CIPHER_MODE_STREAM
|
#define MBEDTLS_CIPHER_MODE_STREAM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_GCM_C) || defined(MBEDTLS_AEAD_CHACHA20_POLY1305_C)
|
||||||
/* Compare the contents of two buffers in constant time.
|
/* Compare the contents of two buffers in constant time.
|
||||||
* Returns 0 if the contents are bitwise identical, otherwise returns
|
* 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 )
|
static int mbedtls_constant_time_memcmp( const void *v1, const void *v2, size_t len )
|
||||||
{
|
{
|
||||||
const unsigned char *p1 = (const unsigned char*) v1;
|
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;
|
return (int)diff;
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_GCM_C || MBEDTLS_AEAD_CHACHA20_POLY1305_C */
|
||||||
|
|
||||||
static int supported_init = 0;
|
static int supported_init = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user