testutils.c: Fix high bits of the mpz_urandomb used with mini-gmp.
[gd/nettle] / arctwo-meta.c
1 /* arctwo-meta.c
2
3    Copyright (C) 2004 Simon Josefsson
4    Copyright (C) 2014 Niels Möller
5
6    This file is part of GNU Nettle.
7
8    GNU Nettle is free software: you can redistribute it and/or
9    modify it under the terms of either:
10
11      * the GNU Lesser General Public License as published by the Free
12        Software Foundation; either version 3 of the License, or (at your
13        option) any later version.
14
15    or
16
17      * the GNU General Public License as published by the Free
18        Software Foundation; either version 2 of the License, or (at your
19        option) any later version.
20
21    or both in parallel, as here.
22
23    GNU Nettle is distributed in the hope that it will be useful,
24    but WITHOUT ANY WARRANTY; without even the implied warranty of
25    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26    General Public License for more details.
27
28    You should have received copies of the GNU General Public License and
29    the GNU Lesser General Public License along with this program.  If
30    not, see http://www.gnu.org/licenses/.
31 */
32
33 #if HAVE_CONFIG_H
34 # include "config.h"
35 #endif
36
37 #include "nettle-meta.h"
38
39 #include "arctwo.h"
40
41 #define ARCTWO(bits) {                                  \
42   "arctwo" #bits, sizeof (struct arctwo_ctx),           \
43   ARCTWO_BLOCK_SIZE, bits/8,                            \
44   (nettle_set_key_func *) arctwo ## bits ## _set_key,   \
45   (nettle_set_key_func *) arctwo ## bits ## _set_key,   \
46   (nettle_cipher_func *) arctwo_encrypt,                        \
47   (nettle_cipher_func *) arctwo_decrypt,                        \
48 }
49 const struct nettle_cipher nettle_arctwo40
50 = ARCTWO(40);
51 const struct nettle_cipher nettle_arctwo64
52 = ARCTWO(64);
53 const struct nettle_cipher nettle_arctwo128
54 = ARCTWO(128);
55
56 /* Gutmann variant. */
57 const struct nettle_cipher nettle_arctwo_gutmann128 =
58   {
59     "arctwo_gutmann128", sizeof (struct arctwo_ctx),
60     ARCTWO_BLOCK_SIZE, 16,
61     (nettle_set_key_func *) arctwo128_set_key_gutmann,
62     (nettle_set_key_func *) arctwo128_set_key_gutmann,
63     (nettle_cipher_func *) arctwo_encrypt,
64     (nettle_cipher_func *) arctwo_decrypt,
65   };