From 54e45bd3d498919a8adb62d5eecc3a152627ef35 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Thu, 12 Sep 2013 12:15:21 +0200 Subject: [PATCH] style modifications because of newer astyle --- src/ripemd128.h | 22 +++--- src/sha2.h | 194 ++++++++++++++++++++++++------------------------ src/tiger.h | 122 +++++++++++++++--------------- 3 files changed, 169 insertions(+), 169 deletions(-) diff --git a/src/ripemd128.h b/src/ripemd128.h index 1126c20..8d974e8 100644 --- a/src/ripemd128.h +++ b/src/ripemd128.h @@ -26,21 +26,21 @@ extern "C" { #include #include - struct ampheck_ripemd128 { - uint32_t h[4]; - uint8_t buffer[64]; +struct ampheck_ripemd128 { + uint32_t h[4]; + uint8_t buffer[64]; - uint64_t length; - }; + uint64_t length; +}; - void ampheck_ripemd128_init (struct ampheck_ripemd128 *ctx); +void ampheck_ripemd128_init (struct ampheck_ripemd128 *ctx); - void ampheck_ripemd128_update (struct ampheck_ripemd128 *ctx, - const uint8_t *data, - size_t length); +void ampheck_ripemd128_update (struct ampheck_ripemd128 *ctx, + const uint8_t *data, + size_t length); - void ampheck_ripemd128_finish (const struct ampheck_ripemd128 *ctx, - uint8_t *digest); +void ampheck_ripemd128_finish (const struct ampheck_ripemd128 *ctx, + uint8_t *digest); #ifdef __cplusplus } //extern "C" diff --git a/src/sha2.h b/src/sha2.h index 6a8683a..31d7a4a 100644 --- a/src/sha2.h +++ b/src/sha2.h @@ -40,11 +40,11 @@ extern "C" { #endif - /* - * Import u_intXX_t size_t type definitions from system headers. You - * may need to change this, or define these things yourself in this - * file. - */ +/* + * Import u_intXX_t size_t type definitions from system headers. You + * may need to change this, or define these things yourself in this + * file. + */ #include #ifdef SHA2_USE_INTTYPES_H @@ -54,7 +54,7 @@ extern "C" { #endif /* SHA2_USE_INTTYPES_H */ - /*** SHA-256/384/512 Various Length Definitions ***********************/ +/*** SHA-256/384/512 Various Length Definitions ***********************/ #define SHA256_BLOCK_LENGTH 64 #define SHA256_DIGEST_LENGTH 32 #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) @@ -66,126 +66,126 @@ extern "C" { #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) - /*** SHA-256/384/512 Context Structures *******************************/ - /* NOTE: If your architecture does not define either u_intXX_t types or - * uintXX_t (from inttypes.h), you may need to define things by hand - * for your system: - */ +/*** SHA-256/384/512 Context Structures *******************************/ +/* NOTE: If your architecture does not define either u_intXX_t types or + * uintXX_t (from inttypes.h), you may need to define things by hand + * for your system: + */ #if 0 - typedef unsigned char u_int8_t; /* 1-byte (8-bits) */ - typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */ - typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */ +typedef unsigned char u_int8_t; /* 1-byte (8-bits) */ +typedef unsigned int u_int32_t; /* 4-bytes (32-bits) */ +typedef unsigned long long u_int64_t; /* 8-bytes (64-bits) */ #endif - /* - * Most BSD systems already define u_intXX_t types, as does Linux. - * Some systems, however, like Compaq's Tru64 Unix instead can use - * uintXX_t types defined by very recent ANSI C standards and included - * in the file: - * - * #include - * - * If you choose to use then please define: - * - * #define SHA2_USE_INTTYPES_H - * - * Or on the command line during compile: - * - * cc -DSHA2_USE_INTTYPES_H ... - */ +/* + * Most BSD systems already define u_intXX_t types, as does Linux. + * Some systems, however, like Compaq's Tru64 Unix instead can use + * uintXX_t types defined by very recent ANSI C standards and included + * in the file: + * + * #include + * + * If you choose to use then please define: + * + * #define SHA2_USE_INTTYPES_H + * + * Or on the command line during compile: + * + * cc -DSHA2_USE_INTTYPES_H ... + */ #ifdef SHA2_USE_INTTYPES_H - typedef struct _SHA256_CTX { - uint32_t state[8]; - uint64_t bitcount; - uint8_t buffer[SHA256_BLOCK_LENGTH]; - } SHA256_CTX; - typedef struct _SHA512_CTX { - uint64_t state[8]; - uint64_t bitcount[2]; - uint8_t buffer[SHA512_BLOCK_LENGTH]; - } SHA512_CTX; +typedef struct _SHA256_CTX { + uint32_t state[8]; + uint64_t bitcount; + uint8_t buffer[SHA256_BLOCK_LENGTH]; +} SHA256_CTX; +typedef struct _SHA512_CTX { + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; #else /* SHA2_USE_INTTYPES_H */ - typedef struct _SHA256_CTX { - u_int32_t state[8]; - u_int64_t bitcount; - u_int8_t buffer[SHA256_BLOCK_LENGTH]; - } SHA256_CTX; - typedef struct _SHA512_CTX { - u_int64_t state[8]; - u_int64_t bitcount[2]; - u_int8_t buffer[SHA512_BLOCK_LENGTH]; - } SHA512_CTX; +typedef struct _SHA256_CTX { + u_int32_t state[8]; + u_int64_t bitcount; + u_int8_t buffer[SHA256_BLOCK_LENGTH]; +} SHA256_CTX; +typedef struct _SHA512_CTX { + u_int64_t state[8]; + u_int64_t bitcount[2]; + u_int8_t buffer[SHA512_BLOCK_LENGTH]; +} SHA512_CTX; #endif /* SHA2_USE_INTTYPES_H */ - typedef SHA512_CTX SHA384_CTX; +typedef SHA512_CTX SHA384_CTX; - /*** SHA-256/384/512 Function Prototypes ******************************/ +/*** SHA-256/384/512 Function Prototypes ******************************/ #ifndef NOPROTO #ifdef SHA2_USE_INTTYPES_H - void SHA256_Init (SHA256_CTX *); - void SHA256_Update (SHA256_CTX*, const uint8_t*, size_t); - void SHA256_Final (uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); - char* SHA256_End (SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); - char* SHA256_Data (const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void SHA256_Init (SHA256_CTX *); +void SHA256_Update (SHA256_CTX*, const uint8_t*, size_t); +void SHA256_Final (uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* SHA256_End (SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* SHA256_Data (const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); - void SHA384_Init (SHA384_CTX*); - void SHA384_Update (SHA384_CTX*, const uint8_t*, size_t); - void SHA384_Final (uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); - char* SHA384_End (SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); - char* SHA384_Data (const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void SHA384_Init (SHA384_CTX*); +void SHA384_Update (SHA384_CTX*, const uint8_t*, size_t); +void SHA384_Final (uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* SHA384_End (SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* SHA384_Data (const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); - void SHA512_Init (SHA512_CTX*); - void SHA512_Update (SHA512_CTX*, const uint8_t*, size_t); - void SHA512_Final (uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); - char* SHA512_End (SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); - char* SHA512_Data (const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void SHA512_Init (SHA512_CTX*); +void SHA512_Update (SHA512_CTX*, const uint8_t*, size_t); +void SHA512_Final (uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* SHA512_End (SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* SHA512_Data (const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); #else /* SHA2_USE_INTTYPES_H */ - void SHA256_Init (SHA256_CTX *); - void SHA256_Update (SHA256_CTX*, const u_int8_t*, size_t); - void SHA256_Final (u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); - char* SHA256_End (SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); - char* SHA256_Data (const u_int8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void SHA256_Init (SHA256_CTX *); +void SHA256_Update (SHA256_CTX*, const u_int8_t*, size_t); +void SHA256_Final (u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* SHA256_End (SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* SHA256_Data (const u_int8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); - void SHA384_Init (SHA384_CTX*); - void SHA384_Update (SHA384_CTX*, const u_int8_t*, size_t); - void SHA384_Final (u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); - char* SHA384_End (SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); - char* SHA384_Data (const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void SHA384_Init (SHA384_CTX*); +void SHA384_Update (SHA384_CTX*, const u_int8_t*, size_t); +void SHA384_Final (u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* SHA384_End (SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* SHA384_Data (const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); - void SHA512_Init (SHA512_CTX*); - void SHA512_Update (SHA512_CTX*, const u_int8_t*, size_t); - void SHA512_Final (u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); - char* SHA512_End (SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); - char* SHA512_Data (const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void SHA512_Init (SHA512_CTX*); +void SHA512_Update (SHA512_CTX*, const u_int8_t*, size_t); +void SHA512_Final (u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* SHA512_End (SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* SHA512_Data (const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); #endif /* SHA2_USE_INTTYPES_H */ #else /* NOPROTO */ - void SHA256_Init(); - void SHA256_Update(); - void SHA256_Final(); - char* SHA256_End(); - char* SHA256_Data(); +void SHA256_Init(); +void SHA256_Update(); +void SHA256_Final(); +char* SHA256_End(); +char* SHA256_Data(); - void SHA384_Init(); - void SHA384_Update(); - void SHA384_Final(); - char* SHA384_End(); - char* SHA384_Data(); +void SHA384_Init(); +void SHA384_Update(); +void SHA384_Final(); +char* SHA384_End(); +char* SHA384_Data(); - void SHA512_Init(); - void SHA512_Update(); - void SHA512_Final(); - char* SHA512_End(); - char* SHA512_Data(); +void SHA512_Init(); +void SHA512_Update(); +void SHA512_Final(); +char* SHA512_End(); +char* SHA512_Data(); #endif /* NOPROTO */ diff --git a/src/tiger.h b/src/tiger.h index c53e538..4bdb7fd 100644 --- a/src/tiger.h +++ b/src/tiger.h @@ -50,10 +50,10 @@ extern "C" { #include #else - typedef __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; #endif @@ -83,71 +83,71 @@ extern "C" { #endif - /** A word in the tiger hash, 64 bits **/ - typedef uint64_t t_word; +/** A word in the tiger hash, 64 bits **/ +typedef uint64_t t_word; - /** This one is provided as a commodity for people wanting an easy way - * to declare result variables **/ - typedef t_word t_res[3]; +/** This one is provided as a commodity for people wanting an easy way + * to declare result variables **/ +typedef t_word t_res[3]; - /** Partial calculation as used by tigerp1 and tigerp2 **/ - typedef struct { - t_res h; // Hash status - char r[128]; // SALT - t_word n; // Number of characters of r used - t_word hs; // Amount of total data hashed - } t_pres; +/** Partial calculation as used by tigerp1 and tigerp2 **/ +typedef struct { + t_res h; // Hash status + char r[128]; // SALT + t_word n; // Number of characters of r used + t_word hs; // Amount of total data hashed +} t_pres; - /** This one is provided as a commodity for people wanting an easy way - * to declare block variables **/ - typedef t_word t_block[8]; +/** This one is provided as a commodity for people wanting an easy way + * to declare block variables **/ +typedef t_word t_block[8]; - /** Standard tiger calculation, put your string in str and the string - * length on length and get the result on res **/ - void tiger (const char *str, t_word length, t_res res); - /** Similar to tiger but interleaving accesses to both equally sized - * strings to reduce overhead and pipeline stalls you get the result of - * str1 on res1 and the one of str2 on res2 **/ - void tiger_2 (const char *str1, const char *str2, t_word length, - t_res res1, t_res res2); +/** Standard tiger calculation, put your string in str and the string + * length on length and get the result on res **/ +void tiger (const char *str, t_word length, t_res res); +/** Similar to tiger but interleaving accesses to both equally sized + * strings to reduce overhead and pipeline stalls you get the result of + * str1 on res1 and the one of str2 on res2 **/ +void tiger_2 (const char *str1, const char *str2, t_word length, + t_res res1, t_res res2); #ifdef __SSE2__ - /** This is equivalent to tiger_2 but uses SSE2 for the key schduling - * making it faster **/ - void tiger_sse2 (const char *str1, const char *str2, t_word length, - t_res res1, t_res res2); +/** This is equivalent to tiger_2 but uses SSE2 for the key schduling + * making it faster **/ +void tiger_sse2 (const char *str1, const char *str2, t_word length, + t_res res1, t_res res2); #endif - /** This function is optimized for use on TTHs just send the two - * concatenated hashes and you will get back the hash with a prepended - * 0x01 **/ - void tiger_49 (const char *str, t_res res); - /** This function is optimized for use on TTHs just send the 1024 sized - * block and you will get back the hash with a prepended 0x00 **/ - void tiger_1025 (const char *str, t_res res); - /** Interleaved version of tiger_49 you insert two hashes and get back - * two results **/ - void tiger_2_49 (const char *str1, const char *str2, - t_res res1, t_res res2); - /** Interleaved version of tiger_1025 you insert two hashes and get - * back two results **/ - void tiger_2_1025 (const char *str1, const char *str2, - t_res res1, t_res res2); +/** This function is optimized for use on TTHs just send the two + * concatenated hashes and you will get back the hash with a prepended + * 0x01 **/ +void tiger_49 (const char *str, t_res res); +/** This function is optimized for use on TTHs just send the 1024 sized + * block and you will get back the hash with a prepended 0x00 **/ +void tiger_1025 (const char *str, t_res res); +/** Interleaved version of tiger_49 you insert two hashes and get back + * two results **/ +void tiger_2_49 (const char *str1, const char *str2, + t_res res1, t_res res2); +/** Interleaved version of tiger_1025 you insert two hashes and get + * back two results **/ +void tiger_2_1025 (const char *str1, const char *str2, + t_res res1, t_res res2); #ifdef __SSE2__ - /** SSE2 version of tiger_49 you insert two hashes and get back two - * results **/ - void tiger_sse2_49 (const char *str1, const char *str2, - t_res res1, t_res res2); - /** SSE2 version of tiger_1025 you insert two hashes and get back two - * results **/ - void tiger_sse2_1025 (const char *str1, const char *str2, - t_res res1, t_res res2); +/** SSE2 version of tiger_49 you insert two hashes and get back two + * results **/ +void tiger_sse2_49 (const char *str1, const char *str2, + t_res res1, t_res res2); +/** SSE2 version of tiger_1025 you insert two hashes and get back two + * results **/ +void tiger_sse2_1025 (const char *str1, const char *str2, + t_res res1, t_res res2); #endif - /** First stage of partial tiger calculation to improve password - * security during storage **/ - void tigerp1 (const char *password, t_word length, const char *salt, - t_pres *pres); - /** Second stage of partial tiger calculation **/ - void tigerp2 (const t_pres *pres, const char *salt, t_word length, - t_res res); +/** First stage of partial tiger calculation to improve password + * security during storage **/ +void tigerp1 (const char *password, t_word length, const char *salt, + t_pres *pres); +/** Second stage of partial tiger calculation **/ +void tigerp2 (const t_pres *pres, const char *salt, t_word length, + t_res res); #ifdef __cplusplus } //extern "C"