httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@hyperreal.org
Subject cvs commit: apache-1.3/src/main md5c.c
Date Wed, 13 May 1998 15:31:02 GMT
martin      98/05/13 08:31:02

  Modified:    src/os/bs2000 ebcdic.h ebcdic.c
               src/main md5c.c
  Log:
  Fix digest authentication for EBCDIC charset
  
  Revision  Changes    Path
  1.4       +1 -0      apache-1.3/src/os/bs2000/ebcdic.h
  
  Index: ebcdic.h
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/bs2000/ebcdic.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -u -r1.3 -r1.4
  --- ebcdic.h	1998/04/01 14:09:08	1.3
  +++ ebcdic.h	1998/05/13 15:31:00	1.4
  @@ -3,5 +3,6 @@
   extern const unsigned char os_toascii[256];
   extern const unsigned char os_toebcdic[256];
   void ebcdic2ascii(unsigned char *dest, const unsigned char *srce, size_t count);
  +void ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count);
   void ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count);
   
  
  
  
  1.7       +7 -0      apache-1.3/src/os/bs2000/ebcdic.c
  
  Index: ebcdic.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/os/bs2000/ebcdic.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- ebcdic.c	1998/04/01 14:09:08	1.6
  +++ ebcdic.c	1998/05/13 15:31:01	1.7
  @@ -237,6 +237,13 @@
   	}
   }
   void
  +ebcdic2ascii_strictly(unsigned char *dest, const unsigned char *srce, size_t count)
  +{
  +	while (count-- != 0) {
  +		*dest++ = os_toascii_strictly[*srce++];
  +	}
  +}
  +void
   ascii2ebcdic(unsigned char *dest, const unsigned char *srce, size_t count)
   {
   	while (count-- != 0) {
  
  
  
  1.14      +22 -3     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.13
  retrieving revision 1.14
  diff -u -u -r1.13 -r1.14
  --- md5c.c	1998/05/04 17:10:12	1.13
  +++ md5c.c	1998/05/13 15:31:02	1.14
  @@ -92,6 +92,9 @@
   
   #include "conf.h"
   #include "md5.h"
  +#ifdef CHARSET_EBCDIC
  +#include "ebcdic.h"
  +#endif /*CHARSET_EBCDIC*/
   
   /* Constants for MD5Transform routine.
    */
  @@ -210,12 +213,12 @@
       memcpy(&context->buffer[idx], &input[i], inputLen - i);
   #else /*CHARSET_EBCDIC*/
       if (inputLen >= partLen) {
  -	ebcdic2ascii(&context->buffer[idx], input, partLen);
  +	ebcdic2ascii_strictly(&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);
  +	    ebcdic2ascii_strictly(inp_tmp, &input[i], 64);
   	    MD5Transform(context->state, inp_tmp);
   	}
   
  @@ -225,7 +228,7 @@
   	i = 0;
   
       /* Buffer remaining input */
  -    ebcdic2ascii(&context->buffer[idx], &input[i], inputLen - i);
  +    ebcdic2ascii_strictly(&context->buffer[idx], &input[i], inputLen - i);
   #endif /*CHARSET_EBCDIC*/
   }
   
  @@ -237,8 +240,24 @@
       unsigned char bits[8];
       unsigned int idx, padLen;
   
  +
       /* Save number of bits */
       Encode(bits, context->count, 8);
  +
  +#ifdef CHARSET_EBCDIC
  +    /* XXX: @@@: In order to make this no more complex than necessary,
  +     * this kludge converts the bits[] array using the ascii-to-ebcdic
  +     * table, because the following ap_MD5Update() re-translates
  +     * its input (ebcdic-to-ascii).
  +     * Otherwise, we would have to pass a "conversion" flag to ap_MD5Update()
  +     */
  +    ascii2ebcdic(bits,bits,8);
  +
  +    /* Since everything is converted to ascii within ap_MD5Update(), 
  +     * the initial 0x80 (PADDING[0]) must be stored as 0x20 
  +     */
  +    PADDING[0] = os_toebcdic[0x80];
  +#endif /*CHARSET_EBCDIC*/
   
       /* Pad out to 56 mod 64. */
       idx = (unsigned int) ((context->count[0] >> 3) & 0x3f);
  
  
  

Mime
View raw message