diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2007-11-23 23:07:44 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2007-11-23 23:07:44 +0000 |
commit | 77bfd077778c30c70f791752ce3a13d537aedd3b (patch) | |
tree | b75b50003195e89c58ca3698a396c458d9ebea89 /protocols | |
parent | df6d1da013f42caa5f11dbcbb0d54710682811f7 (diff) |
Replaced GPL-incompatible SHA1 hashing code (and renamed the files in case
I ever need SHA256 ;-)).
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/jabber/iq.c | 11 | ||||
-rw-r--r-- | protocols/nogaim.h | 1 | ||||
-rw-r--r-- | protocols/yahoo/libyahoo2.c | 44 |
3 files changed, 28 insertions, 28 deletions
diff --git a/protocols/jabber/iq.c b/protocols/jabber/iq.c index 4738817a..40897639 100644 --- a/protocols/jabber/iq.c +++ b/protocols/jabber/iq.c @@ -22,6 +22,7 @@ \***************************************************************************/ #include "jabber.h" +#include "sha1.h" static xt_status jabber_parse_roster( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); static xt_status jabber_iq_display_vcard( struct im_connection *ic, struct xt_node *node, struct xt_node *orig ); @@ -232,15 +233,15 @@ static xt_status jabber_do_iq_auth( struct im_connection *ic, struct xt_node *no { /* We can do digest authentication, it seems, and of course we prefer that. */ - SHA_CTX sha; + sha1_state_t sha; char hash_hex[41]; unsigned char hash[20]; int i; - shaInit( &sha ); - shaUpdate( &sha, (unsigned char*) s, strlen( s ) ); - shaUpdate( &sha, (unsigned char*) ic->acc->pass, strlen( ic->acc->pass ) ); - shaFinal( &sha, hash ); + sha1_init( &sha ); + sha1_append( &sha, (unsigned char*) s, strlen( s ) ); + sha1_append( &sha, (unsigned char*) ic->acc->pass, strlen( ic->acc->pass ) ); + sha1_finish( &sha, hash ); for( i = 0; i < 20; i ++ ) sprintf( hash_hex + i * 2, "%02x", hash[i] ); diff --git a/protocols/nogaim.h b/protocols/nogaim.h index adee5e33..0e890464 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -42,7 +42,6 @@ #include "account.h" #include "proxy.h" #include "md5.h" -#include "sha.h" #define BUF_LEN MSG_LEN #define BUF_LONG ( BUF_LEN * 2 ) diff --git a/protocols/yahoo/libyahoo2.c b/protocols/yahoo/libyahoo2.c index 5beae687..ce38bc73 100644 --- a/protocols/yahoo/libyahoo2.c +++ b/protocols/yahoo/libyahoo2.c @@ -75,7 +75,7 @@ char *strchr (), *strrchr (); #include <stdlib.h> #include <ctype.h> -#include "sha.h" +#include "sha1.h" #include "md5.h" #include "yahoo2.h" #include "yahoo_httplib.h" @@ -1819,8 +1819,8 @@ static void yahoo_process_auth_0x0b(struct yahoo_input_data *yid, const char *se md5_byte_t result[16]; md5_state_t ctx; - SHA_CTX ctx1; - SHA_CTX ctx2; + sha1_state_t ctx1; + sha1_state_t ctx2; char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ"; char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop"; @@ -1876,7 +1876,7 @@ static void yahoo_process_auth_0x0b(struct yahoo_input_data *yid, const char *se magic_ptr = (unsigned char *)seed; - while (*magic_ptr != (int)NULL) { + while (*magic_ptr != 0) { char *loc; /* Ignore parentheses. */ @@ -2055,27 +2055,27 @@ static void yahoo_process_auth_0x0b(struct yahoo_input_data *yid, const char *se if (cnt < 64) memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt); - shaInit(&ctx1); - shaInit(&ctx2); + sha1_init(&ctx1); + sha1_init(&ctx2); /* The first context gets the password hash XORed * with 0x36 plus a magic value * which we previously extrapolated from our * challenge. */ - shaUpdate(&ctx1, pass_hash_xor1, 64); + sha1_append(&ctx1, pass_hash_xor1, 64); if (j >= 3 ) - ctx1.sizeLo = 0x1ff; - shaUpdate(&ctx1, magic_key_char, 4); - shaFinal(&ctx1, digest1); + ctx1.Length_Low = 0x1ff; + sha1_append(&ctx1, magic_key_char, 4); + sha1_finish(&ctx1, digest1); /* The second context gets the password hash XORed * with 0x5c plus the SHA-1 digest * of the first context. */ - shaUpdate(&ctx2, pass_hash_xor2, 64); - shaUpdate(&ctx2, digest1, 20); - shaFinal(&ctx2, digest2); + sha1_append(&ctx2, pass_hash_xor2, 64); + sha1_append(&ctx2, digest1, 20); + sha1_finish(&ctx2, digest2); /* Now that we have digest2, use it to fetch * characters from an alphabet to construct @@ -2146,27 +2146,27 @@ static void yahoo_process_auth_0x0b(struct yahoo_input_data *yid, const char *se if (cnt < 64) memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt); - shaInit(&ctx1); - shaInit(&ctx2); + sha1_init(&ctx1); + sha1_init(&ctx2); /* The first context gets the password hash XORed * with 0x36 plus a magic value * which we previously extrapolated from our * challenge. */ - shaUpdate(&ctx1, crypt_hash_xor1, 64); + sha1_append(&ctx1, crypt_hash_xor1, 64); if (j >= 3 ) - ctx1.sizeLo = 0x1ff; - shaUpdate(&ctx1, magic_key_char, 4); - shaFinal(&ctx1, digest1); + ctx1.Length_Low = 0x1ff; + sha1_append(&ctx1, magic_key_char, 4); + sha1_finish(&ctx1, digest1); /* The second context gets the password hash XORed * with 0x5c plus the SHA-1 digest * of the first context. */ - shaUpdate(&ctx2, crypt_hash_xor2, 64); - shaUpdate(&ctx2, digest1, 20); - shaFinal(&ctx2, digest2); + sha1_append(&ctx2, crypt_hash_xor2, 64); + sha1_append(&ctx2, digest1, 20); + sha1_finish(&ctx2, digest2); /* Now that we have digest2, use it to fetch * characters from an alphabet to construct |