1 #ifndef LIBDEFS_H 2 #define LIBDEFS_H 3 4 /* 5 {{{ includes 6 */ 7 8 9 #ifdef _MSC_VER /* _WIN32 */ 10 #include <windows.h> 11 #endif 12 13 14 #include "htconfig.h" 15 16 17 #ifdef STDC_HEADERS 18 #include <string.h> 19 #include <stdlib.h> 20 #include <stdio.h> 21 #endif 22 23 /* 24 }}} 25 */ 26 /* 27 {{{ typedefs 28 */ 29 30 #if SIZEOF_UNSIGNED_LONG_INT == 8 31 typedef unsigned long word64; 32 #define TIGER_64BIT 33 #elif SIZEOF_UNSIGNED_LONG_LONG_INT == 8 34 35 #ifndef _MSC_VER /* _WIN32 */ 36 typedef unsigned long long word64; 37 #else //ifdef _MSC_VER /* _WIN32 */ 38 typedef DWORD64 word64; 39 #endif 40 #else 41 #error "Cannot find a 64 bit integer in your system, sorry." 42 #endif 43 44 #if SIZEOF_UNSIGNED_LONG_INT == 4 45 typedef unsigned long word32; 46 #elif SIZEOF_UNSIGNED_INT == 4 47 typedef unsigned int word32; 48 #else 49 #error "Cannot find a 32 bit integer in your system, sorry." 50 #endif 51 52 #if SIZEOF_UNSIGNED_INT == 2 53 typedef unsigned int word16; 54 #elif SIZEOF_UNSIGNED_SHORT_INT == 2 55 typedef unsigned short word16; 56 #else 57 #error "Cannot find a 16 bit integer in your system, sorry." 58 #endif 59 60 #if SIZEOF_UNSIGNED_CHAR == 1 61 typedef unsigned char word8; 62 #else 63 #error "Cannot find an 8 bit char in your system, sorry." 64 #endif 65 66 typedef word8 byte; 67 typedef word32 dword; 68 69 /* 70 }}} 71 */ 72 73 /* 74 {{{ macros and defines 75 */ 76 77 #define RAND32 (word32) ((word32)rand() << 17 ^ (word32)rand() << 9 ^ rand()) 78 79 #ifndef HAVE_MEMMOVE 80 #ifdef HAVE_BCOPY 81 #define memmove(d, s, n) bcopy ((s), (d), (n)) 82 #else 83 #error "Neither memmove nor bcopy exists on your system." 84 #endif 85 #endif 86 87 #define ENCRYPT 0 88 #define DECRYPT 1 89 90 /* 91 }}} 92 */ 93 94 /* 95 {{{ prototypes 96 */ 97 98 void Bzero(void *s, int n); 99 100 word32 byteswap(word32 x); 101 102 int BreakToThree(void *key, unsigned int keylen, 103 void *keyword1, void *keyword2, void *keyword3); 104 105 /* 106 }}} 107 */ 108 109 #endif 110