Initialize Tizen 2.3
[external/nettle.git] / nettle-internal.h
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 128
49 #define NETTLE_MAX_HASH_DIGEST_SIZE 64
50 #define NETTLE_MAX_SEXP_ASSOC 17
51 #define NETTLE_MAX_CIPHER_BLOCK_SIZE 32
52
53 /* Doesn't quite fit with the other algorithms, because of the weak
54  * keys. Weak keys are not reported, the functions will simply crash
55  * if you try to use a weak key. */
56
57 extern const struct nettle_cipher nettle_des;
58 extern const struct nettle_cipher nettle_des3;
59
60 extern const struct nettle_cipher nettle_blowfish128;
61
62 /* Glue to openssl, for comparative benchmarking. The corresponding
63  * code is not included in the nettle library, as that would make the
64  * shared library depend on openssl. Instead, look at
65  * examples/nettle-openssl.c. */
66 extern const struct nettle_cipher nettle_openssl_aes128;
67 extern const struct nettle_cipher nettle_openssl_aes192;
68 extern const struct nettle_cipher nettle_openssl_aes256;
69 extern const struct nettle_cipher nettle_openssl_arcfour128;
70 extern const struct nettle_cipher nettle_openssl_blowfish128;
71 extern const struct nettle_cipher nettle_openssl_des;
72 extern const struct nettle_cipher nettle_openssl_cast128;
73
74 extern const struct nettle_hash nettle_openssl_md5;
75 extern const struct nettle_hash nettle_openssl_sha1;
76
77 #endif /* NETTLE_INTERNAL_H_INCLUDED */