mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-01 22:20:58 +00:00
Update LMS and LMOTS dependency macros
Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
parent
56fe20a473
commit
5127e859d7
@ -354,8 +354,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_LMS_C) && \
|
#if defined(MBEDTLS_LMS_C) && \
|
||||||
( !defined(MBEDTLS_PSA_CRYPTO_C) )
|
( !defined(MBEDTLS_PSA_CRYPTO_C) && !defined(PSA_WANT_ALG_SHA256) )
|
||||||
#error "MBEDTLS_LMS_C requires MBEDTLS_PSA_CRYPTO_C"
|
#error "MBEDTLS_LMS_C requires MBEDTLS_PSA_CRYPTO_C and PSA_WANT_ALG_SHA256"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(MBEDTLS_LMS_PRIVATE) && \
|
#if defined(MBEDTLS_LMS_PRIVATE) && \
|
||||||
|
@ -139,7 +139,7 @@ typedef struct {
|
|||||||
Boolean values only. */
|
Boolean values only. */
|
||||||
} mbedtls_lmots_public_t;
|
} mbedtls_lmots_public_t;
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
/** LMOTS private context structure.
|
/** LMOTS private context structure.
|
||||||
*
|
*
|
||||||
* A LMOTS private key is one hash output for each of digit of the digest +
|
* A LMOTS private key is one hash output for each of digit of the digest +
|
||||||
@ -163,7 +163,7 @@ typedef struct {
|
|||||||
unsigned char MBEDTLS_PRIVATE(have_private_key); /*!< Whether the context contains a private key.
|
unsigned char MBEDTLS_PRIVATE(have_private_key); /*!< Whether the context contains a private key.
|
||||||
Boolean values only. */
|
Boolean values only. */
|
||||||
} mbedtls_lmots_private_t;
|
} mbedtls_lmots_private_t;
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
|
|
||||||
|
|
||||||
/** LMS parameters structure.
|
/** LMS parameters structure.
|
||||||
@ -209,7 +209,7 @@ typedef struct {
|
|||||||
} mbedtls_lms_public_t;
|
} mbedtls_lms_public_t;
|
||||||
|
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
/** LMS private context structure.
|
/** LMS private context structure.
|
||||||
*
|
*
|
||||||
* A LMS private key is a set of LMOTS private keys, an index to the next usable
|
* A LMS private key is a set of LMOTS private keys, an index to the next usable
|
||||||
@ -237,7 +237,7 @@ typedef struct {
|
|||||||
unsigned char MBEDTLS_PRIVATE(have_private_key); /*!< Whether the context contains a private key.
|
unsigned char MBEDTLS_PRIVATE(have_private_key); /*!< Whether the context contains a private key.
|
||||||
Boolean values only. */
|
Boolean values only. */
|
||||||
} mbedtls_lms_private_t;
|
} mbedtls_lms_private_t;
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes an LMS public context
|
* \brief This function initializes an LMS public context
|
||||||
@ -301,7 +301,7 @@ int mbedtls_lms_verify( const mbedtls_lms_public_t *ctx,
|
|||||||
const unsigned char *msg, size_t msg_size,
|
const unsigned char *msg, size_t msg_size,
|
||||||
const unsigned char *sig, size_t sig_size );
|
const unsigned char *sig, size_t sig_size );
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes an LMS private context
|
* \brief This function initializes an LMS private context
|
||||||
*
|
*
|
||||||
@ -434,7 +434,7 @@ int mbedtls_lms_sign( mbedtls_lms_private_t *ctx,
|
|||||||
int (*f_rng)(void *, unsigned char *, size_t),
|
int (*f_rng)(void *, unsigned char *, size_t),
|
||||||
void* p_rng, unsigned char *msg, unsigned int msg_size,
|
void* p_rng, unsigned char *msg, unsigned int msg_size,
|
||||||
unsigned char *sig, size_t sig_size, size_t *sig_len );
|
unsigned char *sig, size_t sig_size, size_t *sig_len );
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_C
|
#if defined(MBEDTLS_LMS_C)
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ int mbedtls_lmots_verify( mbedtls_lmots_public_t *ctx, const unsigned char *msg,
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
|
|
||||||
void mbedtls_lmots_init_private( mbedtls_lmots_private_t *ctx )
|
void mbedtls_lmots_init_private( mbedtls_lmots_private_t *ctx )
|
||||||
{
|
{
|
||||||
@ -851,5 +851,5 @@ int mbedtls_lmots_sign( mbedtls_lmots_private_t *ctx,
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
#endif /* MBEDTLS_LMS_C */
|
#endif /* defined(MBEDTLS_LMS_C) */
|
||||||
|
@ -189,7 +189,7 @@ int mbedtls_lmots_verify( mbedtls_lmots_public_t *ctx, const unsigned char *msg,
|
|||||||
size_t msg_size, const unsigned char *sig,
|
size_t msg_size, const unsigned char *sig,
|
||||||
size_t sig_size );
|
size_t sig_size );
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This function initializes a private LMOTS context
|
* \brief This function initializes a private LMOTS context
|
||||||
@ -310,7 +310,7 @@ int mbedtls_lmots_sign( mbedtls_lmots_private_t *ctx,
|
|||||||
void *p_rng, const unsigned char *msg, size_t msg_size,
|
void *p_rng, const unsigned char *msg, size_t msg_size,
|
||||||
unsigned char *sig, size_t sig_size, size_t* sig_len );
|
unsigned char *sig, size_t sig_size, size_t* sig_len );
|
||||||
|
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_C
|
#if defined(MBEDTLS_LMS_C)
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ int mbedtls_lms_verify( const mbedtls_lms_public_t *ctx,
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MBEDTLS_LMS_PRIVATE
|
#if defined(MBEDTLS_LMS_PRIVATE)
|
||||||
|
|
||||||
/* Calculate a full merkle tree based on a private key. This function
|
/* Calculate a full merkle tree based on a private key. This function
|
||||||
* implements RFC8554 section 5.3, and is used to generate a public key (as the
|
* implements RFC8554 section 5.3, and is used to generate a public key (as the
|
||||||
@ -773,5 +773,5 @@ int mbedtls_lms_sign( mbedtls_lms_private_t *ctx,
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_LMS_PRIVATE */
|
#endif /* defined(MBEDTLS_LMS_PRIVATE) */
|
||||||
#endif /* MBEDTLS_LMS_C */
|
#endif /* defined(MBEDTLS_LMS_C) */
|
||||||
|
@ -24,11 +24,11 @@ int check_lmots_private_key_for_leak(unsigned char * sig)
|
|||||||
/* END_HEADER */
|
/* END_HEADER */
|
||||||
|
|
||||||
/* BEGIN_DEPENDENCIES
|
/* BEGIN_DEPENDENCIES
|
||||||
* depends_on:MBEDTLS_LMS_C:MBEDTLS_LMS_PRIVATE:MBEDTLS_PSA_CRYPTO_C
|
* depends_on:MBEDTLS_LMS_C
|
||||||
* END_DEPENDENCIES
|
* END_DEPENDENCIES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lmots_sign_verify_test ( data_t *msg, data_t *key_id, int leaf_id,
|
void lmots_sign_verify_test ( data_t *msg, data_t *key_id, int leaf_id,
|
||||||
data_t *seed )
|
data_t *seed )
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lmots_sign_verify_null_msg_test ( data_t *key_id, int leaf_id, data_t *seed )
|
void lmots_sign_verify_null_msg_test ( data_t *key_id, int leaf_id, data_t *seed )
|
||||||
{
|
{
|
||||||
mbedtls_lmots_public_t pub_ctx;
|
mbedtls_lmots_public_t pub_ctx;
|
||||||
@ -92,7 +92,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lmots_import_export_test ( data_t * pub_key )
|
void lmots_import_export_test ( data_t * pub_key )
|
||||||
{
|
{
|
||||||
mbedtls_lmots_public_t ctx;
|
mbedtls_lmots_public_t ctx;
|
||||||
@ -113,7 +113,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lmots_reuse_test ( data_t *msg, data_t *key_id, int leaf_id, data_t *seed )
|
void lmots_reuse_test ( data_t *msg, data_t *key_id, int leaf_id, data_t *seed )
|
||||||
{
|
{
|
||||||
mbedtls_lmots_private_t ctx;
|
mbedtls_lmots_private_t ctx;
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
/* END_HEADER */
|
/* END_HEADER */
|
||||||
|
|
||||||
/* BEGIN_DEPENDENCIES
|
/* BEGIN_DEPENDENCIES
|
||||||
* depends_on:MBEDTLS_LMS_C:MBEDTLS_LMS_PRIVATE:MBEDTLS_PSA_CRYPTO_C
|
* depends_on:MBEDTLS_LMS_C
|
||||||
* END_DEPENDENCIES
|
* END_DEPENDENCIES
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lms_sign_verify_test ( data_t *msg, data_t *seed )
|
void lms_sign_verify_test ( data_t *msg, data_t *seed )
|
||||||
{
|
{
|
||||||
mbedtls_lms_public_t pub_ctx;
|
mbedtls_lms_public_t pub_ctx;
|
||||||
@ -44,7 +44,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lms_sign_verify_null_msg_test( data_t *seed )
|
void lms_sign_verify_null_msg_test( data_t *seed )
|
||||||
{
|
{
|
||||||
mbedtls_lms_public_t pub_ctx;
|
mbedtls_lms_public_t pub_ctx;
|
||||||
@ -97,7 +97,7 @@ exit:
|
|||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE */
|
/* BEGIN_CASE depends_on:MBEDTLS_LMS_PRIVATE */
|
||||||
void lms_import_export_test ( data_t * pub_key )
|
void lms_import_export_test ( data_t * pub_key )
|
||||||
{
|
{
|
||||||
mbedtls_lms_public_t ctx;
|
mbedtls_lms_public_t ctx;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user