Update naming of internal LMS functions
To comply with the mbedtls_ requirement
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/library/lms.c b/library/lms.c
index 653530c..cd39502 100644
--- a/library/lms.c
+++ b/library/lms.c
@@ -124,7 +124,7 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
}
- 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 @@
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 @@
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 @@
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,