|
Embedded SDK
Embedded SDK
|
ML-KEM utility functions (FIPS 203). More...

Go to the source code of this file.
Functions | |
| void | MLKEM_UTIL_hash_h (uint8_t out[CX_SHA3_256_SIZE], const uint8_t *in, size_t in_len) |
| Computes the H hash function (SHA3-256) as defined in FIPS 203. | |
| void | MLKEM_UTIL_hash_g (uint8_t *out, const uint8_t *in, size_t in_len) |
| Computes the G hash function (SHA3-512) as defined in FIPS 203. | |
| void | MLKEM_UTIL_hash_j (uint8_t *out, const uint8_t *in, size_t inlen) |
| void | MLKEM_UTIL_prf (uint8_t *out, size_t outlen, const uint8_t *key, uint8_t nonce) |
| Computes the PRF function (SHAKE256) as defined in FIPS 203. | |
| void | MLKEM_UTIL_xof_squeeze (uint8_t *out, size_t outlen, const uint8_t *seed, uint8_t x, uint8_t y) |
| Computes the XOF function (SHAKE128) as defined in FIPS 203. | |
| void | MLKEM_UTIL_ct_cmov (uint8_t *dst, const uint8_t *src, size_t len, uint8_t b) |
| cx_err_t | MLKEM_UTIL_check_ek (const uint8_t *ek, const MLKEM_param_info_t *p) |
| Validates encapsulation key modulus (FIPS 203 §7.2). | |
ML-KEM utility functions (FIPS 203).
Implements the hash functions H (SHA3-256) and G (SHA3-512), the PRF (SHAKE256), the XOF (SHAKE128) used throughout the ML-KEM implementation.
Definition in file cx_mlkem_util.c.
| cx_err_t MLKEM_UTIL_check_ek | ( | const uint8_t * | ek, |
| const MLKEM_param_info_t * | p | ||
| ) |
Validates encapsulation key modulus (FIPS 203 §7.2).
Verifies that every 12-bit decoded coefficient of the public polynomial vector is in [0, q-1].
| [in] | ek | Encapsulation key bytes (polynomial vector portion). |
| [in] | p | ML-KEM parameter set. |
| CX_OK | ek is valid |
| CX_INVALID_PARAMETER | ek is not valid. |
Definition at line 71 of file cx_mlkem_util.c.
| void MLKEM_UTIL_ct_cmov | ( | uint8_t * | dst, |
| const uint8_t * | src, | ||
| size_t | len, | ||
| uint8_t | b | ||
| ) |
Definition at line 63 of file cx_mlkem_util.c.
| void MLKEM_UTIL_hash_g | ( | uint8_t * | out, |
| const uint8_t * | in, | ||
| size_t | in_len | ||
| ) |
Computes the G hash function (SHA3-512) as defined in FIPS 203.
| [out] | out | Output buffer of at least 64 bytes. |
| [in] | in | Input data to hash. |
| [in] | in_len | Length of the input data in bytes. |
Definition at line 35 of file cx_mlkem_util.c.
| void MLKEM_UTIL_hash_h | ( | uint8_t | out[CX_SHA3_256_SIZE], |
| const uint8_t * | in, | ||
| size_t | in_len | ||
| ) |
Computes the H hash function (SHA3-256) as defined in FIPS 203.
| [out] | out | Output buffer of size CX_SHA3_256_SIZE bytes. |
| [in] | in | Input data to hash. |
| [in] | in_len | Length of the input data in bytes. |
Definition at line 30 of file cx_mlkem_util.c.
| void MLKEM_UTIL_hash_j | ( | uint8_t * | out, |
| const uint8_t * | in, | ||
| size_t | inlen | ||
| ) |
Definition at line 40 of file cx_mlkem_util.c.
| void MLKEM_UTIL_prf | ( | uint8_t * | out, |
| size_t | outlen, | ||
| const uint8_t * | key, | ||
| uint8_t | nonce | ||
| ) |
Computes the PRF function (SHAKE256) as defined in FIPS 203.
| [out] | out | Output buffer. |
| [in] | outlen | Number of bytes to produce. |
| [in] | key | Input key of MLKEM_SYMBYTES bytes. |
| [in] | nonce | Single-byte nonce appended to the key. |
Definition at line 45 of file cx_mlkem_util.c.
| void MLKEM_UTIL_xof_squeeze | ( | uint8_t * | out, |
| size_t | outlen, | ||
| const uint8_t * | seed, | ||
| uint8_t | x, | ||
| uint8_t | y | ||
| ) |
Computes the XOF function (SHAKE128) as defined in FIPS 203.
| [out] | out | Output buffer. |
| [in] | outlen | Number of bytes to produce. |
| [in] | seed | Input seed of MLKEM_SYMBYTES bytes. |
| [in] | x | First index byte appended to the seed. |
| [in] | y | Second index byte appended to the seed. |
Definition at line 54 of file cx_mlkem_util.c.