Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mlkem_util.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2026 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#ifndef CX_MLKEM_UTIL_H
18#define CX_MLKEM_UTIL_H
19
20#include <stddef.h>
21#include <stdint.h>
22
23#include "cx_errors.h"
24#include "lcx_mlkem.h"
25#include "lcx_sha3.h"
26
34void MLKEM_UTIL_hash_h(uint8_t out[CX_SHA3_256_SIZE], const uint8_t *in, size_t in_len);
35
43void MLKEM_UTIL_hash_g(uint8_t *out, const uint8_t *in, size_t in_len);
44
45void MLKEM_UTIL_hash_j(uint8_t *out, const uint8_t *in, size_t inlen);
46
55void MLKEM_UTIL_prf(uint8_t *out, size_t outlen, const uint8_t *key, uint8_t nonce);
56
66void MLKEM_UTIL_xof_squeeze(uint8_t *out, size_t outlen, const uint8_t *seed, uint8_t x, uint8_t y);
67
68void MLKEM_UTIL_ct_cmov(uint8_t *dst, const uint8_t *src, size_t len, uint8_t b);
69
82cx_err_t MLKEM_UTIL_check_ek(const uint8_t *ek, const MLKEM_param_info_t *p);
83
84#endif // CX_MLKEM_UTIL_H
void MLKEM_UTIL_hash_j(uint8_t *out, const uint8_t *in, size_t inlen)
void MLKEM_UTIL_ct_cmov(uint8_t *dst, const uint8_t *src, size_t len, uint8_t b)
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_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_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.
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 (Module-Lattice Key Encapsulation Mechanism) public API.
SHA-3 (Secure Hash Algorithm 3)
ML-KEM parameter set descriptor holding all derived sizes.
Definition lcx_mlkem.h:168