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) ...@@ -613,7 +613,7 @@ message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten)
613 else 613 else
614 { 614 {
615 size_t uid = 0; 615 size_t uid = 0;
616 MD5_CTX md5context; 616 struct md5_ctx md5context;
617 stream_t stream = NULL; 617 stream_t stream = NULL;
618 char buf[1024]; 618 char buf[1024];
619 off_t offset = 0; 619 off_t offset = 0;
...@@ -622,14 +622,14 @@ message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten) ...@@ -622,14 +622,14 @@ message_get_uidl (message_t msg, char *buffer, size_t buflen, size_t *pwriten)
622 n = 0; 622 n = 0;
623 message_get_uid (msg, &uid); 623 message_get_uid (msg, &uid);
624 message_get_stream (msg, &stream); 624 message_get_stream (msg, &stream);
625 MD5Init (&md5context); 625 md5_init_ctx (&md5context);
626 while (stream_read (stream, buf, sizeof (buf), offset, &n) == 0 626 while (stream_read (stream, buf, sizeof (buf), offset, &n) == 0
627 && n > 0) 627 && n > 0)
628 { 628 {
629 MD5Update (&md5context, (unsigned char*)buf, n); 629 md5_process_bytes (buf, n, &md5context);
630 offset += n; 630 offset += n;
631 } 631 }
632 MD5Final (md5digest, &md5context); 632 md5_finish_ctx (&md5context, md5digest);
633 tmp = buf; 633 tmp = buf;
634 for (n = 0; n < 16; n++, tmp += 2) 634 for (n = 0; n < 16; n++, tmp += 2)
635 sprintf (tmp, "%02x", md5digest[n]); 635 sprintf (tmp, "%02x", md5digest[n]);
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
...@@ -2065,7 +2065,7 @@ pop_get_timestamp (pop_data_t mpd) ...@@ -2065,7 +2065,7 @@ pop_get_timestamp (pop_data_t mpd)
2065 static int 2065 static int
2066 pop_get_md5 (pop_data_t mpd) 2066 pop_get_md5 (pop_data_t mpd)
2067 { 2067 {
2068 MD5_CTX md5context; 2068 struct md5_ctx md5context;
2069 unsigned char md5digest[16]; 2069 unsigned char md5digest[16];
2070 char digest[64]; /* Really it just has to be 32 + 1(null). */ 2070 char digest[64]; /* Really it just has to be 32 + 1(null). */
2071 char *tmp; 2071 char *tmp;
...@@ -2076,10 +2076,11 @@ pop_get_md5 (pop_data_t mpd) ...@@ -2076,10 +2076,11 @@ pop_get_md5 (pop_data_t mpd)
2076 if (timestamp == NULL) 2076 if (timestamp == NULL)
2077 return EINVAL; 2077 return EINVAL;
2078 2078
2079 MD5Init (&md5context); 2079 md5_init_ctx (&md5context);
2080 MD5Update (&md5context, (unsigned char *)timestamp, strlen (timestamp)); 2080 md5_process_bytes (timestamp, strlen (timestamp), &md5context);
2081 MD5Update (&md5context, (unsigned char *)mpd->passwd, strlen (mpd->passwd)); 2081 md5_process_bytes (mpd->passwd, strlen (mpd->passwd), &md5context);
2082 MD5Final (md5digest, &md5context); 2082 md5_finish_ctx (&md5context, md5digest);
2083
2083 for (tmp = digest, n = 0; n < 16; n++, tmp += 2) 2084 for (tmp = digest, n = 0; n < 16; n++, tmp += 2)
2084 sprintf (tmp, "%02x", md5digest[n]); 2085 sprintf (tmp, "%02x", md5digest[n]);
2085 *tmp = '\0'; 2086 *tmp = '\0';
......
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000, 2001, 2003 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 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) ...@@ -52,16 +52,16 @@ mu_pop3_apop (mu_pop3_t pop3, const char *user, const char *secret)
52 /* Generate the md5 from the secret and timestamp. */ 52 /* Generate the md5 from the secret and timestamp. */
53 case MU_POP3_NO_STATE: 53 case MU_POP3_NO_STATE:
54 { 54 {
55 MD5_CTX md5context; 55 struct md5_ctx md5context;
56 unsigned char md5digest[16]; 56 unsigned char md5digest[16];
57 char digest[64]; /* Really it just has to be 32 + 1(null). */ 57 char digest[64]; /* Really it just has to be 32 + 1(null). */
58 char *tmp; 58 char *tmp;
59 size_t n; 59 size_t n;
60 60
61 MD5Init (&md5context); 61 md5_init_ctx (&md5context);
62 MD5Update (&md5context, (unsigned char *)pop3->timestamp, strlen (pop3->timestamp)); 62 md5_process_bytes (pop3->timestamp, strlen (pop3->timestamp), &md5context);
63 MD5Update (&md5context, (unsigned char *)secret, strlen (secret)); 63 md5_process_bytes (secret, strlen (secret), &md5context);
64 MD5Final (md5digest, &md5context); 64 md5_finish_ctx (&md5context, md5digest);
65 for (tmp = digest, n = 0; n < 16; n++, tmp += 2) 65 for (tmp = digest, n = 0; n < 16; n++, tmp += 2)
66 { 66 {
67 sprintf (tmp, "%02x", md5digest[n]); 67 sprintf (tmp, "%02x", md5digest[n]);
......