Changeset 1bdc669 for storage_xml.c


Ignore:
Timestamp:
2023-02-23T23:48:10Z (14 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
  • storage_xml.c

    r7342cae r1bdc669  
    2828#include "base64.h"
    2929#include "arc.h"
    30 #include "md5.h"
    3130#include "xmltree.h"
    3231
     
    323322        char *pass_buf = NULL;
    324323        account_t *acc;
    325         md5_byte_t pass_md5[21];
    326         md5_state_t md5_state;
     324        guint8 pass_md5[21];
     325        GChecksum *md5_state;
    327326        GSList *l;
    328327        struct xt_node *root, *cur;
     328        gsize digest_len = MD5_HASH_SIZE;
    329329
    330330        root = cur = xt_new_node("user", NULL, NULL);
     
    336336                   byte password hash, more convenient for base64 encoding. */
    337337                random_bytes(pass_md5 + 16, 5);
    338                 md5_init(&md5_state);
    339                 md5_append(&md5_state, (md5_byte_t *) irc->password, strlen(irc->password));
    340                 md5_append(&md5_state, pass_md5 + 16, 5);   /* Add the salt. */
    341                 md5_finish(&md5_state, pass_md5);
     338                md5_state = g_checksum_new(G_CHECKSUM_MD5);
     339                g_checksum_update(md5_state, (guint8 *) irc->password, strlen(irc->password));
     340                g_checksum_update(md5_state, pass_md5 + 16, 5);   /* Add the salt. */
     341                g_checksum_get_digest(md5_state, pass_md5, &digest_len);
     342                g_checksum_free(md5_state);
    342343                /* Save the hash in base64-encoded form. */
    343344                pass_buf = base64_encode(pass_md5, 21);
Note: See TracChangeset for help on using the changeset viewer.