From df2f560316d60795ab7a477c02b121a31fe585f8 Mon Sep 17 00:00:00 2001 From: Tuvshinzaya Erdenekhuu Date: Fri, 5 Aug 2022 15:59:19 +0100 Subject: [PATCH] Remove NULL pointer validation in sha256.c Signed-off-by: Tuvshinzaya Erdenekhuu --- library/sha256.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/library/sha256.c b/library/sha256.c index ac15ef8d1d..24be8eac2b 100644 --- a/library/sha256.c +++ b/library/sha256.c @@ -159,8 +159,6 @@ static int mbedtls_a64_crypto_sha256_determine_support( void ) void mbedtls_sha256_init( mbedtls_sha256_context *ctx ) { - SHA256_VALIDATE( ctx != NULL ); - memset( ctx, 0, sizeof( mbedtls_sha256_context ) ); } @@ -175,9 +173,6 @@ void mbedtls_sha256_free( mbedtls_sha256_context *ctx ) void mbedtls_sha256_clone( mbedtls_sha256_context *dst, const mbedtls_sha256_context *src ) { - SHA256_VALIDATE( dst != NULL ); - SHA256_VALIDATE( src != NULL ); - *dst = *src; } @@ -186,8 +181,6 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst, */ int mbedtls_sha256_starts( mbedtls_sha256_context *ctx, int is224 ) { - SHA256_VALIDATE_RET( ctx != NULL ); - #if defined(MBEDTLS_SHA224_C) SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 ); #else @@ -427,9 +420,6 @@ int mbedtls_internal_sha256_process_c( mbedtls_sha256_context *ctx, unsigned int i; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( (const unsigned char *)data != NULL ); - for( i = 0; i < 8; i++ ) local.A[i] = ctx->state[i]; @@ -579,9 +569,6 @@ int mbedtls_sha256_update( mbedtls_sha256_context *ctx, size_t fill; uint32_t left; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( ilen == 0 || input != NULL ); - if( ilen == 0 ) return( 0 ); @@ -633,9 +620,6 @@ int mbedtls_sha256_finish( mbedtls_sha256_context *ctx, uint32_t used; uint32_t high, low; - SHA256_VALIDATE_RET( ctx != NULL ); - SHA256_VALIDATE_RET( (unsigned char *)output != NULL ); - /* * Add padding: 0x80 then 0x00 until 8 bytes remain for the length */ @@ -710,9 +694,6 @@ int mbedtls_sha256( const unsigned char *input, SHA256_VALIDATE_RET( is224 == 0 ); #endif - SHA256_VALIDATE_RET( ilen == 0 || input != NULL ); - SHA256_VALIDATE_RET( (unsigned char *)output != NULL ); - mbedtls_sha256_init( &ctx ); if( ( ret = mbedtls_sha256_starts( &ctx, is224 ) ) != 0 )