libssh 0.12.0
The SSH library
Loading...
Searching...
No Matches
mlkem_native.h
1/*
2 * This file is part of the SSH Library
3 *
4 * Copyright (c) 2025 by Red Hat, Inc.
5 *
6 * Author: Jakub Jelen <jjelen@redhat.com>
7 *
8 * The SSH Library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, version 2.1 of the License.
11 *
12 * The SSH Library is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with the SSH Library; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20 * MA 02111-1307, USA.
21 */
22
23#ifndef MLKEM_NATIVE_H_
24#define MLKEM_NATIVE_H_
25
26#include <stdbool.h>
27#include <stddef.h>
28#include <stdint.h>
29#include <stdlib.h>
30#include <string.h>
31
32#include "config.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
44 uint8_t value[2400U];
45} libcrux_ml_kem_types_MlKemPrivateKey_d9;
46
53 uint8_t value[1184U];
54} libcrux_ml_kem_types_MlKemPublicKey_30;
55
57 libcrux_ml_kem_types_MlKemPrivateKey_d9 sk;
58 libcrux_ml_kem_types_MlKemPublicKey_30 pk;
59} libcrux_ml_kem_mlkem768_MlKem768KeyPair;
60
62 uint8_t value[1088U];
63} libcrux_ml_kem_mlkem768_MlKem768Ciphertext;
64
71typedef struct tuple_c2_s {
72 libcrux_ml_kem_mlkem768_MlKem768Ciphertext fst;
73 uint8_t snd[32U];
74} tuple_c2;
75
79libcrux_ml_kem_mlkem768_MlKem768KeyPair
80libcrux_ml_kem_mlkem768_portable_generate_key_pair(uint8_t randomness[64U]);
81
87bool libcrux_ml_kem_mlkem768_portable_validate_public_key(
88 libcrux_ml_kem_types_MlKemPublicKey_30 *public_key);
89
97tuple_c2 libcrux_ml_kem_mlkem768_portable_encapsulate(
98 libcrux_ml_kem_types_MlKemPublicKey_30 *public_key,
99 uint8_t randomness[32U]);
100
108void libcrux_ml_kem_mlkem768_portable_decapsulate(
109 libcrux_ml_kem_types_MlKemPrivateKey_d9 *private_key,
110 libcrux_ml_kem_mlkem768_MlKem768Ciphertext *ciphertext,
111 uint8_t ret[32U]);
112
113/* rename some types to be a bit more ergonomic */
114#define libcrux_mlkem768_keypair libcrux_ml_kem_mlkem768_MlKem768KeyPair_s
115#define libcrux_mlkem768_pk libcrux_ml_kem_types_MlKemPublicKey_30_s
116#define libcrux_mlkem768_sk libcrux_ml_kem_types_MlKemPrivateKey_d9_s
117#define libcrux_mlkem768_ciphertext libcrux_ml_kem_mlkem768_MlKem768Ciphertext_s
118#define libcrux_mlkem768_enc_result tuple_c2_s
119/* defines for PRNG inputs */
120#define LIBCRUX_ML_KEM_KEY_PAIR_PRNG_LEN 64U
121#define LIBCRUX_ML_KEM_ENC_PRNG_LEN 32
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* MLKEM_NATIVE_H_ */
Definition mlkem_native.h:56
Definition mlkem_native.h:43
Definition mlkem_native.h:52
Definition mlkem_native.h:71