summaryrefslogtreecommitdiffabout
path: root/pwmanager/libcrypt/crypt/types.h
Unidiff
Diffstat (limited to 'pwmanager/libcrypt/crypt/types.h') (more/less context) (show whitespace changes)
-rw-r--r--pwmanager/libcrypt/crypt/types.h124
1 files changed, 124 insertions, 0 deletions
diff --git a/pwmanager/libcrypt/crypt/types.h b/pwmanager/libcrypt/crypt/types.h
new file mode 100644
index 0000000..c3a9d93
--- a/dev/null
+++ b/pwmanager/libcrypt/crypt/types.h
@@ -0,0 +1,124 @@
1/* types.h - some common typedefs
2 *Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
3 *
4 * This file is part of Libgcrypt.
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef GCRYPT_TYPES_H
22#define GCRYPT_TYPES_H
23
24
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
30#endif
31#if !SIZEOF_UNSIGNED_INT
32#undef SIZEOF_UNSIGNED_INT
33#define SIZEOF_UNSIGNED_INT 4
34#endif
35#if !SIZEOF_UNSIGNED_LONG
36#undef SIZEOF_UNSIGNED_LONG
37#define SIZEOF_UNSIGNED_LONG 4
38#endif
39
40
41#include <sys/types.h>
42
43
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
48#endif
49
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
54#endif
55
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
60#endif
61
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;
68#else
69#error no typedef for u16
70#endif
71#define HAVE_U16_TYPEDEF
72#endif
73
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;
80#else
81#error no typedef for u32
82#endif
83#define HAVE_U32_TYPEDEF
84#endif
85
86/****************
87 * Warning: Some systems segfault when this u64 typedef and
88 * the dummy code in cipher/md.c is not available. Examples are
89 * Solaris and IRIX.
90 */
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 U64_C(c) (c ## U)
96#define HAVE_U64_TYPEDEF
97#elif SIZEOF_UNSIGNED_LONG == 8
98 typedef unsigned long u64;
99#define U64_C(c) (c ## UL)
100#define HAVE_U64_TYPEDEF
101#elif SIZEOF_UNSIGNED_LONG_LONG == 8
102 typedef unsigned long long u64;
103#define U64_C(c) (c ## ULL)
104#define HAVE_U64_TYPEDEF
105#elif SIZEOF_UINT64_T == 8
106 typedef uint64_t u64;
107#define U64_C(c) (UINT64_C(c))
108#define HAVE_U64_TYPEDEF
109#endif
110#endif
111
112typedef union {
113 int a;
114 short b;
115 char c[1];
116 long d;
117#ifdef HAVE_U64_TYPEDEF
118 u64 e;
119#endif
120 float f;
121 double g;
122} PROPERLY_ALIGNED_TYPE;
123
124#endif /*GCRYPT_TYPES_H*/