Ignore:
Timestamp:
2023-02-23T23:48:10Z (21 months ago)
Author:
GitHub <noreply@…>
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)
Message:

Migrate internal users of md5.h to using GChecksum directly (#169)

  • Use GChecksum directly rather than md5 wrapper
  • Mark md5 functions as deprecated.
  • Migrate more users of md5.h to GChecksum
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/jabber/jabber.c

    r7342cae r1bdc669  
    3333#include "jabber.h"
    3434#include "oauth.h"
    35 #include "md5.h"
    3635
    3736GSList *jabber_connections;
     
    301300}
    302301
    303 /* This generates an unfinished md5_state_t variable. Every time we generate
     302/* This generates an unfinished g_checksum variable. Every time we generate
    304303   an ID, we finish the state by adding a sequence number and take the hash. */
    305304static void jabber_generate_id_hash(struct jabber_data *jd)
    306305{
    307         md5_byte_t binbuf[4];
     306        guint8 binbuf[4];
    308307        char *s;
    309308
    310         md5_init(&jd->cached_id_prefix);
    311         md5_append(&jd->cached_id_prefix, (unsigned char *) jd->username, strlen(jd->username));
    312         md5_append(&jd->cached_id_prefix, (unsigned char *) jd->server, strlen(jd->server));
     309        jd->cached_id_prefix = g_checksum_new(G_CHECKSUM_MD5);
     310        g_checksum_update(jd->cached_id_prefix, jd->username, strlen(jd->username));
     311        g_checksum_update(jd->cached_id_prefix, jd->server, strlen(jd->server));
    313312        s = set_getstr(&jd->ic->acc->set, "resource");
    314         md5_append(&jd->cached_id_prefix, (unsigned char *) s, strlen(s));
     313        g_checksum_update(jd->cached_id_prefix, s, strlen(s));
    315314        random_bytes(binbuf, 4);
    316         md5_append(&jd->cached_id_prefix, binbuf, 4);
     315        g_checksum_update(jd->cached_id_prefix, binbuf, 4);
    317316}
    318317
     
    371370        xt_free(jd->xt);
    372371
    373         md5_free(&jd->cached_id_prefix);
     372        g_checksum_free(jd->cached_id_prefix);
    374373
    375374        g_free(jd->oauth2_access_token);
Note: See TracChangeset for help on using the changeset viewer.