Rizin
unix-like reverse engineering framework and cli tools
nettle-types.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2005, 2014 Niels Möller
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 /* nettle-types.h
5 
6  Copyright (C) 2005, 2014 Niels Möller
7 
8  This file is part of GNU Nettle.
9 
10  GNU Nettle is free software: you can redistribute it and/or
11  modify it under the terms of either:
12 
13  * the GNU Lesser General Public License as published by the Free
14  Software Foundation; either version 3 of the License, or (at your
15  option) any later version.
16 
17  or
18 
19  * the GNU General Public License as published by the Free
20  Software Foundation; either version 2 of the License, or (at your
21  option) any later version.
22 
23  or both in parallel, as here.
24 
25  GNU Nettle is distributed in the hope that it will be useful,
26  but WITHOUT ANY WARRANTY; without even the implied warranty of
27  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  General Public License for more details.
29 
30  You should have received copies of the GNU General Public License and
31  the GNU Lesser General Public License along with this program. If
32  not, see http://www.gnu.org/licenses/.
33 */
34 
35 #ifndef NETTLE_TYPES_H
36 #define NETTLE_TYPES_H
37 
38 /* For size_t */
39 #include <stddef.h>
40 #include <stdint.h>
41 
42 /* Attributes we want to use in installed header files, and hence
43  can't rely on config.h. */
44 #ifdef __GNUC__
45 
46 #define _NETTLE_ATTRIBUTE_PURE __attribute__((pure))
47 #ifndef _NETTLE_ATTRIBUTE_DEPRECATED
48 /* Variant without message is supported since gcc-3.1 or so. */
49 #define _NETTLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
50 #endif
51 
52 #else /* !__GNUC__ */
53 
54 #define _NETTLE_ATTRIBUTE_PURE
55 #define _NETTLE_ATTRIBUTE_DEPRECATED
56 
57 #endif /* !__GNUC__ */
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /* An aligned 16-byte block. */
65 {
66  uint8_t b[16];
67  unsigned long w[16 / sizeof(unsigned long)] _NETTLE_ATTRIBUTE_DEPRECATED;
69 };
70 
72 {
73  uint8_t b[8];
75 };
76 
77 /* Randomness. Used by key generation and dsa signature creation. */
78 typedef void nettle_random_func(void *ctx,
79  size_t length, uint8_t *dst);
80 
81 /* Progress report function, mainly for key generation. */
82 typedef void nettle_progress_func(void *ctx, int c);
83 
84 /* Realloc function, used by struct nettle_buffer. */
85 typedef void *nettle_realloc_func(void *ctx, void *p, size_t length);
86 
87 /* Ciphers */
88 typedef void nettle_set_key_func(void *ctx, const uint8_t *key);
89 
90 /* For block ciphers, const context. */
91 typedef void nettle_cipher_func(const void *ctx,
92  size_t length, uint8_t *dst,
93  const uint8_t *src);
94 
95 
96 /* Uses a void * for cipher contexts. Used for crypt operations where
97  the internal state changes during the encryption. */
98 typedef void nettle_crypt_func(void *ctx,
99  size_t length, uint8_t *dst,
100  const uint8_t *src);
101 
102 /* Hash algorithms */
103 typedef void nettle_hash_init_func(void *ctx);
104 typedef void nettle_hash_update_func(void *ctx,
105  size_t length,
106  const uint8_t *src);
107 typedef void nettle_hash_digest_func(void *ctx,
108  size_t length, uint8_t *dst);
109 
110 /* ASCII armor codecs. NOTE: Experimental and subject to change. */
111 
112 typedef size_t nettle_armor_length_func(size_t length);
113 typedef void nettle_armor_init_func(void *ctx);
114 
116  char *dst,
117  size_t src_length,
118  const uint8_t *src);
119 
120 typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst);
121 
123  size_t *dst_length,
124  uint8_t *dst,
125  size_t src_length,
126  const char *src);
127 
129 
130 #ifdef __cplusplus
131 }
132 #endif
133 
134 #endif /* NETTLE_TYPES_H */
lzma_index * src
Definition: index.h:567
#define w
Definition: crypto_rc6.c:13
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
Definition: sflib.h:118
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
Definition: sflib.h:79
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
Definition: sflib.h:133
void * p
Definition: libc.cpp:67
char * dst
Definition: lz4.h:724
void nettle_random_func(void *ctx, size_t length, uint8_t *dst)
Definition: nettle-types.h:78
size_t nettle_armor_encode_final_func(void *ctx, char *dst)
Definition: nettle-types.h:120
void nettle_crypt_func(void *ctx, size_t length, uint8_t *dst, const uint8_t *src)
Definition: nettle-types.h:98
void nettle_hash_digest_func(void *ctx, size_t length, uint8_t *dst)
Definition: nettle-types.h:107
int nettle_armor_decode_update_func(void *ctx, size_t *dst_length, uint8_t *dst, size_t src_length, const char *src)
Definition: nettle-types.h:122
void nettle_armor_init_func(void *ctx)
Definition: nettle-types.h:113
size_t nettle_armor_encode_update_func(void *ctx, char *dst, size_t src_length, const uint8_t *src)
Definition: nettle-types.h:115
void nettle_hash_update_func(void *ctx, size_t length, const uint8_t *src)
Definition: nettle-types.h:104
void * nettle_realloc_func(void *ctx, void *p, size_t length)
Definition: nettle-types.h:85
void nettle_cipher_func(const void *ctx, size_t length, uint8_t *dst, const uint8_t *src)
Definition: nettle-types.h:91
void nettle_hash_init_func(void *ctx)
Definition: nettle-types.h:103
void nettle_set_key_func(void *ctx, const uint8_t *key)
Definition: nettle-types.h:88
size_t nettle_armor_length_func(size_t length)
Definition: nettle-types.h:112
void nettle_progress_func(void *ctx, int c)
Definition: nettle-types.h:82
int nettle_armor_decode_final_func(void *ctx)
Definition: nettle-types.h:128
unsigned long uint64_t
Definition: sftypes.h:28
unsigned char uint8_t
Definition: sftypes.h:31
#define c(i)
Definition: sha256.c:43
uint8_t b[16]
Definition: nettle-types.h:66
uint64_t u64[2]
Definition: nettle-types.h:68
unsigned long w[16/sizeof(unsigned long)] _NETTLE_ATTRIBUTE_DEPRECATED
Definition: nettle-types.h:67
uint64_t u64
Definition: nettle-types.h:74
uint8_t b[8]
Definition: nettle-types.h:73