Remove NULL pointer validation in sha512.c
Signed-off-by: Tuvshinzaya Erdenekhuu <tuvshinzaya.erdenekhuu@arm.com>
This commit is contained in:
parent
1db192bc5a
commit
3446c2603a
1 changed files with 0 additions and 17 deletions
|
@ -183,8 +183,6 @@ static void sha512_put_uint64_be( uint64_t n, unsigned char *b, uint8_t i )
|
||||||
|
|
||||||
void mbedtls_sha512_init( mbedtls_sha512_context *ctx )
|
void mbedtls_sha512_init( mbedtls_sha512_context *ctx )
|
||||||
{
|
{
|
||||||
SHA512_VALIDATE( ctx != NULL );
|
|
||||||
|
|
||||||
memset( ctx, 0, sizeof( mbedtls_sha512_context ) );
|
memset( ctx, 0, sizeof( mbedtls_sha512_context ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,9 +197,6 @@ void mbedtls_sha512_free( mbedtls_sha512_context *ctx )
|
||||||
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
||||||
const mbedtls_sha512_context *src )
|
const mbedtls_sha512_context *src )
|
||||||
{
|
{
|
||||||
SHA512_VALIDATE( dst != NULL );
|
|
||||||
SHA512_VALIDATE( src != NULL );
|
|
||||||
|
|
||||||
*dst = *src;
|
*dst = *src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +205,6 @@ void mbedtls_sha512_clone( mbedtls_sha512_context *dst,
|
||||||
*/
|
*/
|
||||||
int mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 )
|
int mbedtls_sha512_starts( mbedtls_sha512_context *ctx, int is384 )
|
||||||
{
|
{
|
||||||
SHA512_VALIDATE_RET( ctx != NULL );
|
|
||||||
#if defined(MBEDTLS_SHA384_C)
|
#if defined(MBEDTLS_SHA384_C)
|
||||||
SHA512_VALIDATE_RET( is384 == 0 || is384 == 1 );
|
SHA512_VALIDATE_RET( is384 == 0 || is384 == 1 );
|
||||||
#else
|
#else
|
||||||
|
@ -569,9 +563,6 @@ int mbedtls_internal_sha512_process_c( mbedtls_sha512_context *ctx,
|
||||||
uint64_t A[8];
|
uint64_t A[8];
|
||||||
} local;
|
} local;
|
||||||
|
|
||||||
SHA512_VALIDATE_RET( ctx != NULL );
|
|
||||||
SHA512_VALIDATE_RET( (const unsigned char *)data != NULL );
|
|
||||||
|
|
||||||
#define SHR(x,n) ((x) >> (n))
|
#define SHR(x,n) ((x) >> (n))
|
||||||
#define ROTR(x,n) (SHR((x),(n)) | ((x) << (64 - (n))))
|
#define ROTR(x,n) (SHR((x),(n)) | ((x) << (64 - (n))))
|
||||||
|
|
||||||
|
@ -735,9 +726,6 @@ int mbedtls_sha512_update( mbedtls_sha512_context *ctx,
|
||||||
size_t fill;
|
size_t fill;
|
||||||
unsigned int left;
|
unsigned int left;
|
||||||
|
|
||||||
SHA512_VALIDATE_RET( ctx != NULL );
|
|
||||||
SHA512_VALIDATE_RET( ilen == 0 || input != NULL );
|
|
||||||
|
|
||||||
if( ilen == 0 )
|
if( ilen == 0 )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
||||||
|
@ -788,9 +776,6 @@ int mbedtls_sha512_finish( mbedtls_sha512_context *ctx,
|
||||||
unsigned used;
|
unsigned used;
|
||||||
uint64_t high, low;
|
uint64_t high, low;
|
||||||
|
|
||||||
SHA512_VALIDATE_RET( ctx != NULL );
|
|
||||||
SHA512_VALIDATE_RET( (unsigned char *)output != NULL );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add padding: 0x80 then 0x00 until 16 bytes remain for the length
|
* Add padding: 0x80 then 0x00 until 16 bytes remain for the length
|
||||||
*/
|
*/
|
||||||
|
@ -866,8 +851,6 @@ int mbedtls_sha512( const unsigned char *input,
|
||||||
#else
|
#else
|
||||||
SHA512_VALIDATE_RET( is384 == 0 );
|
SHA512_VALIDATE_RET( is384 == 0 );
|
||||||
#endif
|
#endif
|
||||||
SHA512_VALIDATE_RET( ilen == 0 || input != NULL );
|
|
||||||
SHA512_VALIDATE_RET( (unsigned char *)output != NULL );
|
|
||||||
|
|
||||||
mbedtls_sha512_init( &ctx );
|
mbedtls_sha512_init( &ctx );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue