Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
nettle-internal.h
Go to the documentation of this file.
1 /* nettle-internal.h
2  *
3  * Things that are used only by the testsuite and benchmark, and
4  * subject to change.
5  */
6 
7 /* nettle, low-level cryptographics library
8  *
9  * Copyright (C) 2002 Niels Möller
10  *
11  * The nettle library is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation; either version 2.1 of the License, or (at your
14  * option) any later version.
15  *
16  * The nettle library is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
19  * License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with the nettle library; see the file COPYING.LIB. If not, write to
23  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
24  * MA 02111-1307, USA.
25  */
26 
27 #ifndef NETTLE_INTERNAL_H_INCLUDED
28 #define NETTLE_INTERNAL_H_INCLUDED
29 
30 #include "nettle-meta.h"
31 
32 /* Temporary allocation, for systems that don't support alloca. Note
33  * that the allocation requests should always be reasonably small, so
34  * that they can fit on the stack. For non-alloca systems, we use a
35  * fix maximum size, and abort if we ever need anything larger. */
36 
37 #if HAVE_ALLOCA
38 # define TMP_DECL(name, type, max) type *name
39 # define TMP_ALLOC(name, size) (name = alloca(sizeof (*name) * size))
40 #else /* !HAVE_ALLOCA */
41 # define TMP_DECL(name, type, max) type name[max]
42 # define TMP_ALLOC(name, size) \
43 do { if (size > (sizeof(name) / sizeof(name[0]))) abort(); } while (0)
44 #endif
45 
46 /* Arbitrary limits which apply to systems that don't have alloca */
47 #define NETTLE_MAX_BIGNUM_BITS 10000
48 #define NETTLE_MAX_HASH_BLOCK_SIZE 64
49 #define NETTLE_MAX_HASH_DIGEST_SIZE 32
50 #define NETTLE_MAX_SEXP_ASSOC 17
51 
52 /* Doesn't quite fit with the other algorithms, because of the weak
53  * keys. Weak keys are not reported, the functions will simply crash
54  * if you try to use a weak key. */
55 
56 extern const struct nettle_cipher nettle_des;
57 extern const struct nettle_cipher nettle_des3;
58 
59 extern const struct nettle_cipher nettle_blowfish128;
60 
61 /* Glue to openssl, for comparative benchmarking. The corresponding
62  * code is not included in the nettle library, as that would make the
63  * shared library depend on openssl. Instead, look at
64  * examples/nettle-openssl.c. */
65 extern const struct nettle_cipher nettle_openssl_blowfish128;
66 extern const struct nettle_cipher nettle_openssl_des;
67 extern const struct nettle_cipher nettle_openssl_cast128;
68 
69 #endif /* NETTLE_INTERNAL_H_INCLUDED */
70