Mercurial > pidgin
comparison libpurple/protocols/qq/crypt.c @ 22544:217fffe3f46f
Patch from ccpaging to clean up some QQ stuff. I removed the now commented
out qq_crypt() instead of, well, comment it out.
author | Ka-Hing Cheung <khc@hxbc.us> |
---|---|
date | Mon, 24 Mar 2008 07:14:29 +0000 |
parents | 44b4e8bd759b |
children | 9a5d140400f1 |
comparison
equal
deleted
inserted
replaced
22543:06f195789c3e | 22544:217fffe3f46f |
---|---|
97 *count += 8; /* outstrlen increase by 8 */ | 97 *count += 8; /* outstrlen increase by 8 */ |
98 *pos_in_block = 0; /* back to start */ | 98 *pos_in_block = 0; /* back to start */ |
99 *is_header = 0; /* and exit header */ | 99 *is_header = 0; /* and exit header */ |
100 } /* encrypt_block */ | 100 } /* encrypt_block */ |
101 | 101 |
102 static void qq_encrypt(const guint8 *const instr, gint instrlen, | 102 void qq_encrypt(const guint8 *const instr, gint instrlen, |
103 const guint8 *const key, | 103 const guint8 *const key, |
104 guint8 *outstr, gint *outstrlen_ptr) | 104 guint8 *outstr, gint *outstrlen_ptr) |
105 { | 105 { |
106 guint8 plain[8], /* plain text buffer */ | 106 guint8 plain[8], /* plain text buffer */ |
107 plain_pre_8[8], /* plain text buffer, previous 8 bytes */ | 107 plain_pre_8[8], /* plain text buffer, previous 8 bytes */ |
209 | 209 |
210 return 1; | 210 return 1; |
211 } | 211 } |
212 | 212 |
213 /* return 0 if failed, 1 otherwise */ | 213 /* return 0 if failed, 1 otherwise */ |
214 static gint qq_decrypt(const guint8 *const instr, gint instrlen, | 214 gint qq_decrypt(const guint8 *const instr, gint instrlen, |
215 const guint8 *const key, | 215 const guint8 *const key, |
216 guint8 *outstr, gint *outstrlen_ptr) | 216 guint8 *outstr, gint *outstrlen_ptr) |
217 { | 217 { |
218 guint8 decrypted[8], m[8], *outp; | 218 guint8 decrypted[8], m[8], *outp; |
219 const guint8 *crypt_buff, *crypt_buff_pre_8; | 219 const guint8 *crypt_buff, *crypt_buff_pre_8; |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 return 1; | 297 return 1; |
298 } | 298 } |
299 | |
300 /* return 1 is succeed, otherwise return 0 */ | |
301 gint qq_crypt(gint flag, | |
302 const guint8 *const instr, gint instrlen, | |
303 const guint8 *const key, | |
304 guint8 *outstr, gint *outstrlen_ptr) | |
305 { | |
306 if (flag == DECRYPT) | |
307 return qq_decrypt(instr, instrlen, key, outstr, outstrlen_ptr); | |
308 else if (flag == ENCRYPT) | |
309 qq_encrypt(instr, instrlen, key, outstr, outstrlen_ptr); | |
310 else | |
311 return 0; | |
312 | |
313 return 1; | |
314 } |