mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 19:38:21 +00:00
Don't define MBEDTLS-namespace macros in sha256.c
This commit is contained in:
parent
fc2a0b2e67
commit
8d215e7130
1 changed files with 16 additions and 16 deletions
|
@ -74,13 +74,13 @@ do { \
|
|||
} while( 0 )
|
||||
#endif
|
||||
|
||||
#define MBEDTLS_SHA256_VALIDATE_RET(cond) \
|
||||
#define SHA256_VALIDATE_RET(cond) \
|
||||
MBEDTLS_INTERNAL_VALIDATE_RET( cond, MBEDTLS_ERR_SHA256_BAD_INPUT_DATA )
|
||||
#define MBEDTLS_SHA256_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond )
|
||||
#define SHA256_VALIDATE(cond) MBEDTLS_INTERNAL_VALIDATE( cond )
|
||||
|
||||
void mbedtls_sha256_init( mbedtls_sha256_context *ctx )
|
||||
{
|
||||
MBEDTLS_SHA256_VALIDATE( ctx != NULL );
|
||||
SHA256_VALIDATE( ctx != NULL );
|
||||
|
||||
memset( ctx, 0, sizeof( mbedtls_sha256_context ) );
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ void mbedtls_sha256_free( mbedtls_sha256_context *ctx )
|
|||
void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
||||
const mbedtls_sha256_context *src )
|
||||
{
|
||||
MBEDTLS_SHA256_VALIDATE( dst != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE( src != NULL );
|
||||
SHA256_VALIDATE( dst != NULL );
|
||||
SHA256_VALIDATE( src != NULL );
|
||||
|
||||
*dst = *src;
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||
*/
|
||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
|
||||
{
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||
SHA256_VALIDATE_RET( ctx != NULL );
|
||||
SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||
|
||||
ctx->total[0] = 0;
|
||||
ctx->total[1] = 0;
|
||||
|
@ -204,8 +204,8 @@ int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx,
|
|||
uint32_t A[8];
|
||||
unsigned int i;
|
||||
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( (const unsigned char *)data != NULL );
|
||||
SHA256_VALIDATE_RET( ctx != NULL );
|
||||
SHA256_VALIDATE_RET( (const unsigned char *)data != NULL );
|
||||
|
||||
for( i = 0; i < 8; i++ )
|
||||
A[i] = ctx->state[i];
|
||||
|
@ -278,8 +278,8 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
|||
size_t fill;
|
||||
uint32_t left;
|
||||
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
SHA256_VALIDATE_RET( ctx != NULL );
|
||||
SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
|
||||
if( ilen == 0 )
|
||||
return( 0 );
|
||||
|
@ -339,8 +339,8 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx,
|
|||
uint32_t used;
|
||||
uint32_t high, low;
|
||||
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
||||
SHA256_VALIDATE_RET( ctx != NULL );
|
||||
SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
||||
|
||||
/*
|
||||
* Add padding: 0x80 then 0x00 until 8 bytes remain for the length
|
||||
|
@ -416,9 +416,9 @@ int mbedtls_sha256_ret( const unsigned char *input,
|
|||
int ret;
|
||||
mbedtls_sha256_context ctx;
|
||||
|
||||
MBEDTLS_SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
MBEDTLS_SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
||||
SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||
SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||
SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
||||
|
||||
mbedtls_sha256_init( &ctx );
|
||||
|
||||
|
|
Loading…
Reference in a new issue