You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1998/05/04 19:10:13 UTC

cvs commit: apache-1.3/src/main md5c.c

martin      98/05/04 10:10:13

  Modified:    src/main md5c.c
  Log:
  Add EBCDIC conversion to MD5 digestion
  
  Revision  Changes    Path
  1.13      +20 -0     apache-1.3/src/main/md5c.c
  
  Index: md5c.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/md5c.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -u -r1.12 -r1.13
  --- md5c.c	1998/04/11 12:00:31	1.12
  +++ md5c.c	1998/05/04 17:10:12	1.13
  @@ -193,6 +193,7 @@
       partLen = 64 - idx;
   
       /* Transform as many times as possible. */
  +#ifndef CHARSET_EBCDIC
       if (inputLen >= partLen) {
   	memcpy(&context->buffer[idx], input, partLen);
   	MD5Transform(context->state, context->buffer);
  @@ -207,6 +208,25 @@
   
       /* Buffer remaining input */
       memcpy(&context->buffer[idx], &input[i], inputLen - i);
  +#else /*CHARSET_EBCDIC*/
  +    if (inputLen >= partLen) {
  +	ebcdic2ascii(&context->buffer[idx], input, partLen);
  +	MD5Transform(context->state, context->buffer);
  +
  +	for (i = partLen; i + 63 < inputLen; i += 64) {
  +	    unsigned char inp_tmp[64];
  +	    ebcdic2ascii(inp_tmp, &input[i], 64);
  +	    MD5Transform(context->state, inp_tmp);
  +	}
  +
  +	idx = 0;
  +    }
  +    else
  +	i = 0;
  +
  +    /* Buffer remaining input */
  +    ebcdic2ascii(&context->buffer[idx], &input[i], inputLen - i);
  +#endif /*CHARSET_EBCDIC*/
   }
   
   /* MD5 finalization. Ends an MD5 message-digest operation, writing the