From fd320e9a6e521650aab86126da9627aec55e4db0 Mon Sep 17 00:00:00 2001 From: Jerry Yu Date: Fri, 8 Oct 2021 21:52:41 +0800 Subject: [PATCH] Replace zeroize with memset Signed-off-by: Jerry Yu --- library/ssl_msg.c | 6 +++--- library/ssl_tls.c | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/library/ssl_msg.c b/library/ssl_msg.c index 7fa0a5617..fdb647a50 100644 --- a/library/ssl_msg.c +++ b/library/ssl_msg.c @@ -4796,7 +4796,7 @@ int mbedtls_ssl_parse_change_cipher_spec( mbedtls_ssl_context *ssl ) } else #endif /* MBEDTLS_SSL_PROTO_DTLS */ - mbedtls_platform_zeroize( ssl->in_ctr, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN ); + memset( ssl->in_ctr, 0, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN ); mbedtls_ssl_update_in_pointers( ssl ); @@ -5562,14 +5562,14 @@ void mbedtls_ssl_set_inbound_transform( mbedtls_ssl_context *ssl, mbedtls_ssl_transform *transform ) { ssl->transform_in = transform; - mbedtls_platform_zeroize( ssl->in_ctr, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN ); + memset( ssl->in_ctr, 0, MBEDTLS_SSL_SEQUENCE_NUMBER_LEN ); } void mbedtls_ssl_set_outbound_transform( mbedtls_ssl_context *ssl, mbedtls_ssl_transform *transform ) { ssl->transform_out = transform; - mbedtls_platform_zeroize( ssl->cur_out_ctr, sizeof( ssl->cur_out_ctr ) ); + memset( ssl->cur_out_ctr, 0, sizeof( ssl->cur_out_ctr ) ); } #if defined(MBEDTLS_SSL_PROTO_DTLS) diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 8c1fdd816..bf3ab0939 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -2824,8 +2824,7 @@ int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl ) sizeof( ssl->handshake->alt_out_ctr ) ); /* Set sequence_number to zero */ - mbedtls_platform_zeroize( &ssl->cur_out_ctr[2], - sizeof( ssl->cur_out_ctr ) - 2 ); + memset( &ssl->cur_out_ctr[2], 0, sizeof( ssl->cur_out_ctr ) - 2 ); /* Increment epoch */ @@ -2842,7 +2841,7 @@ int mbedtls_ssl_write_finished( mbedtls_ssl_context *ssl ) } else #endif /* MBEDTLS_SSL_PROTO_DTLS */ - mbedtls_platform_zeroize( ssl->cur_out_ctr, sizeof( ssl->cur_out_ctr ) ); + memset( ssl->cur_out_ctr, 0, sizeof( ssl->cur_out_ctr ) ); ssl->transform_out = ssl->transform_negotiate; ssl->session_out = ssl->session_negotiate; @@ -3327,7 +3326,7 @@ static void ssl_session_reset_msg_layer( mbedtls_ssl_context *ssl, ssl->out_msglen = 0; ssl->out_left = 0; memset( ssl->out_buf, 0, out_buf_len ); - mbedtls_platform_zeroize( ssl->cur_out_ctr, sizeof( ssl->cur_out_ctr ) ); + memset( ssl->cur_out_ctr, 0, sizeof( ssl->cur_out_ctr ) ); ssl->transform_out = NULL; #if defined(MBEDTLS_SSL_DTLS_ANTI_REPLAY)