38 cx_err_t error = CX_INTERNAL_ERROR;
40 if ((pk == NULL) || (sk == NULL)) {
41 error = CX_INVALID_PARAMETER;
46 error = CX_INVALID_PARAMETER_VALUE;
53 error = CX_INVALID_PARAMETER;
57 if ((pk_len < p->pk_bytes) || (sk_len < p->sk_bytes)) {
58 error = CX_INVALID_PARAMETER_SIZE;
63 error = CX_INVALID_PARAMETER_SIZE;
86 cx_err_t error = CX_INTERNAL_ERROR;
90 if ((ct == NULL) || (ss == NULL) || (pk == NULL)) {
91 error = CX_INVALID_PARAMETER;
96 error = CX_INVALID_PARAMETER_VALUE;
103 error = CX_INVALID_PARAMETER;
107 if ((pk_len < p->pk_bytes) || (ct_len < p->ct_bytes)) {
108 error = CX_INVALID_PARAMETER_SIZE;
123 error = CX_INVALID_PARAMETER_SIZE;
130 explicit_bzero(buf,
sizeof(buf));
131 explicit_bzero(kr,
sizeof(kr));
cx_err_t MLKEM_INDCPA_keypair_derand(uint8_t *pk, size_t pk_len, uint8_t *sk, size_t sk_len, const uint8_t coins[2 *MLKEM_SYMBYTES], const MLKEM_param_info_t *p)
cx_err_t MLKEM_INDCPA_enc(uint8_t *c, size_t c_len, const uint8_t *m, size_t m_len, const uint8_t *pk, size_t pk_len, const uint8_t coins[2 *MLKEM_SYMBYTES], const MLKEM_param_info_t *p)
cx_err_t MLKEM_crypto_kem_enc_derand(uint8_t *ct, size_t ct_len, uint8_t *ss, size_t ss_len, const uint8_t *pk, size_t pk_len, const uint8_t coins[2 *MLKEM_SYMBYTES], MLKEM_param_t param)
Deterministic ML-KEM encapsulation.
cx_err_t MLKEM_crypto_kem_keypair_derand(uint8_t *pk, size_t pk_len, uint8_t *sk, size_t sk_len, const uint8_t coins[2 *MLKEM_SYMBYTES], MLKEM_param_t param)
Deterministic ML-KEM key pair generation.
Internal ML-KEM deterministic routines (not part of the public API).
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_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).
enum MLKEM_param_e MLKEM_param_t
ML-KEM parameter set selector.
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 parameter set descriptor holding all derived sizes.