1.1 --- a/patches/glibc/2.1.3/rh62-03-glibc-2.1.3-crypt.patch Tue Aug 14 19:32:22 2007 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,207 +0,0 @@
1.4 ---- glibc-2.1.3/md5-crypt/md5-crypt.c 2000/03/04 00:47:30 1.1
1.5 -+++ glibc-2.1.3/md5-crypt/md5-crypt.c 2000/08/24 06:10:02 1.8
1.6 -@@ -1,5 +1,5 @@
1.7 - /* One way encryption based on MD5 sum.
1.8 -- Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
1.9 -+ Copyright (C) 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
1.10 - This file is part of the GNU C Library.
1.11 - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
1.12 -
1.13 -@@ -18,6 +18,7 @@
1.14 - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.15 - Boston, MA 02111-1307, USA. */
1.16 -
1.17 -+#include <assert.h>
1.18 - #include <errno.h>
1.19 - #include <stdlib.h>
1.20 - #include <string.h>
1.21 -@@ -37,9 +38,9 @@
1.22 -
1.23 -
1.24 - /* Prototypes for local functions. */
1.25 --extern char *__md5_crypt_r __P ((const char *key, const char *salt,
1.26 -- char *buffer, int buflen));
1.27 --extern char *__md5_crypt __P ((const char *key, const char *salt));
1.28 -+extern char *__md5_crypt_r (const char *key, const char *salt,
1.29 -+ char *buffer, int buflen);
1.30 -+extern char *__md5_crypt (const char *key, const char *salt);
1.31 -
1.32 -
1.33 - /* This entry point is equivalent to the `crypt' function in Unix
1.34 -@@ -51,13 +52,16 @@
1.35 - char *buffer;
1.36 - int buflen;
1.37 - {
1.38 -- unsigned char alt_result[16];
1.39 -+ unsigned char alt_result[16]
1.40 -+ __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
1.41 - struct md5_ctx ctx;
1.42 - struct md5_ctx alt_ctx;
1.43 - size_t salt_len;
1.44 - size_t key_len;
1.45 - size_t cnt;
1.46 - char *cp;
1.47 -+ char *copied_key = NULL;
1.48 -+ char *copied_salt = NULL;
1.49 -
1.50 - /* Find beginning of salt string. The prefix should normally always
1.51 - be present. Just in case it is not. */
1.52 -@@ -68,6 +72,26 @@
1.53 - salt_len = MIN (strcspn (salt, "$"), 8);
1.54 - key_len = strlen (key);
1.55 -
1.56 -+ if ((key - (char *) 0) % __alignof__ (md5_uint32) != 0)
1.57 -+ {
1.58 -+ char *tmp = (char *) alloca (key_len + __alignof__ (md5_uint32));
1.59 -+ key = copied_key =
1.60 -+ memcpy (tmp + __alignof__ (md5_uint32)
1.61 -+ - (tmp - (char *) 0) % __alignof__ (md5_uint32),
1.62 -+ key, key_len);
1.63 -+ assert ((key - (char *) 0) % __alignof__ (md5_uint32) == 0);
1.64 -+ }
1.65 -+
1.66 -+ if ((salt - (char *) 0) % __alignof__ (md5_uint32) != 0)
1.67 -+ {
1.68 -+ char *tmp = (char *) alloca (salt_len + __alignof__ (md5_uint32));
1.69 -+ salt = copied_salt =
1.70 -+ memcpy (tmp + __alignof__ (md5_uint32)
1.71 -+ - (tmp - (char *) 0) % __alignof__ (md5_uint32),
1.72 -+ salt, salt_len);
1.73 -+ assert ((salt - (char *) 0) % __alignof__ (md5_uint32) == 0);
1.74 -+ }
1.75 -+
1.76 - /* Prepare for the real work. */
1.77 - __md5_init_ctx (&ctx);
1.78 -
1.79 -@@ -195,21 +219,30 @@
1.80 -
1.81 - /* Clear the buffer for the intermediate result so that people
1.82 - attaching to processes or reading core dumps cannot get any
1.83 -- information. */
1.84 -- memset (alt_result, '\0', sizeof (alt_result));
1.85 -+ information. We do it in this way to clear correct_words[]
1.86 -+ inside the MD5 implementation as well. */
1.87 -+ __md5_init_ctx (&ctx);
1.88 -+ __md5_finish_ctx (&ctx, alt_result);
1.89 -+ memset (&ctx, '\0', sizeof (ctx));
1.90 -+ memset (&alt_ctx, '\0', sizeof (alt_ctx));
1.91 -+ if (copied_key != NULL)
1.92 -+ memset (copied_key, '\0', key_len);
1.93 -+ if (copied_salt != NULL)
1.94 -+ memset (copied_salt, '\0', salt_len);
1.95 -
1.96 - return buffer;
1.97 - }
1.98 -
1.99 -
1.100 -+static char *buffer;
1.101 -+
1.102 - char *
1.103 - __md5_crypt (const char *key, const char *salt)
1.104 - {
1.105 - /* We don't want to have an arbitrary limit in the size of the
1.106 - password. We can compute the size of the result in advance and
1.107 - so we can prepare the buffer we pass to `md5_crypt_r'. */
1.108 -- static char *buffer = NULL;
1.109 -- static int buflen = 0;
1.110 -+ static int buflen;
1.111 - int needed = 3 + strlen (salt) + 1 + 26 + 1;
1.112 -
1.113 - if (buflen < needed)
1.114 -@@ -220,4 +253,12 @@
1.115 - }
1.116 -
1.117 - return __md5_crypt_r (key, salt, buffer, buflen);
1.118 -+}
1.119 -+
1.120 -+
1.121 -+static void
1.122 -+__attribute__ ((__destructor__))
1.123 -+free_mem (void)
1.124 -+{
1.125 -+ free (buffer);
1.126 - }
1.127 ---- glibc-2.1.3/md5-crypt/md5.c 2000/03/04 00:47:30 1.1
1.128 -+++ glibc-2.1.3/md5-crypt/md5.c 2000/07/04 18:22:44 1.2
1.129 -@@ -1,6 +1,6 @@
1.130 --/* md5.c - Functions to compute MD5 message digest of files or memory blocks
1.131 -+/* Functions to compute MD5 message digest of files or memory blocks.
1.132 - according to the definition of MD5 in RFC 1321 from April 1992.
1.133 -- Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
1.134 -+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
1.135 - This file is part of the GNU C Library.
1.136 -
1.137 - The GNU C Library is free software; you can redistribute it and/or
1.138 -@@ -217,6 +217,8 @@
1.139 - size_t len;
1.140 - struct md5_ctx *ctx;
1.141 - {
1.142 -+ //const void aligned_buffer = buffer;
1.143 -+
1.144 - /* When we already have some bits in our internal buffer concatenate
1.145 - both inputs first. */
1.146 - if (ctx->buflen != 0)
1.147 -@@ -224,16 +226,20 @@
1.148 - size_t left_over = ctx->buflen;
1.149 - size_t add = 128 - left_over > len ? len : 128 - left_over;
1.150 -
1.151 -+ /* Only put full words in the buffer. */
1.152 -+ add -= add % __alignof__ (md5_uint32);
1.153 -+
1.154 - memcpy (&ctx->buffer[left_over], buffer, add);
1.155 - ctx->buflen += add;
1.156 -
1.157 -- if (left_over + add > 64)
1.158 -+ if (ctx->buflen > 64)
1.159 - {
1.160 -- md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
1.161 -+ md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
1.162 -+
1.163 -+ ctx->buflen &= 63;
1.164 - /* The regions in the following copy operation cannot overlap. */
1.165 - memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
1.166 -- (left_over + add) & 63);
1.167 -- ctx->buflen = (left_over + add) & 63;
1.168 -+ ctx->buflen);
1.169 - }
1.170 -
1.171 - buffer = (const char *) buffer + add;
1.172 -@@ -251,8 +257,17 @@
1.173 - /* Move remaining bytes in internal buffer. */
1.174 - if (len > 0)
1.175 - {
1.176 -- memcpy (ctx->buffer, buffer, len);
1.177 -- ctx->buflen = len;
1.178 -+ size_t left_over = ctx->buflen;
1.179 -+
1.180 -+ memcpy (&ctx->buffer[left_over], buffer, len);
1.181 -+ left_over += len;
1.182 -+ if (left_over >= 64)
1.183 -+ {
1.184 -+ md5_process_block (ctx->buffer, 64, ctx);
1.185 -+ left_over -= 64;
1.186 -+ memcpy (ctx->buffer, &ctx->buffer[64], left_over);
1.187 -+ }
1.188 -+ ctx->buflen = left_over;
1.189 - }
1.190 - }
1.191 -
1.192 ---- glibc-2.1.3/md5-crypt/md5.h 2000/03/04 00:47:30 1.1
1.193 -+++ glibc-2.1.3/md5-crypt/md5.h 2000/07/04 18:22:44 1.2
1.194 -@@ -1,6 +1,6 @@
1.195 - /* Declaration of functions and data types used for MD5 sum computing
1.196 - library functions.
1.197 -- Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
1.198 -+ Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
1.199 - This file is part of the GNU C Library.
1.200 -
1.201 - The GNU C Library is free software; you can redistribute it and/or
1.202 -@@ -87,7 +87,7 @@
1.203 -
1.204 - md5_uint32 total[2];
1.205 - md5_uint32 buflen;
1.206 -- char buffer[128];
1.207 -+ char buffer[128] __attribute__ ((__aligned__ (__alignof__ (md5_uint32))));
1.208 - };
1.209 -
1.210 - /*