Changeset 5198:9cfb5ac98e26 for imap/auth_cram.c
- Timestamp:
- 2007-08-27 11:07:42 (17 months ago)
- Branch:
- HEAD
- Files:
-
- 1 modified
-
imap/auth_cram.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
imap/auth_cram.c
r4463 r5198 135 135 unsigned char* response) 136 136 { 137 MD5_CTXctx;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]; … … 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; … … 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 }
