diff options
author | drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-02-08 14:54:04 +0000 |
---|---|---|
committer | drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b <drstein drstein@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-02-08 14:54:04 +0000 |
commit | eea393f77fad8f1858fe5a7c5c19d54ca9860dbe (patch) | |
tree | 8cc514611d800c75ebfba887c35760e50315a9f3 | |
parent | 1e9c3a024247f0c39f5a81d6c03fae173e23fde7 (diff) |
BUILD : 1.7.21 (1379) BUGS : 856 NOTES : x86_64 generating improper SHA1 hash values. Thanks Johno Crawford ;)
git-svn-id: svn://svn.anope.org/anope/trunk@1379 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1094 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | Changes | 3 | ||||
-rw-r--r-- | src/core/enc_sha1.c | 65 | ||||
-rw-r--r-- | version.log | 6 |
3 files changed, 19 insertions, 55 deletions
@@ -33,6 +33,9 @@ Anope Version S V N 02/07 F findchan() debug messages not being logical. [#857] 02/07 F NickServ replying to SVSNICK command when OperServ must. [#861] +Provided by Johno Crawford <johno.crawford@gmail.com> - 2008 +02/08 F x86_64 generating improper SHA1 hash values. [#856] + Provided by Jan Milants <jan_renee@msn.com> - 2008 01/16 F Server traversion with next_server() failed to list all servers. [#831] 02/08 F Removed excessive free in ChanServ AKICK code. [#849] diff --git a/src/core/enc_sha1.c b/src/core/enc_sha1.c index 1fdb2a3fb..fe6e3f600 100644 --- a/src/core/enc_sha1.c +++ b/src/core/enc_sha1.c @@ -20,14 +20,14 @@ A million repetitions of "a" #include <string.h> typedef struct { - unsigned long state[5]; - unsigned long count[2]; + uint32 state[5]; + uint32 count[2]; unsigned char buffer[64]; } SHA1_CTX; -void SHA1Transform(unsigned long state[5], const unsigned char buffer[64]); +void SHA1Transform(uint32 state[5], unsigned char const buffer[64]); void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, const unsigned char* data, unsigned int len); +void SHA1Update(SHA1_CTX* context, unsigned char const * data, uint32 len); void SHA1Final(unsigned char digest[20], SHA1_CTX* context); #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) @@ -53,12 +53,12 @@ void SHA1Final(unsigned char digest[20], SHA1_CTX* context); /* Hash a single 512-bit block. This is the core of the algorithm. */ -void SHA1Transform(unsigned long state[5], const unsigned char buffer[64]) +void SHA1Transform(uint32 state[5], unsigned char const buffer[64]) { -unsigned long a, b, c, d, e; +uint32 a, b, c, d, e; typedef union { unsigned char c[64]; - unsigned long l[16]; + uint32 l[16]; } CHAR64LONG16; CHAR64LONG16* block; #ifdef SHA1HANDSOFF @@ -122,9 +122,9 @@ void SHA1Init(SHA1_CTX* context) /* Run your data through this. */ -void SHA1Update(SHA1_CTX* context, const unsigned char* data, unsigned int len) +void SHA1Update(SHA1_CTX* context, unsigned char const * data, uint32 len) { -unsigned int i, j; +uint32 i, j; j = (context->count[0] >> 3) & 63; if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; @@ -146,7 +146,7 @@ unsigned int i, j; void SHA1Final(unsigned char digest[20], SHA1_CTX* context) { -unsigned long i, j; +uint32 i; unsigned char finalcount[8]; for (i = 0; i < 8; i++) { @@ -163,7 +163,7 @@ unsigned char finalcount[8]; ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); } /* Wipe variables */ - i = j = 0; + i = 0; memset(context->buffer, 0, 64); memset(context->state, 0, 20); memset(context->count, 0, 8); @@ -173,49 +173,6 @@ unsigned char finalcount[8]; #endif } - -/*************************************************************/ - -/* -int main(int argc, char** argv) -{ - int i, j; - SHA1_CTX context; - unsigned char digest[20], buffer[16384]; - FILE* file; - - if (argc > 2) { - puts("Public domain SHA-1 implementation - by Steve Reid <steve@edmweb.com>"); - puts("Produces the SHA-1 hash of a file, or stdin if no file is specified."); - exit(0); - } - if (argc < 2) { - file = stdin; - } - else { - if (!(file = fopen(argv[1], "rb"))) { - fputs("Unable to open file.", stderr); - exit(-1); - } - } - SHA1Init(&context); - while (!feof(file)) { - i = fread(buffer, 1, 16384, file); - SHA1Update(&context, buffer, i); - } - SHA1Final(digest, &context); - fclose(file); - for (i = 0; i < 5; i++) { - for (j = 0; j < 4; j++) { - printf("%02X", digest[i*4+j]); - } - putchar(' '); - } - putchar('\n'); - exit(0); -} - */ - /*****************************************************************************/ int sha1_encrypt(const char *src, int len, char *dest, int size) diff --git a/version.log b/version.log index ab2e8c6d5..0fae90e03 100644 --- a/version.log +++ b/version.log @@ -9,10 +9,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="21" VERSION_EXTRA="-svn" -VERSION_BUILD="1378" +VERSION_BUILD="1379" # $Log$ # +# BUILD : 1.7.21 (1379) +# BUGS : 856 +# NOTES : x86_64 generating improper SHA1 hash values. Thanks Johno Crawford ;) +# # BUILD : 1.7.21 (1378) # BUGS : 861 # NOTES : NickServ replying to SVSNICK command where OperServ must. |