From 298a47064cef8e99b2d1654a4073a5db566a69d0 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Fri, 16 Aug 2019 10:21:32 +0100 Subject: [PATCH] Force inlining of ssl_populate_transform() if used only once Somehow, at least ARMC5 isn't able to recognize this automatically. Since some of the arguments to ssl_populate_transform() are compile- time constants in reduced configurations, inlining leads to slightly shorter code. --- library/ssl_tls.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index a5bd45819..e94bc6482 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -1200,7 +1200,15 @@ static inline int ssl_calc_finished( int minor_ver, * - MBEDTLS_SSL_EXPORT_KEYS: ssl->conf->{f,p}_export_keys * - MBEDTLS_DEBUG_C: ssl->conf->{f,p}_dbg */ -static int ssl_populate_transform( mbedtls_ssl_transform *transform, +/* Force compilers to inline this function if it's used only + * from one place, because at least ARMC5 doesn't do that + * automatically. */ +#if !defined(MBEDTLS_SSL_CONTEXT_SERIALIZATION) +MBEDTLS_ALWAYS_INLINE static inline +#else +static +#endif /* MBEDTLS_SSL_CONTEXT_SERIALIZATION */ +int ssl_populate_transform( mbedtls_ssl_transform *transform, int ciphersuite, const unsigned char master[48], #if defined(MBEDTLS_SSL_SOME_MODES_USE_MAC)