|
Embedded SDK
Embedded SDK
|
ML-KEM (Module-Lattice Key Encapsulation Mechanism) public API. More...
#include <stddef.h>#include <stdint.h>#include "cx_errors.h"

Go to the source code of this file.
Classes | |
| struct | MLKEM_param_info_s |
| ML-KEM parameter set descriptor holding all derived sizes. More... | |
Typedefs | |
| typedef enum MLKEM_param_e | MLKEM_param_t |
| ML-KEM parameter set selector. | |
| typedef struct MLKEM_param_info_s | MLKEM_param_info_t |
| ML-KEM parameter set descriptor holding all derived sizes. | |
Enumerations | |
| enum | MLKEM_param_e { MLKEM_512 = 0 , MLKEM_768 , MLKEM_1024 } |
| ML-KEM parameter set selector. More... | |
Functions | |
| cx_err_t | MLKEM_crypto_kem_keypair (uint8_t *pk, size_t pk_len, uint8_t *sk, size_t sk_len, MLKEM_param_t param) |
| Generates an ML-KEM key pair. | |
| cx_err_t | MLKEM_crypto_kem_enc (uint8_t *ct, size_t ct_len, uint8_t *ss, size_t ss_len, const uint8_t *pk, size_t pk_len, MLKEM_param_t param) |
| ML-KEM encapsulation. | |
| cx_err_t | MLKEM_crypto_kem_dec (uint8_t *ss, size_t ss_len, const uint8_t *ct, size_t ct_len, const uint8_t *sk, size_t sk_len, MLKEM_param_t param) |
| ML-KEM decapsulation. | |
Variables | |
| const MLKEM_param_info_t | MLKEM_PARAM [MLKEM_NUM_PARAM_SETS] |
| Lookup table of ML-KEM parameter sets indexed by MLKEM_param_t. | |
ML-KEM (Module-Lattice Key Encapsulation Mechanism) public API.
Provides the public constants, parameter structures, and function prototypes for ML-KEM-512, ML-KEM-768, and ML-KEM-1024 as specified in FIPS 203.
Definition in file lcx_mlkem.h.
| #define MLKEM_MAX_K MLKEM1024_K |
Maximum module rank across all parameter sets.
Definition at line 154 of file lcx_mlkem.h.
| typedef struct MLKEM_param_info_s MLKEM_param_info_t |
ML-KEM parameter set descriptor holding all derived sizes.
| typedef enum MLKEM_param_e MLKEM_param_t |
ML-KEM parameter set selector.
| enum MLKEM_param_e |
ML-KEM parameter set selector.
| Enumerator | |
|---|---|
| MLKEM_512 | ML-KEM-512 (NIST security level 1). |
| MLKEM_768 | ML-KEM-768 (NIST security level 3). |
| MLKEM_1024 | ML-KEM-1024 (NIST security level 5). |
Definition at line 159 of file lcx_mlkem.h.
| cx_err_t MLKEM_crypto_kem_dec | ( | uint8_t * | ss, |
| size_t | ss_len, | ||
| const uint8_t * | ct, | ||
| size_t | ct_len, | ||
| const uint8_t * | sk, | ||
| size_t | sk_len, | ||
| MLKEM_param_t | param | ||
| ) |
ML-KEM decapsulation.
Recovers the shared secret from a ciphertext and a secret key.
| [out] | ss | Shared secret output buffer. |
| [in] | ss_len | Size of the shared secret buffer in bytes. |
| [in] | ct | Ciphertext. |
| [in] | ct_len | Size of the ciphertext in bytes. |
| [in] | sk | Secret key. |
| [in] | sk_len | Size of the secret key in bytes. |
| [in] | param | ML-KEM parameter set selector. |
Definition at line 88 of file cx_mlkem.c.
| cx_err_t MLKEM_crypto_kem_enc | ( | uint8_t * | ct, |
| size_t | ct_len, | ||
| uint8_t * | ss, | ||
| size_t | ss_len, | ||
| const uint8_t * | pk, | ||
| size_t | pk_len, | ||
| MLKEM_param_t | param | ||
| ) |
ML-KEM encapsulation.
Produces a ciphertext and a shared secret from a public key using internal randomness.
| [out] | ct | Ciphertext output buffer. |
| [in] | ct_len | Size of the ciphertext buffer in bytes. |
| [out] | ss | Shared secret output buffer. |
| [in] | ss_len | Size of the shared secret buffer in bytes. |
| [in] | pk | Public key. |
| [in] | pk_len | Size of the public key in bytes. |
| [in] | param | ML-KEM parameter set selector. |
Definition at line 59 of file cx_mlkem.c.
| cx_err_t MLKEM_crypto_kem_keypair | ( | uint8_t * | pk, |
| size_t | pk_len, | ||
| uint8_t * | sk, | ||
| size_t | sk_len, | ||
| MLKEM_param_t | param | ||
| ) |
Generates an ML-KEM key pair.
Uses internal randomness to produce the key pair.
| [out] | pk | Public key output buffer. |
| [in] | pk_len | Size of the public key buffer in bytes. |
| [out] | sk | Secret key output buffer. |
| [in] | sk_len | Size of the secret key buffer in bytes. |
| [in] | param | ML-KEM parameter set selector. |
Definition at line 32 of file cx_mlkem.c.
|
extern |
Lookup table of ML-KEM parameter sets indexed by MLKEM_param_t.
Definition at line 23 of file cx_mlkem_params.c.