|
From: creecode <icr...@us...> - 2006-03-10 21:20:47
|
Update of /cvsroot/frontierkernel/Frontier/Common/headers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28406 Modified Files: kernelverbs.h kernelverbdefs.h Added Files: whirlpool.h langcrypt.h Log Message: added new verb category crypt and hashwhirlpool, hmacmd5, hashmd5 verbs Index: kernelverbs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/kernelverbs.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** kernelverbs.h 13 Jan 2005 23:54:18 -0000 1.3 --- kernelverbs.h 10 Mar 2006 21:20:41 -0000 1.4 *************** *** 35,39 **** extern boolean filelaunchanythingverb (hdltreenode, tyvaluerecord *); - extern boolean stringinitverbs (void); /*stringverbs.c*/ --- 35,38 ---- *************** *** 55,56 **** --- 54,58 ---- extern boolean mathinitverbs (void); /* langmath.c */ + + extern boolean cryptinitverbs (void); /* langcrypt.c */ + --- NEW FILE: langcrypt.h --- /* prototypes */ boolean hmacmd5 (unsigned char *, int, unsigned char *, int, caddr_t); /* 2006-03-05 creedon */ Index: kernelverbdefs.h =================================================================== RCS file: /cvsroot/frontierkernel/Frontier/Common/headers/kernelverbdefs.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** kernelverbdefs.h 13 Jan 2005 23:54:18 -0000 1.5 --- kernelverbdefs.h 10 Mar 2006 21:20:41 -0000 1.6 *************** *** 27,36 **** #define idopverbs 1000 ! #define idtableverbs 1001 #define idmenuverbs 1002 #define idwpverbs 1003 #define idpictverbs 1004 #define idlangverbs 1005 ! #define idstringverbs 1006 #define idfileverbs 1007 #define idrezverbs 1008 --- 27,36 ---- #define idopverbs 1000 ! #define idtableverbs 1001 #define idmenuverbs 1002 #define idwpverbs 1003 #define idpictverbs 1004 #define idlangverbs 1005 ! #define idstringverbs 1006 #define idfileverbs 1007 #define idrezverbs 1008 *************** *** 41,52 **** #define idsysverbs 1013 #define idlaunchverbs 1014 ! #define idclipboardverbs 1015 #define idfrontierverbs 1016 #define idcancoonverbs 1017 ! #define idthreadverbs 1018 ! #define iddbverbs 1019 #define idxmlverbs 1020 #define idhtmlverbs 1021 ! #define idquicktimeverbs 1022 /*7.0b4 PBS: QuickTime Player window verbs*/ #define idregexpverbs 1023 /*2003-04-22 AR: regular expression verbs*/ #define idmathverbs 1024 /*2004-12-29 SMD: extended math verbs*/ --- 41,54 ---- #define idsysverbs 1013 #define idlaunchverbs 1014 ! #define idclipboardverbs 1015 #define idfrontierverbs 1016 #define idcancoonverbs 1017 ! #define idthreadverbs 1018 ! #define iddbverbs 1019 #define idxmlverbs 1020 #define idhtmlverbs 1021 ! #define idquicktimeverbs 1022 /*7.0b4 PBS: QuickTime Player window verbs*/ #define idregexpverbs 1023 /*2003-04-22 AR: regular expression verbs*/ #define idmathverbs 1024 /*2004-12-29 SMD: extended math verbs*/ + #define idcryptverbs 1025 /* 2006-03-07 creedon: crypt verbs */ + --- NEW FILE: whirlpool.h --- #ifndef PORTABLE_C__ #define PORTABLE_C__ #include <limits.h> /* Definition of minimum-width integer types * * u8 -> unsigned integer type, at least 8 bits, equivalent to unsigned char * u16 -> unsigned integer type, at least 16 bits * u32 -> unsigned integer type, at least 32 bits * * s8, s16, s32 -> signed counterparts of u8, u16, u32 * * Always use macro's T8(), T16() or T32() to obtain exact-width results, * i.e., to specify the size of the result of each expression. */ typedef signed char s8; typedef unsigned char u8; #if UINT_MAX >= 4294967295UL typedef signed short s16; typedef signed int s32; typedef unsigned short u16; typedef unsigned int u32; #define ONE32 0xffffffffU #else typedef signed int s16; typedef signed long s32; typedef unsigned int u16; typedef unsigned long u32; #define ONE32 0xffffffffUL #endif #define ONE8 0xffU #define ONE16 0xffffU #define T8(x) ((x) & ONE8) #define T16(x) ((x) & ONE16) #define T32(x) ((x) & ONE32) #ifdef _MSC_VER typedef unsigned __int64 u64; typedef signed __int64 s64; #define LL(v) (v##i64) #define ONE64 LL(0xffffffffffffffff) #else /* !_MSC_VER */ typedef unsigned long long u64; typedef signed long long s64; #define LL(v) (v##ULL) #define ONE64 LL(0xffffffffffffffff) #endif /* ?_MSC_VER */ #define T64(x) ((x) & ONE64) #define ROTR64(v, n) (((v) >> (n)) | T64((v) << (64 - (n)))) /* * Note: the test is used to detect native 64-bit architectures; * if the unsigned long is strictly greater than 32-bit, it is * assumed to be at least 64-bit. This will not work correctly * on (old) 36-bit architectures (PDP-11 for instance). * * On non-64-bit architectures, "long long" is used. */ /* * U8TO32_BIG(c) returns the 32-bit value stored in big-endian convention * in the unsigned char array pointed to by c. */ #define U8TO32_BIG(c) (((u32)T8(*(c)) << 24) | ((u32)T8(*((c) + 1)) << 16) | ((u32)T8(*((c) + 2)) << 8) | ((u32)T8(*((c) + 3)))) /* * U8TO32_LITTLE(c) returns the 32-bit value stored in little-endian convention * in the unsigned char array pointed to by c. */ #define U8TO32_LITTLE(c) (((u32)T8(*(c))) | ((u32)T8(*((c) + 1)) << 8) | (u32)T8(*((c) + 2)) << 16) | ((u32)T8(*((c) + 3)) << 24)) /* * U8TO32_BIG(c, v) stores the 32-bit-value v in big-endian convention * into the unsigned char array pointed to by c. */ #define U32TO8_BIG(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) /* * U8TO32_LITTLE(c, v) stores the 32-bit-value v in little-endian convention * into the unsigned char array pointed to by c. */ #define U32TO8_LITTLE(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) /* * ROTL32(v, n) returns the value of the 32-bit unsigned value v after * a rotation of n bits to the left. It might be replaced by the appropriate * architecture-specific macro. * * It evaluates v and n twice. * * The compiler might emit a warning if n is the constant 0. The result * is undefined if n is greater than 31. */ #define ROTL32(v, n) (T32((v) << (n)) | ((v) >> (32 - (n)))) /* * Whirlpool-specific definitions. */ #define DIGESTBYTES 64 #define DIGESTBITS (8*DIGESTBYTES) /* 512 */ #define WBLOCKBYTES 64 #define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */ #define LENGTHBYTES 32 #define LENGTHBITS (8*LENGTHBYTES) /* 256 */ typedef struct NESSIEstruct { u8 bitLength[LENGTHBYTES]; /* global number of hashed bits (256-bit counter) */ u8 buffer[WBLOCKBYTES]; /* buffer of data to hash */ int bufferBits; /* current number of bits on the buffer */ int bufferPos; /* current (possibly incomplete) byte slot on the buffer */ u64 hash[DIGESTBYTES/8]; /* the hashing state */ } NESSIEstruct; #endif /* PORTABLE_C__ */ /* prototypes */ /* 2006-03-06 creedon */ void NESSIEinit (NESSIEstruct *); void NESSIEadd (const unsigned char * const, unsigned long, NESSIEstruct *); void NESSIEfinalize (NESSIEstruct *, unsigned char *); void makeNESSIETestVectors (); void testAPI (void); |