mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Update naming of internal LMS functions
To comply with the mbedtls_ requirement Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
@@ -124,7 +124,7 @@ static int create_merkle_leaf_value( const mbedtls_lms_parameters_t *params,
|
||||
if( ret != 0 )
|
||||
goto exit;
|
||||
|
||||
unsigned_int_to_network_bytes( r_node_idx, 4, r_node_idx_bytes );
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( r_node_idx, 4, r_node_idx_bytes );
|
||||
status = psa_hash_update( &op, r_node_idx_bytes, 4 );
|
||||
ret = mbedtls_lms_error_from_psa( status );
|
||||
if( ret != 0 )
|
||||
@@ -199,7 +199,7 @@ static int create_merkle_internal_value( const mbedtls_lms_parameters_t *params,
|
||||
if( ret != 0 )
|
||||
goto exit;
|
||||
|
||||
unsigned_int_to_network_bytes( r_node_idx, 4, r_node_idx_bytes );
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( r_node_idx, 4, r_node_idx_bytes );
|
||||
status = psa_hash_update( &op, r_node_idx_bytes, 4 );
|
||||
ret = mbedtls_lms_error_from_psa( status );
|
||||
if( ret != 0 )
|
||||
@@ -255,7 +255,7 @@ int mbedtls_lms_import_public_key( mbedtls_lms_public_t *ctx,
|
||||
return( MBEDTLS_ERR_LMS_BUFFER_TOO_SMALL );
|
||||
}
|
||||
|
||||
type = network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,
|
||||
type = mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,
|
||||
key + MBEDTLS_LMS_PUBLIC_KEY_TYPE_OFFSET );
|
||||
if( type != MBEDTLS_LMS_SHA256_M32_H10 )
|
||||
{
|
||||
@@ -263,7 +263,7 @@ int mbedtls_lms_import_public_key( mbedtls_lms_public_t *ctx,
|
||||
}
|
||||
ctx->params.type = type;
|
||||
|
||||
otstype = network_bytes_to_unsigned_int( MBEDTLS_LMOTS_TYPE_LEN,
|
||||
otstype = mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMOTS_TYPE_LEN,
|
||||
key + MBEDTLS_LMS_PUBLIC_KEY_OTSTYPE_OFFSET );
|
||||
if( otstype != MBEDTLS_LMOTS_SHA256_N32_W8 )
|
||||
{
|
||||
@@ -319,14 +319,14 @@ int mbedtls_lms_verify( const mbedtls_lms_public_t *ctx,
|
||||
return( MBEDTLS_ERR_LMS_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
if( network_bytes_to_unsigned_int( MBEDTLS_LMOTS_TYPE_LEN,
|
||||
if( mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMOTS_TYPE_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_OTS_SIG_OFFSET + MBEDTLS_LMOTS_SIG_TYPE_OFFSET )
|
||||
!= MBEDTLS_LMOTS_SHA256_N32_W8 )
|
||||
{
|
||||
return( MBEDTLS_ERR_LMS_VERIFY_FAILED );
|
||||
}
|
||||
|
||||
if( network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,
|
||||
if( mbedtls_lms_network_bytes_to_unsigned_int( MBEDTLS_LMS_TYPE_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_TYPE_OFFSET(ctx->params.otstype))
|
||||
!= MBEDTLS_LMS_SHA256_M32_H10 )
|
||||
{
|
||||
@@ -334,8 +334,8 @@ int mbedtls_lms_verify( const mbedtls_lms_public_t *ctx,
|
||||
}
|
||||
|
||||
|
||||
q_leaf_identifier = network_bytes_to_unsigned_int( MBEDTLS_LMOTS_Q_LEAF_ID_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_Q_LEAF_ID_OFFSET );
|
||||
q_leaf_identifier = mbedtls_lms_network_bytes_to_unsigned_int(
|
||||
MBEDTLS_LMOTS_Q_LEAF_ID_LEN, sig + MBEDTLS_LMS_SIG_Q_LEAF_ID_OFFSET );
|
||||
|
||||
if( q_leaf_identifier >= MERKLE_TREE_LEAF_NODE_AM(ctx->params.type) )
|
||||
{
|
||||
@@ -345,9 +345,9 @@ int mbedtls_lms_verify( const mbedtls_lms_public_t *ctx,
|
||||
memcpy( ots_params.I_key_identifier,
|
||||
ctx->params.I_key_identifier,
|
||||
MBEDTLS_LMOTS_I_KEY_ID_LEN );
|
||||
unsigned_int_to_network_bytes( q_leaf_identifier,
|
||||
MBEDTLS_LMOTS_Q_LEAF_ID_LEN,
|
||||
ots_params.q_leaf_identifier );
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( q_leaf_identifier,
|
||||
MBEDTLS_LMOTS_Q_LEAF_ID_LEN,
|
||||
ots_params.q_leaf_identifier );
|
||||
ots_params.type = ctx->params.otstype;
|
||||
|
||||
ret = mbedtls_lmots_calculate_public_key_candidate( &ots_params, msg,
|
||||
@@ -676,10 +676,11 @@ int mbedtls_lms_export_public_key( mbedtls_lms_public_t *ctx,
|
||||
return( MBEDTLS_ERR_LMS_BAD_INPUT_DATA );
|
||||
}
|
||||
|
||||
unsigned_int_to_network_bytes(
|
||||
mbedtls_lms_unsigned_int_to_network_bytes(
|
||||
ctx->params.type,
|
||||
MBEDTLS_LMS_TYPE_LEN, key + MBEDTLS_LMS_PUBLIC_KEY_TYPE_OFFSET );
|
||||
unsigned_int_to_network_bytes( ctx->params.otstype, MBEDTLS_LMOTS_TYPE_LEN,
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( ctx->params.otstype,
|
||||
MBEDTLS_LMOTS_TYPE_LEN,
|
||||
key + MBEDTLS_LMS_PUBLIC_KEY_OTSTYPE_OFFSET );
|
||||
memcpy( key + MBEDTLS_LMS_PUBLIC_KEY_I_KEY_ID_OFFSET,
|
||||
ctx->params.I_key_identifier,
|
||||
@@ -748,10 +749,12 @@ int mbedtls_lms_sign( mbedtls_lms_private_t *ctx,
|
||||
return( ret );
|
||||
}
|
||||
|
||||
unsigned_int_to_network_bytes( ctx->params.type, MBEDTLS_LMS_TYPE_LEN,
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( ctx->params.type,
|
||||
MBEDTLS_LMS_TYPE_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_TYPE_OFFSET(ctx->params.otstype) );
|
||||
unsigned_int_to_network_bytes( q_leaf_identifier, MBEDTLS_LMOTS_Q_LEAF_ID_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_Q_LEAF_ID_OFFSET );
|
||||
mbedtls_lms_unsigned_int_to_network_bytes( q_leaf_identifier,
|
||||
MBEDTLS_LMOTS_Q_LEAF_ID_LEN,
|
||||
sig + MBEDTLS_LMS_SIG_Q_LEAF_ID_OFFSET );
|
||||
|
||||
ret = get_merkle_path( ctx,
|
||||
MERKLE_TREE_INTERNAL_NODE_AM(ctx->params.type) + q_leaf_identifier,
|
||||
|
||||
Reference in New Issue
Block a user