- Timestamp:
- 2023-02-23T23:48:10Z (21 months ago)
- Branches:
- master
- Children:
- 93d4d8f
- Parents:
- 7342cae
- git-author:
- Jelmer Vernooij <jelmer@…> (23-02-23 23:48:10)
- git-committer:
- GitHub <noreply@…> (23-02-23 23:48:10)
- Location:
- lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/md5.c
r7342cae r1bdc669 28 28 void md5_digest_keep(md5_state_t *ctx, guint8 digest[MD5_HASH_SIZE]) 29 29 { 30 md5_state_t copy = g_checksum_copy(*ctx); 30 gsize digest_len = MD5_HASH_SIZE; 31 GChecksum *copy = g_checksum_copy(*ctx); 31 32 32 md5_finish(©, digest); 33 g_checksum_get_digest(copy, digest, &digest_len); 34 g_checksum_free(copy); 33 35 } 34 36 -
lib/md5.h
r7342cae r1bdc669 8 8 typedef GChecksum *md5_state_t; 9 9 10 11 10 #define MD5_HASH_SIZE 16 12 11 13 void md5_init(md5_state_t *); 14 void md5_append(md5_state_t *, const guint8 *, unsigned int); 15 void md5_finish(md5_state_t *, guint8 digest[MD5_HASH_SIZE]); 16 void md5_digest_keep(md5_state_t *, guint8 digest[MD5_HASH_SIZE]); 17 void md5_free(md5_state_t *); 12 #ifdef __GNUC__ 13 #define __MD5_NON_PUBLIC_DEPRECATION__ __attribute__((deprecated("md5.h will be removed from Bitlbee's public API. Please use another library (such as GLib's gchecksum) instead"))) 14 #else 15 #define __MD5_NON_PUBLIC_DEPRECATION__ 16 #endif 17 18 void md5_init(md5_state_t *) __MD5_NON_PUBLIC_DEPRECATION__; 19 void md5_append(md5_state_t *, const guint8 *, unsigned int) __MD5_NON_PUBLIC_DEPRECATION__; 20 void md5_finish(md5_state_t *, guint8 digest[MD5_HASH_SIZE]) __MD5_NON_PUBLIC_DEPRECATION__; 21 void md5_digest_keep(md5_state_t *, guint8 digest[MD5_HASH_SIZE]) __MD5_NON_PUBLIC_DEPRECATION__; 22 void md5_free(md5_state_t *) __MD5_NON_PUBLIC_DEPRECATION__; 18 23 19 24 #endif -
lib/misc.c
r7342cae r1bdc669 34 34 #include "nogaim.h" 35 35 #include "base64.h" 36 #include "md5.h"37 36 #include <stdio.h> 38 37 #include <stdlib.h> … … 47 46 #endif 48 47 49 #include "md5.h"50 48 #include "ssl_client.h" 51 49 … … 576 574 int md5_verify_password(char *password, char *hash) 577 575 { 578 md5_byte_t *pass_dec = NULL; 579 md5_byte_t pass_md5[16]; 580 md5_state_t md5_state; 576 guint8 *pass_dec = NULL; 577 guint8 pass_md5[16]; 578 GChecksum *md5_state; 579 gsize digest_len = MD5_HASH_SIZE; 581 580 int ret = -1, i; 582 581 583 582 if (base64_decode(hash, &pass_dec) == 21) { 584 md5_init(&md5_state); 585 md5_append(&md5_state, (md5_byte_t *) password, strlen(password)); 586 md5_append(&md5_state, (md5_byte_t *) pass_dec + 16, 5); /* Hmmm, salt! */ 587 md5_finish(&md5_state, pass_md5); 583 md5_state = g_checksum_new(G_CHECKSUM_MD5); 584 g_checksum_update(md5_state, (guint8 *) password, strlen(password)); 585 g_checksum_update(md5_state, (guint8 *) pass_dec + 16, 5); /* Hmmm, salt! */ 586 g_checksum_get_digest(md5_state, pass_md5, &digest_len); 587 g_checksum_free(md5_state); 588 588 589 589 for (i = 0; i < 16; i++) {
Note: See TracChangeset
for help on using the changeset viewer.