30 #ifndef _SKEIN_PORT_H_
31 #define _SKEIN_PORT_H_
37 # define RETURN_VALUES
38 # if defined( DLL_EXPORT )
39 # if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
40 # define VOID_RETURN __declspec( dllexport ) void __stdcall
41 # define INT_RETURN __declspec( dllexport ) int __stdcall
42 # elif defined( __GNUC__ )
43 # define VOID_RETURN __declspec( __dllexport__ ) void
44 # define INT_RETURN __declspec( __dllexport__ ) int
46 # error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
48 # elif defined( DLL_IMPORT )
49 # if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
50 # define VOID_RETURN __declspec( dllimport ) void __stdcall
51 # define INT_RETURN __declspec( dllimport ) int __stdcall
52 # elif defined( __GNUC__ )
53 # define VOID_RETURN __declspec( __dllimport__ ) void
54 # define INT_RETURN __declspec( __dllimport__ ) int
56 # error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
58 # elif defined( __WATCOMC__ )
59 # define VOID_RETURN void __cdecl
60 # define INT_RETURN int __cdecl
62 # define VOID_RETURN void
63 # define INT_RETURN int
83 #define ui_type(size) uint##size##_t
84 #define dec_unit_type(size,x) typedef ui_type(size) x
85 #define dec_bufr_type(size,bsize,x) typedef ui_type(size) x[bsize / (size >> 3)]
86 #define ptr_cast(x,size) ((ui_type(size)*)(x))
93 #define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N))))
115 #ifndef SKEIN_NEED_SWAP
118 #include "int-util.h"
120 #define IS_BIG_ENDIAN 4321
121 #define IS_LITTLE_ENDIAN 1234
123 #if BYTE_ORDER == LITTLE_ENDIAN
124 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
127 #if BYTE_ORDER == BIG_ENDIAN
128 # define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN
133 #if defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
134 # define PLATFORM_MUST_ALIGN (1)
135 #ifndef PLATFORM_BYTE_ORDER
136 # define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN
140 #ifndef PLATFORM_MUST_ALIGN
141 # define PLATFORM_MUST_ALIGN (0)
145 #if PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN
147 #define SKEIN_NEED_SWAP (1)
148 #elif PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN
150 #define SKEIN_NEED_SWAP (0)
151 #if PLATFORM_MUST_ALIGN == 0
152 #define Skein_Put64_LSB_First(dst08,src64,bCnt) memcpy(dst08,src64,bCnt)
153 #define Skein_Get64_LSB_First(dst64,src08,wCnt) memcpy(dst64,src08,8*(wCnt))
156 #error "Skein needs endianness setting!"
168 #define Skein_Swap64(w64) \
169 ( (( ((u64b_t)(w64)) & 0xFF) << 56) | \
170 (((((u64b_t)(w64)) >> 8) & 0xFF) << 48) | \
171 (((((u64b_t)(w64)) >>16) & 0xFF) << 40) | \
172 (((((u64b_t)(w64)) >>24) & 0xFF) << 32) | \
173 (((((u64b_t)(w64)) >>32) & 0xFF) << 24) | \
174 (((((u64b_t)(w64)) >>40) & 0xFF) << 16) | \
175 (((((u64b_t)(w64)) >>48) & 0xFF) << 8) | \
176 (((((u64b_t)(w64)) >>56) & 0xFF) ) )
178 #define Skein_Swap64(w64) (w64)
183 #ifndef Skein_Put64_LSB_First
185 #ifdef SKEIN_PORT_CODE
190 dst[n] = (
u08b_t) (src[n>>3] >> (8*(n&7)));
198 #ifndef Skein_Get64_LSB_First
200 #ifdef SKEIN_PORT_CODE
204 for (n=0;n<8*wCnt;n+=8)
205 dst[n/8] = (((
u64b_t) src[n ]) ) +
206 (((
u64b_t) src[n+1]) << 8) +
207 (((
u64b_t) src[n+2]) << 16) +
208 (((
u64b_t) src[n+3]) << 24) +
209 (((
u64b_t) src[n+4]) << 32) +
210 (((
u64b_t) src[n+5]) << 40) +
211 (((
u64b_t) src[n+6]) << 48) +
212 (((
u64b_t) src[n+7]) << 56) ;
unsigned int uint_t
Definition: skein_port.h:88
#define Skein_Put64_LSB_First(dst08, src64, bCnt)
Definition: skein_port.h:152
uint8_t u08b_t
Definition: skein_port.h:89
uint64_t u64b_t
Definition: skein_port.h:90
#define Skein_Get64_LSB_First(dst64, src08, wCnt)
Definition: skein_port.h:153