Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/nettle/nettle-types.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* nettle-types.h
0002 
0003    Copyright (C) 2005, 2014 Niels Möller
0004 
0005    This file is part of GNU Nettle.
0006 
0007    GNU Nettle is free software: you can redistribute it and/or
0008    modify it under the terms of either:
0009 
0010      * the GNU Lesser General Public License as published by the Free
0011        Software Foundation; either version 3 of the License, or (at your
0012        option) any later version.
0013 
0014    or
0015 
0016      * the GNU General Public License as published by the Free
0017        Software Foundation; either version 2 of the License, or (at your
0018        option) any later version.
0019 
0020    or both in parallel, as here.
0021 
0022    GNU Nettle is distributed in the hope that it will be useful,
0023    but WITHOUT ANY WARRANTY; without even the implied warranty of
0024    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025    General Public License for more details.
0026 
0027    You should have received copies of the GNU General Public License and
0028    the GNU Lesser General Public License along with this program.  If
0029    not, see http://www.gnu.org/licenses/.
0030 */
0031 
0032 #ifndef NETTLE_TYPES_H
0033 #define NETTLE_TYPES_H
0034 
0035 /* For size_t */
0036 #include <stddef.h>
0037 #include <stdint.h>
0038 
0039 /* Attributes we want to use in installed header files, and hence
0040    can't rely on config.h. */
0041 #ifdef __GNUC__
0042 
0043 #define _NETTLE_ATTRIBUTE_PURE __attribute__((pure))
0044 #ifndef _NETTLE_ATTRIBUTE_DEPRECATED
0045 /* Variant without message is supported since gcc-3.1 or so. */
0046 #define _NETTLE_ATTRIBUTE_DEPRECATED __attribute__((deprecated))
0047 #endif
0048 
0049 #else /* !__GNUC__ */
0050 
0051 #define _NETTLE_ATTRIBUTE_PURE
0052 #define _NETTLE_ATTRIBUTE_DEPRECATED
0053 
0054 #endif /* !__GNUC__ */
0055 
0056 #ifdef __cplusplus
0057 extern "C" {
0058 #endif
0059 
0060 /* An aligned 16-byte block. */
0061 union nettle_block16
0062 {
0063   uint8_t b[16];
0064   unsigned long w[16 / sizeof(unsigned long)] _NETTLE_ATTRIBUTE_DEPRECATED;
0065   uint64_t u64[2];
0066 };
0067 
0068 union nettle_block8
0069 {
0070   uint8_t b[8];
0071   uint64_t u64;
0072 };
0073 
0074 /* Randomness. Used by key generation and dsa signature creation. */
0075 typedef void nettle_random_func(void *ctx,
0076                 size_t length, uint8_t *dst);
0077 
0078 /* Progress report function, mainly for key generation. */
0079 typedef void nettle_progress_func(void *ctx, int c);
0080 
0081 /* Realloc function, used by struct nettle_buffer. */
0082 typedef void *nettle_realloc_func(void *ctx, void *p, size_t length);
0083 
0084 /* Ciphers */
0085 typedef void nettle_set_key_func(void *ctx, const uint8_t *key);
0086 
0087 /* For block ciphers, const context. */
0088 typedef void nettle_cipher_func(const void *ctx,
0089                 size_t length, uint8_t *dst,
0090                 const uint8_t *src);
0091 
0092 
0093 /* Uses a void * for cipher contexts. Used for crypt operations where
0094    the internal state changes during the encryption. */
0095 typedef void nettle_crypt_func(void *ctx,
0096                    size_t length, uint8_t *dst,
0097                    const uint8_t *src);
0098 
0099 /* Hash algorithms */
0100 typedef void nettle_hash_init_func(void *ctx);
0101 typedef void nettle_hash_update_func(void *ctx,
0102                      size_t length,
0103                      const uint8_t *src);
0104 typedef void nettle_hash_digest_func(void *ctx,
0105                      size_t length, uint8_t *dst);
0106 
0107 /* ASCII armor codecs. NOTE: Experimental and subject to change. */
0108 
0109 typedef size_t nettle_armor_length_func(size_t length);
0110 typedef void nettle_armor_init_func(void *ctx);
0111 
0112 typedef size_t nettle_armor_encode_update_func(void *ctx,
0113                            char *dst,
0114                            size_t src_length,
0115                            const uint8_t *src);
0116 
0117 typedef size_t nettle_armor_encode_final_func(void *ctx, char *dst);
0118 
0119 typedef int nettle_armor_decode_update_func(void *ctx,
0120                         size_t *dst_length,
0121                         uint8_t *dst,
0122                         size_t src_length,
0123                         const char *src);
0124 
0125 typedef int nettle_armor_decode_final_func(void *ctx);
0126 
0127 #ifdef __cplusplus
0128 }
0129 #endif
0130 
0131 #endif /* NETTLE_TYPES_H */