Debian Codegraph @

cipher/mceliece6688128f.h

raw
1 /* mceliece6688128f.h - Classic McEliece for libgcrypt
2 * Copyright (C) 2023-2024 Simon Josefsson <[email protected]>
3 *
4 * This file is part of Libgcrypt.
5 *
6 * Libgcrypt is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
10 *
11 * Libgcrypt is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, see <https://www.gnu.org/licenses/>.
18 * SPDX-License-Identifier: LGPL-2.1-or-later
19 *
20 */
21
22 #ifndef MCELIECE6688128F_H
23 #define MCELIECE6688128F_H
24
25 #include <string.h>
26 #include <stdint.h>
27
28 #ifdef _GCRYPT_IN_LIBGCRYPT
29 /**** Start of the glue code to libgcrypt ****/
30 #include "g10lib.h" /* for GCC_ATTR_UNUSED */
31 #include "gcrypt-int.h"
32
33 #define MCELIECE6688128F_KEYPAIR_STACK_BURN (360 * 1024)
34 #define MCELIECE6688128F_ENC_STACK_BURN (9 * 1024)
35 #define MCELIECE6688128F_DEC_STACK_BURN (80 * 1024)
36
37 #define mceliece6688128f_keypair _gcry_mceliece6688128f_keypair
38 #define mceliece6688128f_enc _gcry_mceliece6688128f_enc
39 #define mceliece6688128f_dec _gcry_mceliece6688128f_dec
40 /**** End of the glue code ****/
41 #else
42 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 5 )
43 #define GCC_ATTR_UNUSED __attribute__ ((unused))
44 #else
45 #define GCC_ATTR_UNUSED
46 #endif
47
48 #define MCELIECE6688128F_SECRETKEY_SIZE 13932
49 #define MCELIECE6688128F_PUBLICKEY_SIZE 1044992
50 #define MCELIECE6688128F_CIPHERTEXT_SIZE 208
51 #define MCELIECE6688128F_SIZE 32
52 #endif
53
54 typedef void mceliece6688128f_random_func (void *ctx,
55 size_t length,
56 uint8_t *dst);
57
58 void
59 mceliece6688128f_keypair (uint8_t *pk, uint8_t *sk);
60
61 void
62 mceliece6688128f_enc (uint8_t *c, uint8_t *k, const uint8_t *pk);
63
64 void
65 mceliece6688128f_dec (uint8_t *k, const uint8_t *c, const uint8_t *sk);
66
67 #endif /* MCELIECE6688128F_H */