Commit b7e63952 b7e63952ad3afdc823ed4a95ffa92289e61820b2 by Sergey Poznyakoff

Use new md5 calls

1 parent f400a22e
......@@ -613,7 +613,7 @@ message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten)
else
{
size_t uid = 0;
MD5_CTX md5context;
struct md5_ctx md5context;
stream_t stream = NULL;
char buf[1024];
off_t offset = 0;
......@@ -622,14 +622,14 @@ message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten)
n = 0;
message_get_uid (msg, &uid);
message_get_stream (msg, &stream);
MD5Init (&md5context);
md5_init_ctx (&md5context);
while (stream_read (stream, buf, sizeof (buf), offset, &n) == 0
&& n > 0)
{
MD5Update (&md5context, (unsigned char*)buf, n);
md5_process_bytes (buf, n, &md5context);
offset += n;
}
MD5Final (md5digest, &md5context);
md5_finish_ctx (&md5context, md5digest);
tmp = buf;
for (n = 0; n < 16; n++, tmp += 2)
sprintf (tmp, "%02x", md5digest[n]);
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -2065,7 +2065,7 @@ pop_get_timestamp (pop_data_t mpd)
static int
pop_get_md5 (pop_data_t mpd)
{
MD5_CTX md5context;
struct md5_ctx md5context;
unsigned char md5digest[16];
char digest[64]; /* Really it just has to be 32 + 1(null). */
char *tmp;
......@@ -2076,10 +2076,11 @@ pop_get_md5 (pop_data_t mpd)
if (timestamp == NULL)
return EINVAL;
MD5Init (&md5context);
MD5Update (&md5context, (unsigned char *)timestamp, strlen (timestamp));
MD5Update (&md5context, (unsigned char *)mpd->passwd, strlen (mpd->passwd));
MD5Final (md5digest, &md5context);
md5_init_ctx (&md5context);
md5_process_bytes (timestamp, strlen (timestamp), &md5context);
md5_process_bytes (mpd->passwd, strlen (mpd->passwd), &md5context);
md5_finish_ctx (&md5context, md5digest);
for (tmp = digest, n = 0; n < 16; n++, tmp += 2)
sprintf (tmp, "%02x", md5digest[n]);
*tmp = '\0';
......
/* GNU Mailutils -- a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
......@@ -52,16 +52,16 @@ mu_pop3_apop (mu_pop3_t pop3, const char *user, const char *secret)
/* Generate the md5 from the secret and timestamp. */
case MU_POP3_NO_STATE:
{
MD5_CTX md5context;
struct md5_ctx md5context;
unsigned char md5digest[16];
char digest[64]; /* Really it just has to be 32 + 1(null). */
char *tmp;
size_t n;
MD5Init (&md5context);
MD5Update (&md5context, (unsigned char *)pop3->timestamp, strlen (pop3->timestamp));
MD5Update (&md5context, (unsigned char *)secret, strlen (secret));
MD5Final (md5digest, &md5context);
md5_init_ctx (&md5context);
md5_process_bytes (pop3->timestamp, strlen (pop3->timestamp), &md5context);
md5_process_bytes (secret, strlen (secret), &md5context);
md5_finish_ctx (&md5context, md5digest);
for (tmp = digest, n = 0; n < 16; n++, tmp += 2)
{
sprintf (tmp, "%02x", md5digest[n]);
......