mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-04 15:39:53 +00:00
Add validation is is224
argument in mbedtls_sha256_starts_ret()
This commit is contained in:
parent
230b4f4159
commit
596e014a06
@ -107,7 +107,8 @@ void mbedtls_sha256_clone( mbedtls_sha256_context *dst,
|
|||||||
*/
|
*/
|
||||||
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
|
int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 )
|
||||||
{
|
{
|
||||||
MBEDTLS_SHA256_VALIDATE( ctx != NULL );
|
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||||
|
MBEDTLS_SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||||
|
|
||||||
ctx->total[0] = 0;
|
ctx->total[0] = 0;
|
||||||
ctx->total[1] = 0;
|
ctx->total[1] = 0;
|
||||||
@ -277,12 +278,12 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx,
|
|||||||
size_t fill;
|
size_t fill;
|
||||||
uint32_t left;
|
uint32_t left;
|
||||||
|
|
||||||
|
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
||||||
|
MBEDTLS_SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||||
|
|
||||||
if( ilen == 0 )
|
if( ilen == 0 )
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
||||||
MBEDTLS_SHA256_VALIDATE_RET( ctx != NULL );
|
|
||||||
MBEDTLS_SHA256_VALIDATE_RET( input != NULL );
|
|
||||||
|
|
||||||
left = ctx->total[0] & 0x3F;
|
left = ctx->total[0] & 0x3F;
|
||||||
fill = 64 - left;
|
fill = 64 - left;
|
||||||
|
|
||||||
@ -415,6 +416,7 @@ int mbedtls_sha256_ret( const unsigned char *input,
|
|||||||
int ret;
|
int ret;
|
||||||
mbedtls_sha256_context ctx;
|
mbedtls_sha256_context ctx;
|
||||||
|
|
||||||
|
MBEDTLS_SHA256_VALIDATE_RET( is224 == 0 || is224 == 1 );
|
||||||
MBEDTLS_SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
MBEDTLS_SHA256_VALIDATE_RET( ilen == 0 || input != NULL );
|
||||||
MBEDTLS_SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
MBEDTLS_SHA256_VALIDATE_RET( (unsigned char *)output != NULL );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user