Changeset 5198:9cfb5ac98e26 for imap

Show
Ignore:
Timestamp:
2007-08-27 11:07:42 (15 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Update auth_cram for new MD5 code (untested).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • imap/auth_cram.c

    r4463 r5198  
    135135  unsigned char* response) 
    136136{ 
    137   MD5_CTX ctx; 
     137  struct md5_ctx ctx; 
    138138  unsigned char ipad[MD5_BLOCK_LEN], opad[MD5_BLOCK_LEN]; 
    139139  unsigned char secret[MD5_BLOCK_LEN+1]; 
     
    149149  if (secret_len > MD5_BLOCK_LEN) 
    150150  { 
    151     MD5Init (&ctx); 
    152     MD5Update (&ctx, (unsigned char*) password, secret_len); 
    153     MD5Final (hash_passwd, &ctx); 
     151    md5_buffer (password, secret_len, hash_passwd); 
    154152    strfcpy ((char*) secret, (char*) hash_passwd, MD5_DIGEST_LEN); 
    155153    secret_len = MD5_DIGEST_LEN; 
     
    170168 
    171169  /* 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); 
    176174 
    177175  /* 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); 
    182180}