]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
better fix
authorMatthijs Mekking <github@pletterpet.nl>
Mon, 2 Dec 2013 15:15:49 +0000 (16:15 +0100)
committerMatthijs Mekking <github@pletterpet.nl>
Mon, 2 Dec 2013 15:15:49 +0000 (16:15 +0100)
sha1.c

diff --git a/sha1.c b/sha1.c
index bb2b97b44477fd54c0474d096aa5d837f2cf6530..18a4dd28f34e3f549724c6b43c0c05ce00895f41 100644 (file)
--- a/sha1.c
+++ b/sha1.c
 */
 
 /* #define LITTLE_ENDIAN * This should be #define'd already, if true. */
-/* #define SHA1HANDSOFF * Copies data before messing with it. */
 
 #include <ldns/config.h>
 #include <ldns/ldns.h>
 #include <strings.h>
 
+#define SHA1HANDSOFF 1 /* Copies data before messing with it. */
 #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
 
 /* blk0() and blk() perform the initial expand. */
@@ -122,21 +122,19 @@ ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int
 {
     unsigned int i;
     unsigned int j;
-    unsigned char d[len];
 
-    (void)memcpy((void*)d, data, len);
     j = (unsigned)(uint32_t)((context->count >> 3) & 63);
     context->count += (len << 3);
     if ((j + len) > 63) {
-        memmove(&context->buffer[j], d, (i = 64 - j));
+        memmove(&context->buffer[j], data, (i = 64 - j));
         ldns_sha1_transform(context->state, context->buffer);
         for ( ; i + 63 < len; i += 64) {
-            ldns_sha1_transform(context->state, &d[i]);
+            ldns_sha1_transform(context->state, &data[i]);
         }
         j = 0;
     }
     else i = 0;
-    memmove(&context->buffer[j], &d[i], len - i);
+    memmove(&context->buffer[j], &data[i], len - i);
 }