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
39 /* Attributes we want to use in installed header files, and hence
40 can't rely on config.h. */
43 #define _NETTLE_ATTRIBUTE_PURE __attribute__((pure))
44 #ifndef _NETTLE_ATTRIBUTE_DEPRECATED
45 /* Variant without message is supported since gcc-3.1 or so. */
46 #define _NETTLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
51 #define _NETTLE_ATTRIBUTE_PURE
52 #define _NETTLE_ATTRIBUTE_DEPRECATED
54 #endif /* !__GNUC__ */
60 /* An aligned 16-byte block. */
64 unsigned long w[16 / sizeof(unsigned long)] _NETTLE_ATTRIBUTE_DEPRECATED;
74 /* Randomness. Used by key generation and dsa signature creation. */
75 typedef void nettle_random_func(void *ctx,
76 size_t length, uint8_t *dst);
78 /* Progress report function, mainly for key generation. */
79 typedef void nettle_progress_func(void *ctx, int c);
81 /* Realloc function, used by struct nettle_buffer. */
82 typedef void *nettle_realloc_func(void *ctx, void *p, size_t length);
85 typedef void nettle_set_key_func(void *ctx, const uint8_t *key);
87 /* For block ciphers, const context. */
88 typedef void nettle_cipher_func(const void *ctx,
89 size_t length, uint8_t *dst,
93 /* Uses a void * for cipher contexts. Used for crypt operations where
94 the internal state changes during the encryption. */
95 typedef void nettle_crypt_func(void *ctx,
96 size_t length, uint8_t *dst,
100 typedef void nettle_hash_init_func(void *ctx);
101 typedef void nettle_hash_update_func(void *ctx,
104 typedef void nettle_hash_digest_func(void *ctx,
105 size_t length, uint8_t *dst);
107 /* ASCII armor codecs. NOTE: Experimental and subject to change. */
109 typedef size_t nettle_armor_length_func(size_t length);
110 typedef void nettle_armor_init_func(void *ctx);
112 typedef size_t nettle_armor_encode_update_func(void *ctx,
117 typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst);
119 typedef int nettle_armor_decode_update_func(void *ctx,
125 typedef int nettle_armor_decode_final_func(void *ctx);
131 #endif /* NETTLE_TYPES_H */