raw
smg_comms_c_wrappers    1 /* types.h - some common typedefs
smg_comms_c_wrappers 2 * Modified by No Such Labs. (C) 2015. See README.
smg_comms_c_wrappers 3 *
smg_comms_c_wrappers 4 * This file was originally part of Gnu Privacy Guard (GPG), ver. 1.4.10,
smg_comms_c_wrappers 5 * SHA256(gnupg-1.4.10.tar.gz):
smg_comms_c_wrappers 6 * 0bfd74660a2f6cedcf7d8256db4a63c996ffebbcdc2cf54397bfb72878c5a85a
smg_comms_c_wrappers 7 * (C) 1994-2005 Free Software Foundation, Inc.
smg_comms_c_wrappers 8 *
smg_comms_c_wrappers 9 * This program is free software: you can redistribute it and/or modify
smg_comms_c_wrappers 10 * it under the terms of the GNU General Public License as published by
smg_comms_c_wrappers 11 * the Free Software Foundation, either version 3 of the License, or
smg_comms_c_wrappers 12 * (at your option) any later version.
smg_comms_c_wrappers 13 *
smg_comms_c_wrappers 14 * This program is distributed in the hope that it will be useful,
smg_comms_c_wrappers 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
smg_comms_c_wrappers 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
smg_comms_c_wrappers 17 * GNU General Public License for more details.
smg_comms_c_wrappers 18 *
smg_comms_c_wrappers 19 * You should have received a copy of the GNU General Public License
smg_comms_c_wrappers 20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
smg_comms_c_wrappers 21 */
smg_comms_c_wrappers 22
smg_comms_c_wrappers 23 #ifndef G10_TYPES_H
smg_comms_c_wrappers 24 #define G10_TYPES_H
smg_comms_c_wrappers 25
smg_comms_c_wrappers 26 #ifdef HAVE_INTTYPES_H
smg_comms_c_wrappers 27 /* For uint64_t */
smg_comms_c_wrappers 28 #include <inttypes.h>
smg_comms_c_wrappers 29 #endif
smg_comms_c_wrappers 30
smg_comms_c_wrappers 31 /* The AC_CHECK_SIZEOF() in configure fails for some machines.
smg_comms_c_wrappers 32 * we provide some fallback values here */
smg_comms_c_wrappers 33 #if !SIZEOF_UNSIGNED_SHORT
smg_comms_c_wrappers 34 #undef SIZEOF_UNSIGNED_SHORT
smg_comms_c_wrappers 35 #define SIZEOF_UNSIGNED_SHORT 2
smg_comms_c_wrappers 36 #endif
smg_comms_c_wrappers 37 #if !SIZEOF_UNSIGNED_INT
smg_comms_c_wrappers 38 #undef SIZEOF_UNSIGNED_INT
smg_comms_c_wrappers 39 #define SIZEOF_UNSIGNED_INT 4
smg_comms_c_wrappers 40 #endif
smg_comms_c_wrappers 41 #if !SIZEOF_UNSIGNED_LONG
smg_comms_c_wrappers 42 #undef SIZEOF_UNSIGNED_LONG
smg_comms_c_wrappers 43 #define SIZEOF_UNSIGNED_LONG 4
smg_comms_c_wrappers 44 #endif
smg_comms_c_wrappers 45
smg_comms_c_wrappers 46
smg_comms_c_wrappers 47 #include <sys/types.h>
smg_comms_c_wrappers 48
smg_comms_c_wrappers 49
smg_comms_c_wrappers 50 #ifndef HAVE_BYTE_TYPEDEF
smg_comms_c_wrappers 51 #undef byte /* maybe there is a macro with this name */
smg_comms_c_wrappers 52 typedef unsigned char byte;
smg_comms_c_wrappers 53 #define HAVE_BYTE_TYPEDEF
smg_comms_c_wrappers 54 #endif
smg_comms_c_wrappers 55
smg_comms_c_wrappers 56 #ifndef HAVE_USHORT_TYPEDEF
smg_comms_c_wrappers 57 #undef ushort /* maybe there is a macro with this name */
smg_comms_c_wrappers 58 typedef unsigned short ushort;
smg_comms_c_wrappers 59 #define HAVE_USHORT_TYPEDEF
smg_comms_c_wrappers 60 #endif
smg_comms_c_wrappers 61
smg_comms_c_wrappers 62 #ifndef HAVE_ULONG_TYPEDEF
smg_comms_c_wrappers 63 #undef ulong /* maybe there is a macro with this name */
smg_comms_c_wrappers 64 typedef unsigned long ulong;
smg_comms_c_wrappers 65 #define HAVE_ULONG_TYPEDEF
smg_comms_c_wrappers 66 #endif
smg_comms_c_wrappers 67
smg_comms_c_wrappers 68 #ifndef HAVE_U16_TYPEDEF
smg_comms_c_wrappers 69 #undef u16 /* maybe there is a macro with this name */
smg_comms_c_wrappers 70 #if SIZEOF_UNSIGNED_INT == 2
smg_comms_c_wrappers 71 typedef unsigned int u16;
smg_comms_c_wrappers 72 #elif SIZEOF_UNSIGNED_SHORT == 2
smg_comms_c_wrappers 73 typedef unsigned short u16;
smg_comms_c_wrappers 74 #else
smg_comms_c_wrappers 75 #error no typedef for u16
smg_comms_c_wrappers 76 #endif
smg_comms_c_wrappers 77 #define HAVE_U16_TYPEDEF
smg_comms_c_wrappers 78 #endif
smg_comms_c_wrappers 79
smg_comms_c_wrappers 80 #ifndef HAVE_U32_TYPEDEF
smg_comms_c_wrappers 81 #undef u32 /* maybe there is a macro with this name */
smg_comms_c_wrappers 82 #if SIZEOF_UNSIGNED_INT == 4
smg_comms_c_wrappers 83 typedef unsigned int u32;
smg_comms_c_wrappers 84 #elif SIZEOF_UNSIGNED_LONG == 4
smg_comms_c_wrappers 85 typedef unsigned long u32;
smg_comms_c_wrappers 86 #else
smg_comms_c_wrappers 87 #error no typedef for u32
smg_comms_c_wrappers 88 #endif
smg_comms_c_wrappers 89 #define HAVE_U32_TYPEDEF
smg_comms_c_wrappers 90 #endif
smg_comms_c_wrappers 91
smg_comms_c_wrappers 92 /****************
smg_comms_c_wrappers 93 * Warning: Some systems segfault when this u64 typedef and
smg_comms_c_wrappers 94 * the dummy code in cipher/md.c is not available. Examples are
smg_comms_c_wrappers 95 * Solaris and IRIX.
smg_comms_c_wrappers 96 */
smg_comms_c_wrappers 97 #ifndef HAVE_U64_TYPEDEF
smg_comms_c_wrappers 98 #undef u64 /* maybe there is a macro with this name */
smg_comms_c_wrappers 99 #if SIZEOF_UINT64_T == 8
smg_comms_c_wrappers 100 typedef uint64_t u64;
smg_comms_c_wrappers 101 #define U64_C(c) (UINT64_C(c))
smg_comms_c_wrappers 102 #define HAVE_U64_TYPEDEF
smg_comms_c_wrappers 103 #elif SIZEOF_UNSIGNED_INT == 8
smg_comms_c_wrappers 104 typedef unsigned int u64;
smg_comms_c_wrappers 105 #define U64_C(c) (c ## U)
smg_comms_c_wrappers 106 #define HAVE_U64_TYPEDEF
smg_comms_c_wrappers 107 #elif SIZEOF_UNSIGNED_LONG == 8
smg_comms_c_wrappers 108 typedef unsigned long u64;
smg_comms_c_wrappers 109 #define U64_C(c) (c ## UL)
smg_comms_c_wrappers 110 #define HAVE_U64_TYPEDEF
smg_comms_c_wrappers 111 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
smg_comms_c_wrappers 112 typedef unsigned long long u64;
smg_comms_c_wrappers 113 #define U64_C(c) (c ## ULL)
smg_comms_c_wrappers 114 #define HAVE_U64_TYPEDEF
smg_comms_c_wrappers 115 #endif
smg_comms_c_wrappers 116 #endif
smg_comms_c_wrappers 117
smg_comms_c_wrappers 118 typedef union {
smg_comms_c_wrappers 119 int a;
smg_comms_c_wrappers 120 short b;
smg_comms_c_wrappers 121 char c[1];
smg_comms_c_wrappers 122 long d;
smg_comms_c_wrappers 123 #ifdef HAVE_U64_TYPEDEF
smg_comms_c_wrappers 124 u64 e;
smg_comms_c_wrappers 125 #endif
smg_comms_c_wrappers 126 float f;
smg_comms_c_wrappers 127 double g;
smg_comms_c_wrappers 128 } PROPERLY_ALIGNED_TYPE;
smg_comms_c_wrappers 129
smg_comms_c_wrappers 130 struct string_list {
smg_comms_c_wrappers 131 struct string_list *next;
smg_comms_c_wrappers 132 unsigned int flags;
smg_comms_c_wrappers 133 char d[1];
smg_comms_c_wrappers 134 };
smg_comms_c_wrappers 135 typedef struct string_list *STRLIST;
smg_comms_c_wrappers 136 typedef struct string_list *strlist_t;
smg_comms_c_wrappers 137
smg_comms_c_wrappers 138 #endif /*G10_TYPES_H*/