Rename LMS and LMOTS init/free functions
To match convention
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/library/lmots.c b/library/lmots.c
index 54773e1..059d6c8 100644
--- a/library/lmots.c
+++ b/library/lmots.c
@@ -396,14 +396,14 @@
}
}
-void mbedtls_lmots_init_public( mbedtls_lmots_public_t *ctx )
+void mbedtls_lmots_public_init( mbedtls_lmots_public_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lmots_public_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
-void mbedtls_lmots_free_public( mbedtls_lmots_public_t *ctx )
+void mbedtls_lmots_public_free( mbedtls_lmots_public_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lmots_public_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
int mbedtls_lmots_import_public_key( mbedtls_lmots_public_t *ctx,
@@ -540,14 +540,14 @@
#if defined(MBEDTLS_LMS_PRIVATE)
-void mbedtls_lmots_init_private( mbedtls_lmots_private_t *ctx )
+void mbedtls_lmots_private_init( mbedtls_lmots_private_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lmots_private_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
-void mbedtls_lmots_free_private( mbedtls_lmots_private_t *ctx )
+void mbedtls_lmots_private_free( mbedtls_lmots_private_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lmots_private_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
int mbedtls_lmots_generate_private_key( mbedtls_lmots_private_t *ctx,
diff --git a/library/lmots.h b/library/lmots.h
index 2f42a59..05bd967 100644
--- a/library/lmots.h
+++ b/library/lmots.h
@@ -96,7 +96,7 @@
* \param ctx The uninitialized LMOTS context that will then be
* initialized.
*/
-void mbedtls_lmots_init_public( mbedtls_lmots_public_t *ctx );
+void mbedtls_lmots_public_init( mbedtls_lmots_public_t *ctx );
/**
* \brief This function uninitializes a public LMOTS context
@@ -104,7 +104,7 @@
* \param ctx The initialized LMOTS context that will then be
* uninitialized.
*/
-void mbedtls_lmots_free_public( mbedtls_lmots_public_t *ctx );
+void mbedtls_lmots_public_free( mbedtls_lmots_public_t *ctx );
/**
* \brief This function imports an LMOTS public key into a
@@ -198,7 +198,7 @@
* \param ctx The uninitialized LMOTS context that will then be
* initialized.
*/
-void mbedtls_lmots_init_private( mbedtls_lmots_private_t *ctx );
+void mbedtls_lmots_private_init( mbedtls_lmots_private_t *ctx );
/**
* \brief This function uninitializes a private LMOTS context
@@ -206,7 +206,7 @@
* \param ctx The initialized LMOTS context that will then be
* uninitialized.
*/
-void mbedtls_lmots_free_private( mbedtls_lmots_private_t *ctx );
+void mbedtls_lmots_private_free( mbedtls_lmots_private_t *ctx );
/**
* \brief This function calculates an LMOTS private key, and
diff --git a/library/lms.c b/library/lms.c
index ec6ec0c..e17d9be 100644
--- a/library/lms.c
+++ b/library/lms.c
@@ -219,14 +219,14 @@
return( mbedtls_lms_error_from_psa( status ) );
}
-void mbedtls_lms_init_public( mbedtls_lms_public_t *ctx )
+void mbedtls_lms_public_init( mbedtls_lms_public_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lms_public_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
-void mbedtls_lms_free_public( mbedtls_lms_public_t *ctx )
+void mbedtls_lms_public_free( mbedtls_lms_public_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lms_public_t ) );
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) );
}
int mbedtls_lms_import_public_key( mbedtls_lms_public_t *ctx,
@@ -489,12 +489,12 @@
return( 0 );
}
-void mbedtls_lms_init_private( mbedtls_lms_private_t *ctx )
+void mbedtls_lms_private_init( mbedtls_lms_private_t *ctx )
{
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lms_private_t ) ) ;
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) ) ;
}
-void mbedtls_lms_free_private( mbedtls_lms_private_t *ctx )
+void mbedtls_lms_private_free( mbedtls_lms_private_t *ctx )
{
unsigned int idx;
@@ -502,15 +502,15 @@
{
for( idx = 0; idx < MERKLE_TREE_LEAF_NODE_AM(ctx->params.type); idx++ )
{
- mbedtls_lmots_free_private( &ctx->ots_private_keys[idx] );
- mbedtls_lmots_free_public( &ctx->ots_public_keys[idx] );
+ mbedtls_lmots_private_free( &ctx->ots_private_keys[idx] );
+ mbedtls_lmots_public_free( &ctx->ots_public_keys[idx] );
}
mbedtls_free( ctx->ots_private_keys );
mbedtls_free( ctx->ots_public_keys );
}
- mbedtls_platform_zeroize( ctx, sizeof( mbedtls_lms_private_t ) );
+ mbedtls_platform_zeroize( ctx, sizeof( *ctx ) );
}
@@ -565,8 +565,8 @@
for( idx = 0; idx < MERKLE_TREE_LEAF_NODE_AM(ctx->params.type); idx++ )
{
- mbedtls_lmots_init_private( &ctx->ots_private_keys[idx] );
- mbedtls_lmots_init_public( &ctx->ots_public_keys[idx] );
+ mbedtls_lmots_private_init( &ctx->ots_private_keys[idx] );
+ mbedtls_lmots_public_init( &ctx->ots_public_keys[idx] );
}
@@ -593,8 +593,8 @@
{
for ( free_idx = 0; free_idx < idx; free_idx++ )
{
- mbedtls_lmots_free_private( &ctx->ots_private_keys[free_idx] );
- mbedtls_lmots_free_public( &ctx->ots_public_keys[free_idx] );
+ mbedtls_lmots_private_free( &ctx->ots_private_keys[free_idx] );
+ mbedtls_lmots_public_free( &ctx->ots_public_keys[free_idx] );
}
mbedtls_free( ctx->ots_private_keys );