~ubuntu-branches/ubuntu/lucid/mutt/lucid-updates

« back to all changes in this revision

Viewing changes to imap/auth_cram.c

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2007-11-03 23:00:04 UTC
  • mto: (16.1.1 sid) (1.1.11 upstream) (2.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20071103230004-l98yi0j504i7yjjl
Tags: upstream-1.5.17
ImportĀ upstreamĀ versionĀ 1.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
static void hmac_md5 (const char* password, char* challenge,
135
135
  unsigned char* response)
136
136
{
137
 
  MD5_CTX ctx;
 
137
  struct md5_ctx ctx;
138
138
  unsigned char ipad[MD5_BLOCK_LEN], opad[MD5_BLOCK_LEN];
139
139
  unsigned char secret[MD5_BLOCK_LEN+1];
140
140
  unsigned char hash_passwd[MD5_DIGEST_LEN];
148
148
   * digests */
149
149
  if (secret_len > MD5_BLOCK_LEN)
150
150
  {
151
 
    MD5Init (&ctx);
152
 
    MD5Update (&ctx, (unsigned char*) password, secret_len);
153
 
    MD5Final (hash_passwd, &ctx);
 
151
    md5_buffer (password, secret_len, hash_passwd);
154
152
    strfcpy ((char*) secret, (char*) hash_passwd, MD5_DIGEST_LEN);
155
153
    secret_len = MD5_DIGEST_LEN;
156
154
  }
169
167
  }
170
168
 
171
169
  /* inner hash: challenge and ipadded secret */
172
 
  MD5Init (&ctx);
173
 
  MD5Update (&ctx, ipad, MD5_BLOCK_LEN);
174
 
  MD5Update (&ctx, (unsigned char*) challenge, chal_len);
175
 
  MD5Final (response, &ctx);
 
170
  md5_init_ctx (&ctx);
 
171
  md5_process_bytes (ipad, MD5_BLOCK_LEN, &ctx);
 
172
  md5_process_bytes (challenge, chal_len, &ctx);
 
173
  md5_finish_ctx (&ctx, response);
176
174
 
177
175
  /* outer hash: inner hash and opadded secret */
178
 
  MD5Init (&ctx);
179
 
  MD5Update (&ctx, opad, MD5_BLOCK_LEN);
180
 
  MD5Update (&ctx, response, MD5_DIGEST_LEN);
181
 
  MD5Final (response, &ctx);
 
176
  md5_init_ctx (&ctx);
 
177
  md5_process_bytes (opad, MD5_BLOCK_LEN, &ctx);
 
178
  md5_process_bytes (response, MD5_DIGEST_LEN, &ctx);
 
179
  md5_finish_ctx (&ctx, response);
182
180
}