Document LMS and LMOTS contexts
And add some comments about the source of their type IDs Signed-off-by: Raef Coles <raef.coles@arm.com>
This commit is contained in:
parent
8ff6df538c
commit
c464746d45
2 changed files with 42 additions and 18 deletions
|
@ -59,8 +59,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* We are only implementing a subset of the types, particularly n32_w8, for the
|
/* https://www.iana.org/assignments/leighton-micali-signatures/leighton-micali-signatures.xhtml
|
||||||
* sake of simplicty
|
* We are only implementing a subset of the types, particularly n32_w8, for the sake of simplicty.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MBEDTLS_LMOTS_SHA256_N32_W8 = 4
|
MBEDTLS_LMOTS_SHA256_N32_W8 = 4
|
||||||
|
@ -68,14 +68,25 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char MBEDTLS_PRIVATE(have_privkey);
|
unsigned char MBEDTLS_PRIVATE(have_privkey); /*!< Whether the context contains a private key.
|
||||||
unsigned char MBEDTLS_PRIVATE(have_pubkey);
|
Boolean values only. */
|
||||||
unsigned char MBEDTLS_PRIVATE(I_key_identifier[MBEDTLS_LMOTS_I_KEY_ID_LEN]);
|
unsigned char MBEDTLS_PRIVATE(have_pubkey); /*!< Whether the context contains a public key.
|
||||||
unsigned int MBEDTLS_PRIVATE(q_leaf_identifier);
|
Boolean values only. */
|
||||||
unsigned char MBEDTLS_PRIVATE(q_leaf_identifier_bytes)[MBEDTLS_LMOTS_Q_LEAF_ID_LEN];
|
unsigned char MBEDTLS_PRIVATE(I_key_identifier[MBEDTLS_LMOTS_I_KEY_ID_LEN]); /*!< The key
|
||||||
mbedtls_lmots_algorithm_type_t MBEDTLS_PRIVATE(type);
|
identifier. */
|
||||||
unsigned char MBEDTLS_PRIVATE(priv_key[MBEDTLS_LMOTS_P_SIG_SYMBOL_LEN][32]);
|
unsigned int MBEDTLS_PRIVATE(q_leaf_identifier); /*!< Which leaf of the LMS key this is.
|
||||||
unsigned char MBEDTLS_PRIVATE(pub_key[32]);
|
0 if the key is not part of an LMS key. */
|
||||||
|
unsigned char MBEDTLS_PRIVATE(q_leaf_identifier_bytes)[MBEDTLS_LMOTS_Q_LEAF_ID_LEN];/*!< The
|
||||||
|
leaf identifier in network bytes form. */
|
||||||
|
mbedtls_lmots_algorithm_type_t MBEDTLS_PRIVATE(type); /*!< The LM-OTS key type identifier as
|
||||||
|
per IANA. Only SHA256_N32_W8 is currently
|
||||||
|
supported. */
|
||||||
|
unsigned char MBEDTLS_PRIVATE(priv_key[MBEDTLS_LMOTS_P_SIG_SYMBOL_LEN][32]); /*!< The private
|
||||||
|
key, one hash output per byte of the encoded
|
||||||
|
symbol string P (32 bytes of hash output +
|
||||||
|
2 bytes of checksum). */
|
||||||
|
unsigned char MBEDTLS_PRIVATE(pub_key[32]); /*!< The public key, in the form of a SHA256
|
||||||
|
output. */
|
||||||
} mbedtls_lmots_context;
|
} mbedtls_lmots_context;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,20 +58,33 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* https://www.iana.org/assignments/leighton-micali-signatures/leighton-micali-signatures.xhtml
|
||||||
|
* We are only implementing a subset of the types, particularly H10, for the sake of simplicty.
|
||||||
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
MBEDTLS_LMS_SHA256_M32_H10 = 0x6,
|
MBEDTLS_LMS_SHA256_M32_H10 = 0x6,
|
||||||
} mbedtls_lms_algorithm_type_t;
|
} mbedtls_lms_algorithm_type_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned char MBEDTLS_PRIVATE(have_privkey);
|
unsigned char MBEDTLS_PRIVATE(have_privkey); /*!< Whether the context contains a private key.
|
||||||
unsigned char MBEDTLS_PRIVATE(have_pubkey);
|
Boolean values only. */
|
||||||
unsigned char MBEDTLS_PRIVATE(I_key_identifier)[MBEDTLS_LMOTS_I_KEY_ID_LEN];
|
unsigned char MBEDTLS_PRIVATE(have_pubkey); /*!< Whether the context contains a public key.
|
||||||
mbedtls_lms_algorithm_type_t MBEDTLS_PRIVATE(type);
|
Boolean values only. */
|
||||||
mbedtls_lmots_algorithm_type_t MBEDTLS_PRIVATE(otstype);
|
unsigned char MBEDTLS_PRIVATE(I_key_identifier)[MBEDTLS_LMOTS_I_KEY_ID_LEN]; /*!< The key
|
||||||
unsigned int MBEDTLS_PRIVATE(q_next_usable_key);
|
identifier. */
|
||||||
mbedtls_lmots_context *MBEDTLS_PRIVATE(priv_keys);
|
mbedtls_lms_algorithm_type_t MBEDTLS_PRIVATE(type); /*!< The LMS key type identifier as per
|
||||||
unsigned char MBEDTLS_PRIVATE(T_1_pub_key)[MBEDTLS_LMS_M_NODE_BYTES];
|
IANA. Only SHA256_M32_H10 is currently
|
||||||
|
supported. */
|
||||||
|
mbedtls_lmots_algorithm_type_t MBEDTLS_PRIVATE(otstype); /*!< The LM-OTS key type identifier as
|
||||||
|
per IANA. Only SHA256_N32_W8 is currently
|
||||||
|
supported. */
|
||||||
|
unsigned int MBEDTLS_PRIVATE(q_next_usable_key); /*!< The index of the next OTS key that has not
|
||||||
|
been used. */
|
||||||
|
mbedtls_lmots_context *MBEDTLS_PRIVATE(priv_keys); /*!< The private key material. One OTS key
|
||||||
|
for each leaf node in the merkle tree. */
|
||||||
|
unsigned char MBEDTLS_PRIVATE(T_1_pub_key)[MBEDTLS_LMS_M_NODE_BYTES]; /*!< The public key, in
|
||||||
|
the form of the merkle tree root node. */
|
||||||
} mbedtls_lms_context;
|
} mbedtls_lms_context;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue