From f6cc7423aa3a808e8cb4e6a15798e682f6140384 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Fri, 16 Aug 2019 14:34:52 +0100 Subject: [PATCH] Prescribe inlining of tls_prf_generic() The NO_INLINE annotation of tls_prf_sha256() and tls_prf_sha384() from the last commit surprisingly had an influence on ARMC5 compilation in that tls_prf_generic() was no longer automatically inlined into tls_prf_sha256() if only the latter was enabled (and is the point where tls_prf_generic() is called). This commit forces inlining of tls_prf_generic() in this case. --- library/ssl_tls.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 8d08ce120..200268d74 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -748,7 +748,12 @@ MBEDTLS_NO_INLINE static int tls1_prf( const unsigned char *secret, size_t slen, #endif /* MBEDTLS_SSL_PROTO_TLS1) || MBEDTLS_SSL_PROTO_TLS1_1 */ #if defined(MBEDTLS_SSL_PROTO_TLS1_2) -static int tls_prf_generic( mbedtls_md_type_t md_type, +#if !( defined(MBEDTLS_SHA256_C) && defined(MBEDTLS_SHA512_C) ) +MBEDTLS_ALWAYS_INLINE static inline +#else +static +#endif +int tls_prf_generic( mbedtls_md_type_t md_type, const unsigned char *secret, size_t slen, const char *label, const unsigned char *random, size_t rlen,