mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-28 00:21:48 +03:00
Rename md_init_ctx() to md_setup()
This commit is contained in:
@ -97,7 +97,7 @@ int hmac_drbg_init_buf( hmac_drbg_context *ctx,
|
||||
|
||||
md_init( &ctx->md_ctx );
|
||||
|
||||
if( ( ret = md_init_ctx( &ctx->md_ctx, md_info, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &ctx->md_ctx, md_info, 1 ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
/*
|
||||
@ -171,7 +171,7 @@ int hmac_drbg_init( hmac_drbg_context *ctx,
|
||||
|
||||
md_init( &ctx->md_ctx );
|
||||
|
||||
if( ( ret = md_init_ctx( &ctx->md_ctx, md_info, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &ctx->md_ctx, md_info, 1 ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
md_size = md_get_size( md_info );
|
||||
|
@ -199,7 +199,7 @@ void md_free( md_context_t *ctx )
|
||||
polarssl_zeroize( ctx, sizeof( md_context_t ) );
|
||||
}
|
||||
|
||||
int md_init_ctx( md_context_t *ctx, const md_info_t *md_info, int hmac )
|
||||
int md_setup( md_context_t *ctx, const md_info_t *md_info, int hmac )
|
||||
{
|
||||
if( md_info == NULL || ctx == NULL )
|
||||
return( POLARSSL_ERR_MD_BAD_INPUT_DATA );
|
||||
@ -381,7 +381,7 @@ int md_hmac( const md_info_t *md_info, const unsigned char *key, size_t keylen,
|
||||
|
||||
md_init( &ctx );
|
||||
|
||||
if( ( ret = md_init_ctx( &ctx, md_info, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &ctx, md_info, 1 ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
md_hmac_starts( &ctx, key, keylen );
|
||||
|
@ -268,7 +268,7 @@ int pkcs12_derivation( unsigned char *data, size_t datalen,
|
||||
|
||||
md_init( &md_ctx );
|
||||
|
||||
if( ( ret = md_init_ctx( &md_ctx, md_info, 0 ) ) != 0 )
|
||||
if( ( ret = md_setup( &md_ctx, md_info, 0 ) ) != 0 )
|
||||
return( ret );
|
||||
hlen = md_get_size( md_info );
|
||||
|
||||
|
@ -189,7 +189,7 @@ int pkcs5_pbes2( const asn1_buf *pbe_params, int mode,
|
||||
|
||||
memcpy( iv, enc_scheme_params.p, enc_scheme_params.len );
|
||||
|
||||
if( ( ret = md_init_ctx( &md_ctx, md_info, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &md_ctx, md_info, 1 ) ) != 0 )
|
||||
goto exit;
|
||||
|
||||
if( ( ret = pkcs5_pbkdf2_hmac( &md_ctx, pwd, pwdlen, salt.p, salt.len,
|
||||
@ -365,7 +365,7 @@ int pkcs5_self_test( int verbose )
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( ( ret = md_init_ctx( &sha1_ctx, info_sha1, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &sha1_ctx, info_sha1, 1 ) ) != 0 )
|
||||
{
|
||||
ret = 1;
|
||||
goto exit;
|
||||
|
@ -556,7 +556,7 @@ int rsa_rsaes_oaep_encrypt( rsa_context *ctx,
|
||||
memcpy( p, input, ilen );
|
||||
|
||||
md_init( &md_ctx );
|
||||
md_init_ctx( &md_ctx, md_info, 0 );
|
||||
md_setup( &md_ctx, md_info, 0 );
|
||||
|
||||
// maskedDB: Apply dbMask to DB
|
||||
//
|
||||
@ -725,7 +725,7 @@ int rsa_rsaes_oaep_decrypt( rsa_context *ctx,
|
||||
hlen = md_get_size( md_info );
|
||||
|
||||
md_init( &md_ctx );
|
||||
md_init_ctx( &md_ctx, md_info, 0 );
|
||||
md_setup( &md_ctx, md_info, 0 );
|
||||
|
||||
/* Generate lHash */
|
||||
md( md_info, label, label_len, lhash );
|
||||
@ -969,7 +969,7 @@ int rsa_rsassa_pss_sign( rsa_context *ctx,
|
||||
p += slen;
|
||||
|
||||
md_init( &md_ctx );
|
||||
md_init_ctx( &md_ctx, md_info, 0 );
|
||||
md_setup( &md_ctx, md_info, 0 );
|
||||
|
||||
// Generate H = Hash( M' )
|
||||
//
|
||||
@ -1201,7 +1201,7 @@ int rsa_rsassa_pss_verify_ext( rsa_context *ctx,
|
||||
return( POLARSSL_ERR_RSA_BAD_INPUT_DATA );
|
||||
|
||||
md_init( &md_ctx );
|
||||
md_init_ctx( &md_ctx, md_info, 0 );
|
||||
md_setup( &md_ctx, md_info, 0 );
|
||||
|
||||
mgf_mask( p, siglen - hlen - 1, p + siglen - hlen - 1, hlen, &md_ctx );
|
||||
|
||||
|
@ -2172,10 +2172,10 @@ static int ssl_parse_server_key_exchange( ssl_context *ssl )
|
||||
* ServerDHParams params;
|
||||
* };
|
||||
*/
|
||||
if( ( ret = md_init_ctx( &ctx,
|
||||
if( ( ret = md_setup( &ctx,
|
||||
md_info_from_type( md_alg ), 0 ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_RET( 1, "md_init_ctx", ret );
|
||||
SSL_DEBUG_RET( 1, "md_setup", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ int ssl_cookie_setup( ssl_cookie_ctx *ctx,
|
||||
if( ( ret = f_rng( p_rng, key, sizeof( key ) ) ) != 0 )
|
||||
return( ret );
|
||||
|
||||
ret = md_init_ctx( &ctx->hmac_ctx, md_info_from_type( COOKIE_MD ), 1 );
|
||||
ret = md_setup( &ctx->hmac_ctx, md_info_from_type( COOKIE_MD ), 1 );
|
||||
if( ret != 0 )
|
||||
return( ret );
|
||||
|
||||
|
@ -3073,9 +3073,9 @@ curve_matching_done:
|
||||
* ServerDHParams params;
|
||||
* };
|
||||
*/
|
||||
if( ( ret = md_init_ctx( &ctx, md_info, 0 ) ) != 0 )
|
||||
if( ( ret = md_setup( &ctx, md_info, 0 ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_RET( 1, "md_init_ctx", ret );
|
||||
SSL_DEBUG_RET( 1, "md_setup", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
@ -658,10 +658,10 @@ int ssl_derive_keys( ssl_context *ssl )
|
||||
int ret;
|
||||
|
||||
/* Initialize HMAC contexts */
|
||||
if( ( ret = md_init_ctx( &transform->md_ctx_enc, md_info, 1 ) ) != 0 ||
|
||||
( ret = md_init_ctx( &transform->md_ctx_dec, md_info, 1 ) ) != 0 )
|
||||
if( ( ret = md_setup( &transform->md_ctx_enc, md_info, 1 ) ) != 0 ||
|
||||
( ret = md_setup( &transform->md_ctx_dec, md_info, 1 ) ) != 0 )
|
||||
{
|
||||
SSL_DEBUG_RET( 1, "md_init_ctx", ret );
|
||||
SSL_DEBUG_RET( 1, "md_setup", ret );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user