thig_platform.h File Reference


Detailed Description

Platform-specific defines for TWOFISH code.

Note:
Code taken from http://www.schneier.com/twofish-download.html
PLATFORM.H -- Platform-specific defines for TWOFISH code

Submitters: Bruce Schneier, Counterpane Systems Doug Whiting, Hi/fn John Kelsey, Counterpane Systems Chris Hall, Counterpane Systems David Wagner, UC Berkeley

Code Author: Doug Whiting, Hi/fn

Version 1.00 April 1998

Copyright 1998, Hi/fn and Counterpane Systems. All rights reserved.

Notes: Tab size is set to 4 characters in this file

Definition in file thig_platform.h.

Go to the source code of this file.

Defines

#define ROL(x, n)   (((x) << ((n) & 0x1F)) | ((x) >> (32-((n) & 0x1F))))
 use intrinsic rotate if possible
#define ROR(x, n)   (((x) >> ((n) & 0x1F)) | ((x) << (32-((n) & 0x1F))))
 non-Intel platforms
#define LittleEndian   0
 (assume big endian
#define ALIGN32   1
 (assume need alignment for non-Intel)
#define Bswap(x)   ((ROR(x,8) & 0xFF00FF00) | (ROL(x,8) & 0x00FF00FF))
#define ADDR_XOR   3
 convert byte address in dword
#define _b(x, N)   (((BYTE *)&x)[((N) & 3) ^ ADDR_XOR])
 Macros for extracting bytes from dwords (correct for endianness).
#define b0(x)   _b(x,0)
 extract LSB of DWORD
#define b1(x)   _b(x,1)
#define b2(x)   _b(x,2)
#define b3(x)   _b(x,3)
 extract MSB of DWORD


Define Documentation

#define ROL ( x,
 )     (((x) << ((n) & 0x1F)) | ((x) >> (32-((n) & 0x1F))))

use intrinsic rotate if possible

Definition at line 72 of file thig_platform.h.

Referenced by blockDecrypt(), blockEncrypt(), and reKey().

#define ROR ( x,
 )     (((x) >> ((n) & 0x1F)) | ((x) << (32-((n) & 0x1F))))

non-Intel platforms

Definition at line 73 of file thig_platform.h.

Referenced by blockDecrypt(), and blockEncrypt().

#define LittleEndian   0

(assume big endian

Definition at line 136 of file thig_platform.h.

#define ALIGN32   1

(assume need alignment for non-Intel)

Definition at line 137 of file thig_platform.h.

#define Bswap (  )     ((ROR(x,8) & 0xFF00FF00) | (ROL(x,8) & 0x00FF00FF))

Definition at line 144 of file thig_platform.h.

Referenced by blockDecrypt(), blockEncrypt(), cipherInit(), and f32().

#define ADDR_XOR   3

convert byte address in dword

Definition at line 145 of file thig_platform.h.

Referenced by ParseHexDword().

#define _b ( x,
 )     (((BYTE *)&x)[((N) & 3) ^ ADDR_XOR])

Macros for extracting bytes from dwords (correct for endianness).

Definition at line 149 of file thig_platform.h.

#define b0 (  )     _b(x,0)

extract LSB of DWORD

Definition at line 151 of file thig_platform.h.

Referenced by f32().

#define b1 (  )     _b(x,1)

Definition at line 152 of file thig_platform.h.

Referenced by f32().

#define b2 (  )     _b(x,2)

Definition at line 153 of file thig_platform.h.

Referenced by f32().

#define b3 (  )     _b(x,3)

extract MSB of DWORD

Definition at line 154 of file thig_platform.h.

Referenced by f32().


Generated on Thu Oct 23 04:14:41 2008 for Open IMS Core CSCFs by  doxygen 1.5.2