3 Copyright (C) 2005, 2014 Niels Möller
5 This file is part of GNU Nettle.
7 GNU Nettle is free software: you can redistribute it and/or
8 modify it under the terms of either:
10 * the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 3 of the License, or (at your
12 option) any later version.
16 * the GNU General Public License as published by the Free
17 Software Foundation; either version 2 of the License, or (at your
18 option) any later version.
20 or both in parallel, as here.
22 GNU Nettle is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 General Public License for more details.
27 You should have received copies of the GNU General Public License and
28 the GNU Lesser General Public License along with this program. If
29 not, see http://www.gnu.org/licenses/.
32 #ifndef NETTLE_TYPES_H
33 #define NETTLE_TYPES_H
38 /* Pretend these types always exists. Nettle doesn't use them. */
39 #define _STDINT_HAVE_INT_FAST32_T 1
40 #include "nettle-stdint.h"
46 /* An aligned 16-byte block. */
50 unsigned long w[16 / sizeof(unsigned long)];
54 /* Randomness. Used by key generation and dsa signature creation. */
55 typedef void nettle_random_func(void *ctx,
56 size_t length, uint8_t *dst);
58 /* Progress report function, mainly for key generation. */
59 typedef void nettle_progress_func(void *ctx, int c);
61 /* Realloc function, used by struct nettle_buffer. */
62 typedef void *nettle_realloc_func(void *ctx, void *p, size_t length);
65 typedef void nettle_set_key_func(void *ctx, const uint8_t *key);
67 /* For block ciphers, const context. */
68 typedef void nettle_cipher_func(const void *ctx,
69 size_t length, uint8_t *dst,
73 /* Uses a void * for cipher contexts. Used for crypt operations where
74 the internal state changes during the encryption. */
75 typedef void nettle_crypt_func(void *ctx,
76 size_t length, uint8_t *dst,
80 typedef void nettle_hash_init_func(void *ctx);
81 typedef void nettle_hash_update_func(void *ctx,
84 typedef void nettle_hash_digest_func(void *ctx,
85 size_t length, uint8_t *dst);
87 /* ASCII armor codecs. NOTE: Experimental and subject to change. */
89 typedef size_t nettle_armor_length_func(size_t length);
90 typedef void nettle_armor_init_func(void *ctx);
92 typedef size_t nettle_armor_encode_update_func(void *ctx,
97 typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst);
99 typedef int nettle_armor_decode_update_func(void *ctx,
105 typedef int nettle_armor_decode_final_func(void *ctx);
111 #endif /* NETTLE_TYPES_H */