mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-02-02 12:11:11 +00:00
Make SSL checksum update function inline
This saves a few bytes in configurations where only one hash is enabled, and configurations allowing multiple hashes probably don't care about code-size anyway.
This commit is contained in:
parent
8a4b59049b
commit
8443491280
|
@ -1837,8 +1837,24 @@ static inline int mbedtls_ssl_session_get_compression(
|
|||
#endif
|
||||
}
|
||||
|
||||
void mbedtls_ssl_update_checksum( mbedtls_ssl_context *,
|
||||
const unsigned char *, size_t );
|
||||
MBEDTLS_ALWAYS_INLINE static inline void mbedtls_ssl_update_checksum(
|
||||
mbedtls_ssl_context *ssl,
|
||||
const unsigned char *buf, size_t len )
|
||||
{
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_1)
|
||||
mbedtls_md5_update_ret( &ssl->handshake->fin_md5 , buf, len );
|
||||
mbedtls_sha1_update_ret( &ssl->handshake->fin_sha1, buf, len );
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
mbedtls_sha256_update_ret( &ssl->handshake->fin_sha256, buf, len );
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
mbedtls_sha512_update_ret( &ssl->handshake->fin_sha512, buf, len );
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||
}
|
||||
|
||||
#define MBEDTLS_SSL_CHK(f) do { if( ( ret = f ) < 0 ) goto cleanup; } while( 0 )
|
||||
|
||||
|
|
|
@ -7384,24 +7384,6 @@ void mbedtls_ssl_reset_checksum( mbedtls_ssl_context *ssl )
|
|||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||
}
|
||||
|
||||
void mbedtls_ssl_update_checksum( mbedtls_ssl_context *ssl,
|
||||
const unsigned char *buf, size_t len )
|
||||
{
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3) || defined(MBEDTLS_SSL_PROTO_TLS1) || \
|
||||
defined(MBEDTLS_SSL_PROTO_TLS1_1)
|
||||
mbedtls_md5_update_ret( &ssl->handshake->fin_md5 , buf, len );
|
||||
mbedtls_sha1_update_ret( &ssl->handshake->fin_sha1, buf, len );
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
mbedtls_sha256_update_ret( &ssl->handshake->fin_sha256, buf, len );
|
||||
#endif
|
||||
#if defined(MBEDTLS_SHA512_C)
|
||||
mbedtls_sha512_update_ret( &ssl->handshake->fin_sha512, buf, len );
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_PROTO_TLS1_2 */
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_SSL3)
|
||||
static void ssl_calc_finished_ssl(
|
||||
mbedtls_ssl_context *ssl, unsigned char *buf, int from )
|
||||
|
|
Loading…
Reference in a new issue