XenevaOS
Loading...
Searching...
No Matches
lmots.h
Go to the documentation of this file.
1
9/*
10 * Copyright The Mbed TLS Contributors
11 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
12 */
13
14#ifndef MBEDTLS_LMOTS_H
15#define MBEDTLS_LMOTS_H
16
17#include "mbedtls/build_info.h"
18
19#include "psa/crypto.h"
20
21#include "mbedtls/lms.h"
22
23#include <stdint.h>
24#include <stddef.h>
25
26
27#define MBEDTLS_LMOTS_PUBLIC_KEY_LEN(type) (MBEDTLS_LMOTS_TYPE_LEN + \
28 MBEDTLS_LMOTS_I_KEY_ID_LEN + \
29 MBEDTLS_LMOTS_Q_LEAF_ID_LEN + \
30 MBEDTLS_LMOTS_N_HASH_LEN(type))
31
32#define MBEDTLS_LMOTS_SIG_TYPE_OFFSET (0)
33#define MBEDTLS_LMOTS_SIG_C_RANDOM_OFFSET (MBEDTLS_LMOTS_SIG_TYPE_OFFSET + \
34 MBEDTLS_LMOTS_TYPE_LEN)
35#define MBEDTLS_LMOTS_SIG_SIGNATURE_OFFSET(type) (MBEDTLS_LMOTS_SIG_C_RANDOM_OFFSET + \
36 MBEDTLS_LMOTS_C_RANDOM_VALUE_LEN(type))
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42
43#if defined(MBEDTLS_TEST_HOOKS)
44extern int (*mbedtls_lmots_sign_private_key_invalidated_hook)(unsigned char *);
45#endif /* defined(MBEDTLS_TEST_HOOKS) */
46
47#if !defined(MBEDTLS_DEPRECATED_REMOVED)
57#endif
58
66
74
94 const unsigned char *key, size_t key_size);
95
116 unsigned char *key, size_t key_size,
117 size_t *key_len);
118
145 const unsigned char *msg,
146 size_t msg_size,
147 const unsigned char *sig,
148 size_t sig_size,
149 unsigned char *out,
150 size_t out_size,
151 size_t *out_len);
152
179 const unsigned char *msg,
180 size_t msg_size, const unsigned char *sig,
181 size_t sig_size);
182
183#if defined(MBEDTLS_LMS_PRIVATE)
184
191void mbedtls_lmots_private_init(mbedtls_lmots_private_t *ctx);
192
199void mbedtls_lmots_private_free(mbedtls_lmots_private_t *ctx);
200
225int mbedtls_lmots_generate_private_key(mbedtls_lmots_private_t *ctx,
227 const unsigned char I_key_identifier[MBEDTLS_LMOTS_I_KEY_ID_LEN],
228 uint32_t q_leaf_identifier,
229 const unsigned char *seed,
230 size_t seed_size);
231
246int mbedtls_lmots_calculate_public_key(mbedtls_lmots_public_t *ctx,
247 const mbedtls_lmots_private_t *priv_ctx);
248
277int mbedtls_lmots_sign(mbedtls_lmots_private_t *ctx,
278 int (*f_rng)(void *, unsigned char *, size_t),
279 void *p_rng, const unsigned char *msg, size_t msg_size,
280 unsigned char *sig, size_t sig_size, size_t *sig_len);
281
282#endif /* defined(MBEDTLS_LMS_PRIVATE) */
283
284#ifdef __cplusplus
285}
286#endif
287
288#endif /* MBEDTLS_LMOTS_H */
Platform Security Architecture cryptography module.
#define out(...)
Definition main.cpp:65
unsigned int uint32_t
Definition acefiex.h:163
int32_t psa_status_t
Function return status.
Definition crypto_types.h:59
int MBEDTLS_DEPRECATED mbedtls_lms_error_from_psa(psa_status_t status)
This function converts a psa_status_t to a low-level LMS error code.
int mbedtls_lmots_import_public_key(mbedtls_lmots_public_t *ctx, const unsigned char *key, size_t key_size)
This function imports an LMOTS public key into a LMOTS context.
void mbedtls_lmots_public_free(mbedtls_lmots_public_t *ctx)
This function uninitializes a public LMOTS context.
void mbedtls_lmots_public_init(mbedtls_lmots_public_t *ctx)
This function initializes a public LMOTS context.
int mbedtls_lmots_export_public_key(const mbedtls_lmots_public_t *ctx, unsigned char *key, size_t key_size, size_t *key_len)
This function exports an LMOTS public key from a LMOTS context that already contains a public key.
int mbedtls_lmots_verify(const mbedtls_lmots_public_t *ctx, const unsigned char *msg, size_t msg_size, const unsigned char *sig, size_t sig_size)
This function verifies a LMOTS signature, using a LMOTS context that contains a public key.
int mbedtls_lmots_calculate_public_key_candidate(const mbedtls_lmots_parameters_t *params, const unsigned char *msg, size_t msg_size, const unsigned char *sig, size_t sig_size, unsigned char *out, size_t out_size, size_t *out_len)
This function creates a candidate public key from an LMOTS signature. This can then be compared to th...
This file provides an API for the LMS post-quantum-safe stateful-hash public-key signature scheme as ...
#define MBEDTLS_LMOTS_I_KEY_ID_LEN
Definition lms.h:34
mbedtls_lmots_algorithm_type_t
Definition lms.h:83
Build-time configuration info.
#define MBEDTLS_DEPRECATED
Definition platform_util.h:37
Definition lms.h:93
Definition lms.h:121