Changeset a4ac9c4
- Timestamp:
- 2023-04-01T20:09:39Z (20 months ago)
- Branches:
- master
- Children:
- 552da22
- Parents:
- 59c9fa4d
- git-author:
- Jelmer Vernooij <jelmer@…> (01-04-23 20:09:39)
- git-committer:
- GitHub <noreply@…> (01-04-23 20:09:39)
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/sha1.c
r59c9fa4d ra4ac9c4 100 100 char *ret = g_new0(char, 40); /* 36 chars + \0 */ 101 101 int i, p; 102 gsize digest_len = SHA1_HASH_SIZE; 102 103 103 sha1_finish(context, dig); 104 g_checksum_get_digest(*context, dig, &digest_len); 105 g_checksum_free(*context); 106 104 107 for (p = i = 0; i < 16; i++) { 105 108 if (i == 4 || i == 6 || i == 8 || i == 10) { -
lib/sha1.h
r59c9fa4d ra4ac9c4 6 6 #include <gmodule.h> 7 7 8 #ifdef __GNUC__ 9 #define __SHA1_NON_PUBLIC_DEPRECATION__ __attribute__((deprecated("sha1.h will be removed from Bitlbee's public API. Please use another library (such as GLib's gchecksum) instead"))) 10 #else 11 #define __SHA1_NON_PUBLIC_DEPRECATION__ 12 #endif 13 8 14 #define SHA1_HASH_SIZE 20 9 15 10 16 typedef GChecksum *sha1_state_t; 11 17 12 void sha1_init(sha1_state_t *) ;13 void sha1_append(sha1_state_t *, const guint8 *, unsigned int) ;14 void sha1_finish(sha1_state_t *, guint8 digest[SHA1_HASH_SIZE]) ;15 void sha1_hmac(const char *, size_t, const char *, size_t, guint8 digest[SHA1_HASH_SIZE]) ;18 void sha1_init(sha1_state_t *) __SHA1_NON_PUBLIC_DEPRECATION__; 19 void sha1_append(sha1_state_t *, const guint8 *, unsigned int) __SHA1_NON_PUBLIC_DEPRECATION__; 20 void sha1_finish(sha1_state_t *, guint8 digest[SHA1_HASH_SIZE]) __SHA1_NON_PUBLIC_DEPRECATION__; 21 void sha1_hmac(const char *, size_t, const char *, size_t, guint8 digest[SHA1_HASH_SIZE]) ; 16 22 char *sha1_random_uuid(sha1_state_t *); 17 23 -
protocols/jabber/conference.c
r59c9fa4d ra4ac9c4 23 23 24 24 #include "jabber.h" 25 #include "sha1.h"26 25 27 26 static xt_status jabber_chat_join_failed(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); … … 79 78 struct jabber_chat *jc; 80 79 struct groupchat *c; 81 sha1_state_tsum;80 GChecksum *sum; 82 81 double now = gettime(); 83 82 char *uuid, *rjid, *cserv; 84 83 85 s ha1_init(&sum);86 sha1_append(&sum, (uint8_t *) ic->acc->user, strlen(ic->acc->user));87 sha1_append(&sum, (uint8_t *) &now, sizeof(now));88 sha1_append(&sum, (uint8_t *) who, strlen(who));89 uuid = sha1_random_uuid( &sum);84 sum = g_checksum_new(G_CHECKSUM_SHA1); 85 g_checksum_update(sum, (uint8_t *) ic->acc->user, strlen(ic->acc->user)); 86 g_checksum_update(sum, (uint8_t *) &now, sizeof(now)); 87 g_checksum_update(sum, (uint8_t *) who, strlen(who)); 88 uuid = sha1_random_uuid(sum); 90 89 91 90 if (jd->flags & JFLAG_GTALK) { -
protocols/jabber/iq.c
r59c9fa4d ra4ac9c4 23 23 24 24 #include "jabber.h" 25 #include "sha1.h"26 25 27 26 static xt_status jabber_parse_roster(struct im_connection *ic, struct xt_node *node, struct xt_node *orig); … … 245 244 /* We can do digest authentication, it seems, and of 246 245 course we prefer that. */ 247 sha1_state_tsha;246 GChecksum *sha; 248 247 char hash_hex[41]; 249 248 unsigned char hash[20]; 250 249 int i; 251 252 sha1_init(&sha); 253 sha1_append(&sha, (unsigned char *) s, strlen(s)); 254 sha1_append(&sha, (unsigned char *) ic->acc->pass, strlen(ic->acc->pass)); 255 sha1_finish(&sha, hash); 250 gsize digest_len = 20; 251 252 sha = g_checksum_new(G_CHECKSUM_SHA1); 253 g_checksum_update(sha, (unsigned char *) s, strlen(s)); 254 g_checksum_update(sha, (unsigned char *) ic->acc->pass, strlen(ic->acc->pass)); 255 g_checksum_get_digest(sha, hash, &digest_len); 256 g_checksum_free(sha); 256 257 257 258 for (i = 0; i < 20; i++) { -
protocols/jabber/si.c
r59c9fa4d ra4ac9c4 23 23 24 24 #include "jabber.h" 25 #include "sha1.h"26 25 27 26 void jabber_si_answer_request(file_transfer_t *ft);
Note: See TracChangeset
for help on using the changeset viewer.