1 /* types.h - some common typedefs
2 * Copyright (C) 1998, 2000, 2002 Free Software Foundation, Inc.
4 * This file is part of Libgcrypt.
6 * Libgcrypt is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser general Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * Libgcrypt is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifndef GCRYPT_TYPES_H
22 #define GCRYPT_TYPES_H
25 /* The AC_CHECK_SIZEOF() in configure fails for some machines.
26 * we provide some fallback values here */
27 #if !SIZEOF_UNSIGNED_SHORT
28 #undef SIZEOF_UNSIGNED_SHORT
29 #define SIZEOF_UNSIGNED_SHORT 2
31 #if !SIZEOF_UNSIGNED_INT
32 #undef SIZEOF_UNSIGNED_INT
33 #define SIZEOF_UNSIGNED_INT 4
35 #if !SIZEOF_UNSIGNED_LONG
36 #undef SIZEOF_UNSIGNED_LONG
37 #define SIZEOF_UNSIGNED_LONG 4
41 #include <sys/types.h>
44 #ifndef HAVE_BYTE_TYPEDEF
45 #undef byte /* maybe there is a macro with this name */
46 typedef unsigned char byte;
47 #define HAVE_BYTE_TYPEDEF
50 #ifndef HAVE_USHORT_TYPEDEF
51 #undef ushort /* maybe there is a macro with this name */
52 typedef unsigned short ushort;
53 #define HAVE_USHORT_TYPEDEF
56 #ifndef HAVE_ULONG_TYPEDEF
57 #undef ulong /* maybe there is a macro with this name */
58 typedef unsigned long ulong;
59 #define HAVE_ULONG_TYPEDEF
62 #ifndef HAVE_U16_TYPEDEF
63 #undef u16 /* maybe there is a macro with this name */
64 #if SIZEOF_UNSIGNED_INT == 2
65 typedef unsigned int u16;
66 #elif SIZEOF_UNSIGNED_SHORT == 2
67 typedef unsigned short u16;
69 #error no typedef for u16
71 #define HAVE_U16_TYPEDEF
74 #ifndef HAVE_U32_TYPEDEF
75 #undef u32 /* maybe there is a macro with this name */
76 #if SIZEOF_UNSIGNED_INT == 4
77 typedef unsigned int u32;
78 #elif SIZEOF_UNSIGNED_LONG == 4
79 typedef unsigned long u32;
81 #error no typedef for u32
83 #define HAVE_U32_TYPEDEF
87 * Warning: Some systems segfault when this u64 typedef and
88 * the dummy code in cipher/md.c is not available. Examples are
91 #ifndef HAVE_U64_TYPEDEF
92 #undef u64 /* maybe there is a macro with this name */
93 #if SIZEOF_UNSIGNED_INT == 8
94 typedef unsigned int u64;
95 #define HAVE_U64_TYPEDEF
96 #elif SIZEOF_UNSIGNED_LONG == 8
97 typedef unsigned long u64;
98 #define HAVE_U64_TYPEDEF
99 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
100 typedef unsigned long long u64;
101 #define HAVE_U64_TYPEDEF
110 #ifdef HAVE_U64_TYPEDEF
115 } PROPERLY_ALIGNED_TYPE;
117 typedef struct string_list {
118 struct string_list *next;
124 #endif /*GCRYPT_TYPES_H*/