Mercurial > pidgin.yaz
changeset 7253:0ed4d53c46f9
[gaim-migrate @ 7830]
I am slicing and dicing my way through culinary college.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 14 Oct 2003 03:02:05 +0000 |
parents | 1a808d72caff |
children | bb0160033e50 |
files | src/protocols/msn/md5.h src/protocols/oscar/aim.h src/protocols/oscar/auth.c src/protocols/oscar/locate.c src/protocols/oscar/md5.h src/protocols/oscar/oscar.c src/protocols/trepia/md5.h src/protocols/yahoo/md5.h |
diffstat | 8 files changed, 190 insertions(+), 524 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/msn/md5.h Mon Oct 13 23:20:07 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This code has some adaptations for the Ghostscript environment, but it - * will compile and run correctly in any environment with 8-bit chars and - * 32-bit ints. Specifically, it assumes that if the following are - * defined, they have the same meaning as in Ghostscript: P1, P2, P3, - * ARCH_IS_BIG_ENDIAN. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -#ifdef P1 -void md5_init(P1(md5_state_t *pms)); -#else -void md5_init(md5_state_t *pms); -#endif - -/* Append a string to the message. */ -#ifdef P3 -void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); -#else -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -#endif - -/* Finish the message and return the digest. */ -#ifdef P2 -void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); -#else -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); -#endif - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */
--- a/src/protocols/oscar/aim.h Mon Oct 13 23:20:07 2003 +0000 +++ b/src/protocols/oscar/aim.h Tue Oct 14 03:02:05 2003 +0000 @@ -205,6 +205,15 @@ "us", "en", \ } +#define CLIENTINFO_AIM_5_5_3415 { \ + "AOL Instant Messenger, version 5.5.3415/WIN32", \ + 0x0109, \ + 0x0005, 0x0005, \ + 0x0000, 0x0057, \ + 0x000000ef, \ + "us", "en", \ +} + #define CLIENTINFO_ICHAT_1_0 { \ "Apple iChat", \ 0x311a, \ @@ -546,7 +555,6 @@ faim_export int aim_sendflapver(aim_session_t *sess, aim_conn_t *conn); faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn); faim_export int aim_send_login(aim_session_t *, aim_conn_t *, const char *, const char *, struct client_info_s *, const char *key); -faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest); faim_export void aim_purge_rxqueue(aim_session_t *); faim_export void aim_cleansnacs(aim_session_t *, int maxage);
--- a/src/protocols/oscar/auth.c Mon Oct 13 23:20:07 2003 +0000 +++ b/src/protocols/oscar/auth.c Tue Oct 14 03:02:05 2003 +0000 @@ -11,34 +11,79 @@ #include "md5.h" -static int aim_encode_password(const char *password, fu8_t *encoded); - -/* - * This just pushes the passed cookie onto the passed connection, without - * the SNAC header or any of that. +/** + * Encode a password using old XOR method + * + * This takes a const pointer to a (null terminated) string + * containing the unencoded password. It also gets passed + * an already allocated buffer to store the encoded password. + * This buffer should be the exact length of the password without + * the null. The encoded password buffer /is not %NULL terminated/. * - * Very commonly used, as every connection except auth will require this to - * be the first thing you send. + * The encoding_table seems to be a fixed set of values. We'll + * hope it doesn't change over time! + * + * This is only used for the XOR method, not the better MD5 method. * + * @param password Incoming password. + * @param encoded Buffer to put encoded password. */ -faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu16_t length, const fu8_t *chipsahoy) +static int aim_encode_password(const char *password, fu8_t *encoded) { - aim_frame_t *fr; - aim_tlvlist_t *tl = NULL; - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+length))) - return -ENOMEM; + fu8_t encoding_table[] = { +#if 0 /* old v1 table */ + 0xf3, 0xb3, 0x6c, 0x99, + 0x95, 0x3f, 0xac, 0xb6, + 0xc5, 0xfa, 0x6b, 0x63, + 0x69, 0x6c, 0xc3, 0x9f +#else /* v2.1 table, also works for ICQ */ + 0xf3, 0x26, 0x81, 0xc4, + 0x39, 0x86, 0xdb, 0x92, + 0x71, 0xa3, 0xb9, 0xe6, + 0x53, 0x7a, 0x95, 0x7c +#endif + }; + int i; - aimbs_put32(&fr->data, 0x00000001); - aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy); - aim_tlvlist_write(&fr->data, &tl); - aim_tlvlist_free(&tl); - - aim_tx_enqueue(sess, fr); + for (i = 0; i < strlen(password); i++) + encoded[i] = (password[i] ^ encoding_table[i]); return 0; } +#ifdef USE_OLD_MD5 +static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) +{ + md5_state_t state; + + md5_init(&state); + md5_append(&state, (const md5_byte_t *)key, strlen(key)); + md5_append(&state, (const md5_byte_t *)password, strlen(password)); + md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); + md5_finish(&state, (md5_byte_t *)digest); + + return 0; +} +#else +static int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) +{ + md5_state_t state; + fu8_t passdigest[16]; + + md5_init(&state); + md5_append(&state, (const md5_byte_t *)password, strlen(password)); + md5_finish(&state, (md5_byte_t *)&passdigest); + + md5_init(&state); + md5_append(&state, (const md5_byte_t *)key, strlen(key)); + md5_append(&state, (const md5_byte_t *)&passdigest, 16); + md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); + md5_finish(&state, (md5_byte_t *)digest); + + return 0; +} +#endif + /* * Normally the FLAP version is sent as the first few bytes of the cookie, * meaning you generally never call this. @@ -62,85 +107,23 @@ } /* - * This is a bit confusing. - * - * Normal SNAC login goes like this: - * - connect - * - server sends flap version - * - client sends flap version - * - client sends screen name (17/6) - * - server sends hash key (17/7) - * - client sends auth request (17/2 -- aim_send_login) - * - server yells + * This just pushes the passed cookie onto the passed connection, without + * the SNAC header or any of that. * - * XOR login (for ICQ) goes like this: - * - connect - * - server sends flap version - * - client sends auth request which contains flap version (aim_send_login) - * - server yells - * - * For the client API, we make them implement the most complicated version, - * and for the simpler version, we fake it and make it look like the more - * complicated process. - * - * This is done by giving the client a faked key, just so we can convince - * them to call aim_send_login right away, which will detect the session - * flag that says this is XOR login and ignore the key, sending an ICQ - * login request instead of the normal SNAC one. - * - * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. - * - * XXX This may cause problems if the client relies on callbacks only - * being called from the context of aim_rxdispatch()... + * Very commonly used, as every connection except auth will require this to + * be the first thing you send. * */ -static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) -{ - aim_frame_t fr; - aim_rxcallback_t userfunc; - - sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN; - sess->flags |= AIM_SESS_FLAGS_XORLOGIN; - - fr.conn = conn; - - if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) - userfunc(sess, &fr, ""); - - return 0; -} - -/* - * In AIM 3.5 protocol, the first stage of login is to request login from the - * Authorizer, passing it the screen name for verification. If the name is - * invalid, a 0017/0003 is spit back, with the standard error contents. If - * valid, a 0017/0007 comes back, which is the signal to send it the main - * login command (0017/0002). - * - */ -faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) +faim_export int aim_sendcookie(aim_session_t *sess, aim_conn_t *conn, const fu16_t length, const fu8_t *chipsahoy) { aim_frame_t *fr; - aim_snacid_t snacid; aim_tlvlist_t *tl = NULL; - - if (!sess || !conn || !sn) - return -EINVAL; - if ((sn[0] >= '0') && (sn[0] <= '9')) - return goddamnicq(sess, conn, sn); - - sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; - - aim_sendflapver(sess, conn); - - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn)))) + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0001, 4+2+2+length))) return -ENOMEM; - snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); - aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); - - aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); + aimbs_put32(&fr->data, 0x00000001); + aim_tlvlist_add_raw(&tl, 0x0006, length, chipsahoy); aim_tlvlist_write(&fr->data, &tl); aim_tlvlist_free(&tl); @@ -198,6 +181,8 @@ } /* + * Subtype 0x0002 + * * send_login(int socket, char *sn, char *password) * * This is the initial login request packet. @@ -239,12 +224,10 @@ /* * What the XORLOGIN flag _really_ means is that its an ICQ login, * which is really stupid and painful, so its not done here. - * */ if (sess->flags & AIM_SESS_FLAGS_XORLOGIN) return goddamnicq2(sess, conn, sn, password, ci); - if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 1152))) return -ENOMEM; @@ -256,9 +239,9 @@ aim_encode_password_md5(password, key, digest); aim_tlvlist_add_raw(&tl, 0x0025, 16, digest); - /* - * Newer versions of winaim have an empty type x004c TLV here. - */ +#ifndef USE_OLD_MD5 + aim_tlvlist_add_noval(&tl, 0x004c); +#endif if (ci->clientstring) aim_tlvlist_add_raw(&tl, 0x0003, strlen(ci->clientstring), ci->clientstring); @@ -268,8 +251,8 @@ aim_tlvlist_add_16(&tl, 0x0019, (fu16_t)ci->point); aim_tlvlist_add_16(&tl, 0x001a, (fu16_t)ci->build); aim_tlvlist_add_32(&tl, 0x0014, (fu32_t)ci->distrib); + aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); aim_tlvlist_add_raw(&tl, 0x000e, strlen(ci->country), ci->country); - aim_tlvlist_add_raw(&tl, 0x000f, strlen(ci->lang), ci->lang); #ifndef NOSSI /* @@ -288,59 +271,6 @@ return 0; } -faim_export int aim_encode_password_md5(const char *password, const char *key, fu8_t *digest) -{ - md5_state_t state; - - md5_init(&state); - md5_append(&state, (const md5_byte_t *)key, strlen(key)); - md5_append(&state, (const md5_byte_t *)password, strlen(password)); - md5_append(&state, (const md5_byte_t *)AIM_MD5_STRING, strlen(AIM_MD5_STRING)); - md5_finish(&state, (md5_byte_t *)digest); - - return 0; -} - -/** - * aim_encode_password - Encode a password using old XOR method - * @password: incoming password - * @encoded: buffer to put encoded password - * - * This takes a const pointer to a (null terminated) string - * containing the unencoded password. It also gets passed - * an already allocated buffer to store the encoded password. - * This buffer should be the exact length of the password without - * the null. The encoded password buffer /is not %NULL terminated/. - * - * The encoding_table seems to be a fixed set of values. We'll - * hope it doesn't change over time! - * - * This is only used for the XOR method, not the better MD5 method. - * - */ -static int aim_encode_password(const char *password, fu8_t *encoded) -{ - fu8_t encoding_table[] = { -#if 0 /* old v1 table */ - 0xf3, 0xb3, 0x6c, 0x99, - 0x95, 0x3f, 0xac, 0xb6, - 0xc5, 0xfa, 0x6b, 0x63, - 0x69, 0x6c, 0xc3, 0x9f -#else /* v2.1 table, also works for ICQ */ - 0xf3, 0x26, 0x81, 0xc4, - 0x39, 0x86, 0xdb, 0x92, - 0x71, 0xa3, 0xb9, 0xe6, - 0x53, 0x7a, 0x95, 0x7c -#endif - }; - int i; - - for (i = 0; i < strlen(password); i++) - encoded[i] = (password[i] ^ encoding_table[i]); - - return 0; -} - /* * This is sent back as a general response to the login command. * It can be either an error or a success, depending on the @@ -438,7 +368,7 @@ if (aim_tlv_gettlv(tlvlist, 0x0043, 1)) info->latestbeta.name = aim_tlv_getstr(tlvlist, 0x0043, 1); if (aim_tlv_gettlv(tlvlist, 0x0048, 1)) - ; /* no idea what this is */ + ; /* beta serial */ if (aim_tlv_gettlv(tlvlist, 0x0044, 1)) info->latestrelease.build = aim_tlv_get32(tlvlist, 0x0044, 1); @@ -449,7 +379,7 @@ if (aim_tlv_gettlv(tlvlist, 0x0047, 1)) info->latestrelease.name = aim_tlv_getstr(tlvlist, 0x0047, 1); if (aim_tlv_gettlv(tlvlist, 0x0049, 1)) - ; /* no idea what this is */ + ; /* lastest release serial */ /* * URL to change password. @@ -474,6 +404,102 @@ } /* + * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client + * + * This is a bit confusing. + * + * Normal SNAC login goes like this: + * - connect + * - server sends flap version + * - client sends flap version + * - client sends screen name (17/6) + * - server sends hash key (17/7) + * - client sends auth request (17/2 -- aim_send_login) + * - server yells + * + * XOR login (for ICQ) goes like this: + * - connect + * - server sends flap version + * - client sends auth request which contains flap version (aim_send_login) + * - server yells + * + * For the client API, we make them implement the most complicated version, + * and for the simpler version, we fake it and make it look like the more + * complicated process. + * + * This is done by giving the client a faked key, just so we can convince + * them to call aim_send_login right away, which will detect the session + * flag that says this is XOR login and ignore the key, sending an ICQ + * login request instead of the normal SNAC one. + * + * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. + * + * XXX This may cause problems if the client relies on callbacks only + * being called from the context of aim_rxdispatch()... + * + */ +static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn) +{ + aim_frame_t fr; + aim_rxcallback_t userfunc; + + sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN; + sess->flags |= AIM_SESS_FLAGS_XORLOGIN; + + fr.conn = conn; + + if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007))) + userfunc(sess, &fr, ""); + + return 0; +} + +/* + * Subtype 0x0006 + * + * In AIM 3.5 protocol, the first stage of login is to request login from the + * Authorizer, passing it the screen name for verification. If the name is + * invalid, a 0017/0003 is spit back, with the standard error contents. If + * valid, a 0017/0007 comes back, which is the signal to send it the main + * login command (0017/0002). + * + */ +faim_export int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) +{ + aim_frame_t *fr; + aim_snacid_t snacid; + aim_tlvlist_t *tl = NULL; + + if (!sess || !conn || !sn) + return -EINVAL; + + if ((sn[0] >= '0') && (sn[0] <= '9')) + return goddamnicq(sess, conn, sn); + + sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; + + aim_sendflapver(sess, conn); + + if (!(fr = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x02, 10+2+2+strlen(sn) /*+8*/ ))) + return -ENOMEM; + + snacid = aim_cachesnac(sess, 0x0017, 0x0006, 0x0000, NULL, 0); + aim_putsnac(&fr->data, 0x0017, 0x0006, 0x0000, snacid); + + aim_tlvlist_add_raw(&tl, 0x0001, strlen(sn), sn); +/* aim_tlvlist_add_noval(&tl, 0x004b); + aim_tlvlist_add_noval(&tl, 0x005a); */ + aim_tlvlist_write(&fr->data, &tl); + aim_tlvlist_free(&tl); + + aim_tx_enqueue(sess, fr); + + return 0; +} + +/* + * Subtype 0x0007 + * * Middle handler for 0017/0007 SNACs. Contains the auth key prefixed * by only its length in a two byte word. *
--- a/src/protocols/oscar/locate.c Mon Oct 13 23:20:07 2003 +0000 +++ b/src/protocols/oscar/locate.c Tue Oct 14 03:02:05 2003 +0000 @@ -30,6 +30,10 @@ /* * These are in ascending numerical order. */ + + /* + * Perhaps better called AIM_CAPS_SHORTCAPS + */ {AIM_CAPS_ICHAT, {0x09, 0x46, 0x00, 0x00, 0x4c, 0x7f, 0x11, 0xd1, 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}},
--- a/src/protocols/oscar/md5.h Mon Oct 13 23:20:07 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This code has some adaptations for the Ghostscript environment, but it - * will compile and run correctly in any environment with 8-bit chars and - * 32-bit ints. Specifically, it assumes that if the following are - * defined, they have the same meaning as in Ghostscript: P1, P2, P3, - * ARCH_IS_BIG_ENDIAN. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -#ifdef P1 -void md5_init(P1(md5_state_t *pms)); -#else -void md5_init(md5_state_t *pms); -#endif - -/* Append a string to the message. */ -#ifdef P3 -void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); -#else -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -#endif - -/* Finish the message and return the digest. */ -#ifdef P2 -void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); -#else -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); -#endif - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */
--- a/src/protocols/oscar/oscar.c Mon Oct 13 23:20:07 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Oct 14 03:02:05 2003 +0000 @@ -1347,7 +1347,7 @@ gaim_account_get_password(account), &info, key); } else { #if 0 - struct client_info_s info = {"gaim", 4, 1, 2010, "us", "en", 0x0004, 0x0000, 0x04b}; + struct client_info_s info = {"gaim", 7, 3, 2003, "us", "en", 0x0004, 0x0000, 0x04b}; #endif struct client_info_s info = CLIENTINFO_AIM_KNOWNGOOD; aim_send_login(sess, fr->conn, gaim_account_get_username(ac),
--- a/src/protocols/trepia/md5.h Mon Oct 13 23:20:07 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This code has some adaptations for the Ghostscript environment, but it - * will compile and run correctly in any environment with 8-bit chars and - * 32-bit ints. Specifically, it assumes that if the following are - * defined, they have the same meaning as in Ghostscript: P1, P2, P3, - * ARCH_IS_BIG_ENDIAN. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -#ifdef P1 -void md5_init(P1(md5_state_t *pms)); -#else -void md5_init(md5_state_t *pms); -#endif - -/* Append a string to the message. */ -#ifdef P3 -void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); -#else -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -#endif - -/* Finish the message and return the digest. */ -#ifdef P2 -void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); -#else -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); -#endif - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */
--- a/src/protocols/yahoo/md5.h Mon Oct 13 23:20:07 2003 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* - Copyright (C) 1999 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321. - It is derived directly from the text of the RFC and not from the - reference implementation. - - The original and principal author of md5.h is L. Peter Deutsch - <ghost@aladdin.com>. Other authors are noted in the change history - that follows (in reverse chronological order): - - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke <purschke@bnl.gov>. - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This code has some adaptations for the Ghostscript environment, but it - * will compile and run correctly in any environment with 8-bit chars and - * 32-bit ints. Specifically, it assumes that if the following are - * defined, they have the same meaning as in Ghostscript: P1, P2, P3, - * ARCH_IS_BIG_ENDIAN. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -#ifdef P1 -void md5_init(P1(md5_state_t *pms)); -#else -void md5_init(md5_state_t *pms); -#endif - -/* Append a string to the message. */ -#ifdef P3 -void md5_append(P3(md5_state_t *pms, const md5_byte_t *data, int nbytes)); -#else -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); -#endif - -/* Finish the message and return the digest. */ -#ifdef P2 -void md5_finish(P2(md5_state_t *pms, md5_byte_t digest[16])); -#else -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); -#endif - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */