mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-03-12 17:06:31 +00:00
PK sign/verify: hash=NULL is ok if md_alg=0 and hash_len=0
This commit is contained in:
@@ -240,7 +240,8 @@ int mbedtls_pk_verify_restartable( mbedtls_pk_context *ctx,
|
||||
mbedtls_pk_restart_ctx *rs_ctx )
|
||||
{
|
||||
PK_VALIDATE_RET( ctx != NULL );
|
||||
PK_VALIDATE_RET( hash != NULL );
|
||||
PK_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE && hash_len == 0 ) ||
|
||||
hash != NULL );
|
||||
PK_VALIDATE_RET( sig != NULL );
|
||||
|
||||
if( ctx->pk_info == NULL ||
|
||||
@@ -297,7 +298,8 @@ int mbedtls_pk_verify_ext( mbedtls_pk_type_t type, const void *options,
|
||||
const unsigned char *sig, size_t sig_len )
|
||||
{
|
||||
PK_VALIDATE_RET( ctx != NULL );
|
||||
PK_VALIDATE_RET( hash != NULL );
|
||||
PK_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE && hash_len == 0 ) ||
|
||||
hash != NULL );
|
||||
PK_VALIDATE_RET( sig != NULL );
|
||||
|
||||
if( ctx->pk_info == NULL )
|
||||
@@ -361,7 +363,8 @@ int mbedtls_pk_sign_restartable( mbedtls_pk_context *ctx,
|
||||
mbedtls_pk_restart_ctx *rs_ctx )
|
||||
{
|
||||
PK_VALIDATE_RET( ctx != NULL );
|
||||
PK_VALIDATE_RET( hash != NULL );
|
||||
PK_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE && hash_len == 0 ) ||
|
||||
hash != NULL );
|
||||
PK_VALIDATE_RET( sig != NULL );
|
||||
|
||||
if( ctx->pk_info == NULL ||
|
||||
|
||||
Reference in New Issue
Block a user