601 lines
21 KiB
Diff
601 lines
21 KiB
Diff
|
diff --git a/lib/ChangeLog b/lib/ChangeLog
|
||
|
index 1b8b42b..cf77688 100644
|
||
|
--- a/lib/ChangeLog
|
||
|
+++ b/lib/ChangeLog
|
||
|
@@ -1,3 +1,13 @@
|
||
|
+2011-07-09 Roland McGrath <roland@hack.frob.com>
|
||
|
+
|
||
|
+ * sha1.c (be64_copy): New function.
|
||
|
+ (sha1_finish_ctx): Use it.
|
||
|
+ * md5.c (le64_copy): New function.
|
||
|
+ (md5_finish_ctx): Use it.
|
||
|
+ * system.h (LE32, BE32): New macros, using <endian.h> and <byteswap.h>.
|
||
|
+ * md5.c (SWAP): Use LE32.
|
||
|
+ * sha1.c (SWAP): Use BE32.
|
||
|
+
|
||
|
2010-06-16 Roland McGrath <roland@redhat.com>
|
||
|
|
||
|
* dynamicsizehash.h (HASHTYPE): New macro.
|
||
|
diff --git a/lib/md5.c b/lib/md5.c
|
||
|
index 0770561..1f2d5d3 100644
|
||
|
--- a/lib/md5.c
|
||
|
+++ b/lib/md5.c
|
||
|
@@ -1,6 +1,6 @@
|
||
|
/* Functions to compute MD5 message digest of files or memory blocks.
|
||
|
according to the definition of MD5 in RFC 1321 from April 1992.
|
||
|
- Copyright (C) 1995,1996,1997,1999,2000,2001,2005 Red Hat, Inc.
|
||
|
+ Copyright (C) 1995-2011 Red Hat, Inc.
|
||
|
This file is part of Red Hat elfutils.
|
||
|
Written by Ulrich Drepper <drepper@redhat.com>, 1995.
|
||
|
|
||
|
@@ -29,20 +29,14 @@
|
||
|
# include <config.h>
|
||
|
#endif
|
||
|
|
||
|
-#include <endian.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <sys/types.h>
|
||
|
|
||
|
#include "md5.h"
|
||
|
+#include "system.h"
|
||
|
|
||
|
-#if __BYTE_ORDER == __BIG_ENDIAN
|
||
|
-# define SWAP(n) \
|
||
|
- (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
|
||
|
-#else
|
||
|
-# define SWAP(n) (n)
|
||
|
-#endif
|
||
|
-
|
||
|
+#define SWAP(n) LE32 (n)
|
||
|
|
||
|
/* This array contains the bytes used to pad the buffer to the next
|
||
|
64-byte boundary. (RFC 1321, 3.1: Step 1) */
|
||
|
@@ -82,6 +76,16 @@ md5_read_ctx (ctx, resbuf)
|
||
|
return resbuf;
|
||
|
}
|
||
|
|
||
|
+static void
|
||
|
+le64_copy (char *dest, uint64_t x)
|
||
|
+{
|
||
|
+ for (size_t i = 0; i < 8; ++i)
|
||
|
+ {
|
||
|
+ dest[i] = (uint8_t) x;
|
||
|
+ x >>= 8;
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
/* Process the remaining bytes in the internal buffer and the usual
|
||
|
prolog according to the standard and write the result to RESBUF.
|
||
|
|
||
|
@@ -105,9 +109,10 @@ md5_finish_ctx (ctx, resbuf)
|
||
|
memcpy (&ctx->buffer[bytes], fillbuf, pad);
|
||
|
|
||
|
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||
|
- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
|
||
|
- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
|
||
|
- (ctx->total[0] >> 29));
|
||
|
+ const uint64_t bit_length = ((ctx->total[0] << 3)
|
||
|
+ + ((uint64_t) ((ctx->total[1] << 3) |
|
||
|
+ (ctx->total[0] >> 29)) << 32));
|
||
|
+ le64_copy (&ctx->buffer[bytes + pad], bit_length);
|
||
|
|
||
|
/* Process last bytes. */
|
||
|
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
|
||
|
diff --git a/lib/sha1.c b/lib/sha1.c
|
||
|
index 0459cd6..53ddb78 100644
|
||
|
--- a/lib/sha1.c
|
||
|
+++ b/lib/sha1.c
|
||
|
@@ -1,6 +1,6 @@
|
||
|
/* Functions to compute SHA1 message digest of files or memory blocks.
|
||
|
according to the definition of SHA1 in FIPS 180-1 from April 1997.
|
||
|
- Copyright (C) 2008 Red Hat, Inc.
|
||
|
+ Copyright (C) 2008-2011 Red Hat, Inc.
|
||
|
This file is part of Red Hat elfutils.
|
||
|
Written by Ulrich Drepper <drepper@redhat.com>, 2008.
|
||
|
|
||
|
@@ -29,20 +29,14 @@
|
||
|
# include <config.h>
|
||
|
#endif
|
||
|
|
||
|
-#include <endian.h>
|
||
|
#include <stdlib.h>
|
||
|
#include <string.h>
|
||
|
#include <sys/types.h>
|
||
|
|
||
|
#include "sha1.h"
|
||
|
+#include "system.h"
|
||
|
|
||
|
-#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||
|
-# include <byteswap.h>
|
||
|
-# define SWAP(n) bswap_32 (n)
|
||
|
-#else
|
||
|
-# define SWAP(n) (n)
|
||
|
-#endif
|
||
|
-
|
||
|
+#define SWAP(n) BE32 (n)
|
||
|
|
||
|
/* This array contains the bytes used to pad the buffer to the next
|
||
|
64-byte boundary. */
|
||
|
@@ -83,6 +77,13 @@ sha1_read_ctx (ctx, resbuf)
|
||
|
return resbuf;
|
||
|
}
|
||
|
|
||
|
+static void
|
||
|
+be64_copy (char *dest, uint64_t x)
|
||
|
+{
|
||
|
+ for (size_t i = 8; i-- > 0; x >>= 8)
|
||
|
+ dest[i] = (uint8_t) x;
|
||
|
+}
|
||
|
+
|
||
|
/* Process the remaining bytes in the internal buffer and the usual
|
||
|
prolog according to the standard and write the result to RESBUF.
|
||
|
|
||
|
@@ -106,9 +107,10 @@ sha1_finish_ctx (ctx, resbuf)
|
||
|
memcpy (&ctx->buffer[bytes], fillbuf, pad);
|
||
|
|
||
|
/* Put the 64-bit file length in *bits* at the end of the buffer. */
|
||
|
- *(sha1_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) |
|
||
|
- (ctx->total[0] >> 29));
|
||
|
- *(sha1_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3);
|
||
|
+ const uint64_t bit_length = ((ctx->total[0] << 3)
|
||
|
+ + ((uint64_t) ((ctx->total[1] << 3) |
|
||
|
+ (ctx->total[0] >> 29)) << 32));
|
||
|
+ be64_copy (&ctx->buffer[bytes + pad], bit_length);
|
||
|
|
||
|
/* Process last bytes. */
|
||
|
sha1_process_block (ctx->buffer, bytes + pad + 8, ctx);
|
||
|
diff --git a/lib/system.h b/lib/system.h
|
||
|
index 10b4734..2695426 100644
|
||
|
--- a/lib/system.h
|
||
|
+++ b/lib/system.h
|
||
|
@@ -1,5 +1,5 @@
|
||
|
/* Declarations for common convenience functions.
|
||
|
- Copyright (C) 2006, 2009 Red Hat, Inc.
|
||
|
+ Copyright (C) 2006-2011 Red Hat, Inc.
|
||
|
This file is part of Red Hat elfutils.
|
||
|
|
||
|
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||
|
@@ -51,6 +51,18 @@
|
||
|
|
||
|
#include <stddef.h>
|
||
|
#include <stdint.h>
|
||
|
+#include <endian.h>
|
||
|
+#include <byteswap.h>
|
||
|
+
|
||
|
+#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||
|
+# define LE32(n) (n)
|
||
|
+# define BE32(n) bswap_32 (n)
|
||
|
+#elif __BYTE_ORDER == __BIG_ENDIAN
|
||
|
+# define BE32(n) (n)
|
||
|
+# define LE32(n) bswap_32 (n)
|
||
|
+#else
|
||
|
+# error "Unknown byte order"
|
||
|
+#endif
|
||
|
|
||
|
extern void *xmalloc (size_t) __attribute__ ((__malloc__));
|
||
|
extern void *xcalloc (size_t, size_t) __attribute__ ((__malloc__));
|
||
|
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
|
||
|
index 0cbeb85..720b767 100644
|
||
|
--- a/libdwfl/ChangeLog
|
||
|
+++ b/libdwfl/ChangeLog
|
||
|
@@ -1,3 +1,7 @@
|
||
|
+2011-07-09 Roland McGrath <roland@hack.frob.com>
|
||
|
+
|
||
|
+ * image-header.c (LE32): Macro removed (now in lib/system.h).
|
||
|
+
|
||
|
2011-02-11 Roland McGrath <roland@redhat.com>
|
||
|
|
||
|
* linux-kernel-modules.c (try_kernel_name): Try .gz, .bz2, .xz
|
||
|
diff --git a/libdwfl/image-header.c b/libdwfl/image-header.c
|
||
|
index 6341fc8..c36d10c 100644
|
||
|
--- a/libdwfl/image-header.c
|
||
|
+++ b/libdwfl/image-header.c
|
||
|
@@ -1,5 +1,5 @@
|
||
|
/* Linux kernel image support for libdwfl.
|
||
|
- Copyright (C) 2009 Red Hat, Inc.
|
||
|
+ Copyright (C) 2009-2011 Red Hat, Inc.
|
||
|
This file is part of Red Hat elfutils.
|
||
|
|
||
|
Red Hat elfutils is free software; you can redistribute it and/or modify
|
||
|
@@ -55,10 +55,8 @@
|
||
|
|
||
|
#if BYTE_ORDER == LITTLE_ENDIAN
|
||
|
# define LE16(x) (x)
|
||
|
-# define LE32(x) (x)
|
||
|
#else
|
||
|
# define LE16(x) bswap_16 (x)
|
||
|
-# define LE32(x) bswap_32 (x)
|
||
|
#endif
|
||
|
|
||
|
/* See Documentation/x86/boot.txt in Linux kernel sources
|
||
|
diff --git a/tests/ChangeLog b/tests/ChangeLog
|
||
|
index bc78843..61027de 100644
|
||
|
--- a/tests/ChangeLog
|
||
|
+++ b/tests/ChangeLog
|
||
|
@@ -1,3 +1,13 @@
|
||
|
+2011-07-09 Roland McGrath <roland@hack.frob.com>
|
||
|
+
|
||
|
+ * sha1-tst.c: File removed.
|
||
|
+ * Makefile.am (noinst_PROGRAMS, TESTS): Remove it.
|
||
|
+ (sha1_tst_LDADD): Variable removed.
|
||
|
+
|
||
|
+ * md5-sha1-test.c: New file.
|
||
|
+ * Makefile.am [!STANDALONE] (noinst_PROGRAMS, TESTS): Add it.
|
||
|
+ (md5_sha1_test_LDADD): New variable.
|
||
|
+
|
||
|
2011-02-02 Josh Stone <jistone@redhat.com>
|
||
|
|
||
|
* run-prelink-addr-test.sh: Add testfile55, 32 and 64-bit.
|
||
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||
|
index b317553..e05cd92 100644
|
||
|
--- a/tests/Makefile.am
|
||
|
+++ b/tests/Makefile.am
|
||
|
@@ -57,7 +57,7 @@ noinst_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
|
||
|
dwfl-bug-addr-overflow arls dwfl-bug-fd-leak \
|
||
|
dwfl-addr-sect dwfl-bug-report early-offscn \
|
||
|
dwfl-bug-getmodules dwarf-getmacros addrcfi \
|
||
|
- test-flag-nobits
|
||
|
+ test-flag-nobits md5-sha1-test
|
||
|
asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
|
||
|
asm-tst6 asm-tst7 asm-tst8 asm-tst9
|
||
|
|
||
|
@@ -87,8 +87,8 @@ TESTS = run-arextract.sh run-arsymtest.sh newfile test-nlist \
|
||
|
# run-show-ciefde.sh
|
||
|
|
||
|
if !STANDALONE
|
||
|
-noinst_PROGRAMS += msg_tst sha1-tst
|
||
|
-TESTS += msg_tst sha1-tst
|
||
|
+noinst_PROGRAMS += msg_tst md5-sha1-test
|
||
|
+TESTS += msg_tst md5-sha1-test
|
||
|
endif
|
||
|
|
||
|
if HAVE_LIBASM
|
||
|
@@ -244,10 +244,10 @@ dwfl_bug_fd_leak_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
-sha1_tst_LDADD = $(libeu) $(libmudflap)
|
||
|
dwarf_getmacros_LDADD = $(libdw) $(libmudflap)
|
||
|
addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
test_flag_nobits_LDADD = $(libelf) $(libmudflap)
|
||
|
+md5_sha1_test_LDADD = $(libeu)
|
||
|
|
||
|
if GCOV
|
||
|
check: check-am coverage
|
||
|
diff --git a/tests/md5-sha1-test.c b/tests/md5-sha1-test.c
|
||
|
new file mode 100644
|
||
|
index 0000000..af2e80a
|
||
|
--- /dev/null
|
||
|
+++ b/tests/md5-sha1-test.c
|
||
|
@@ -0,0 +1,109 @@
|
||
|
+/* Copyright (C) 2011 Red Hat, Inc.
|
||
|
+ This file is part of Red Hat elfutils.
|
||
|
+
|
||
|
+ Red Hat elfutils is free software; you can redistribute it and/or modify
|
||
|
+ it under the terms of the GNU General Public License as published by the
|
||
|
+ Free Software Foundation; version 2 of the License.
|
||
|
+
|
||
|
+ Red Hat elfutils is distributed in the hope that it will be useful, but
|
||
|
+ WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
+ General Public License for more details.
|
||
|
+
|
||
|
+ You should have received a copy of the GNU General Public License along
|
||
|
+ with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||
|
+ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||
|
+
|
||
|
+ Red Hat elfutils is an included package of the Open Invention Network.
|
||
|
+ An included package of the Open Invention Network is a package for which
|
||
|
+ Open Invention Network licensees cross-license their patents. No patent
|
||
|
+ license is granted, either expressly or impliedly, by designation as an
|
||
|
+ included package. Should you wish to participate in the Open Invention
|
||
|
+ Network licensing program, please visit www.openinventionnetwork.com
|
||
|
+ <http://www.openinventionnetwork.com>. */
|
||
|
+
|
||
|
+#ifdef HAVE_CONFIG_H
|
||
|
+# include <config.h>
|
||
|
+#endif
|
||
|
+
|
||
|
+#include <string.h>
|
||
|
+#include <error.h>
|
||
|
+
|
||
|
+#include "md5.h"
|
||
|
+#include "sha1.h"
|
||
|
+
|
||
|
+static const struct expected
|
||
|
+{
|
||
|
+ const char *sample;
|
||
|
+ const char *md5_expected;
|
||
|
+ const char *sha1_expected;
|
||
|
+} tests[] =
|
||
|
+ {
|
||
|
+ {
|
||
|
+ "abc",
|
||
|
+ "\x90\x01\x50\x98\x3c\xd2\x4f\xb0\xd6\x96\x3f\x7d\x28\xe1\x7f\x72",
|
||
|
+ "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
|
||
|
+ "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d"
|
||
|
+ },
|
||
|
+ {
|
||
|
+ "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
|
||
|
+ "\x82\x15\xef\x07\x96\xa2\x0b\xca\xaa\xe1\x16\xd3\x87\x6c\x66\x4a",
|
||
|
+ "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
|
||
|
+ "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1"
|
||
|
+ },
|
||
|
+ {
|
||
|
+ "\0a",
|
||
|
+ "\x77\x07\xd6\xae\x4e\x02\x7c\x70\xee\xa2\xa9\x35\xc2\x29\x6f\x21",
|
||
|
+ "\x34\xaa\x97\x3c\xd4\xc4\xda\xa4\xf6\x1e"
|
||
|
+ "\xeb\x2b\xdb\xad\x27\x31\x65\x34\x01\x6f",
|
||
|
+ },
|
||
|
+ {
|
||
|
+ "When in the Course of human events it becomes necessary",
|
||
|
+ "\x62\x6b\x5e\x22\xcd\x3d\x02\xea\x07\xde\xd4\x50\x62\x3d\xb9\x96",
|
||
|
+ "\x66\xc3\xc6\x8d\x62\x91\xc5\x1e\x63\x0c"
|
||
|
+ "\x85\xc8\x6c\xc4\x4b\x3a\x79\x3e\x07\x28",
|
||
|
+ },
|
||
|
+ };
|
||
|
+#define NTESTS (sizeof tests / sizeof tests[0])
|
||
|
+
|
||
|
+#define md5_size 16
|
||
|
+#define sha1_size 20
|
||
|
+
|
||
|
+static const char md5_expected[] =
|
||
|
+ {
|
||
|
+ };
|
||
|
+
|
||
|
+static const char sha1_expected[] =
|
||
|
+ {
|
||
|
+ };
|
||
|
+
|
||
|
+#define TEST_HASH(ALGO, I) \
|
||
|
+ { \
|
||
|
+ struct ALGO##_ctx ctx; \
|
||
|
+ uint32_t result_buffer[(ALGO##_size + 3) / 4]; \
|
||
|
+ ALGO##_init_ctx (&ctx); \
|
||
|
+ if (tests[I].sample[0] == '\0') \
|
||
|
+ { \
|
||
|
+ char input_buffer[1000]; \
|
||
|
+ memset (input_buffer, tests[I].sample[1], sizeof input_buffer); \
|
||
|
+ for (int rept = 0; rept < 1000; ++rept) \
|
||
|
+ ALGO##_process_bytes (input_buffer, sizeof input_buffer, &ctx); \
|
||
|
+ } \
|
||
|
+ else \
|
||
|
+ ALGO##_process_bytes (tests[I].sample, strlen (tests[I].sample), &ctx); \
|
||
|
+ char *result = ALGO##_finish_ctx (&ctx, result_buffer); \
|
||
|
+ if (result != (void *) result_buffer \
|
||
|
+ || memcmp (result, tests[I].ALGO##_expected, ALGO##_size) != 0) \
|
||
|
+ error (0, 0, #ALGO " test %zu failed", 1 + I); \
|
||
|
+ }
|
||
|
+
|
||
|
+int
|
||
|
+main (void)
|
||
|
+{
|
||
|
+ for (size_t i = 0; i < NTESTS; ++i)
|
||
|
+ {
|
||
|
+ TEST_HASH (md5, i);
|
||
|
+ TEST_HASH (sha1, i);
|
||
|
+ }
|
||
|
+ return error_message_count;
|
||
|
+}
|
||
|
diff --git a/tests/sha1-tst.c b/tests/sha1-tst.c
|
||
|
deleted file mode 100644
|
||
|
index 9ff8141..0000000
|
||
|
--- a/tests/sha1-tst.c
|
||
|
+++ /dev/null
|
||
|
@@ -1,79 +0,0 @@
|
||
|
-/* Copyright (C) 2008 Red Hat, Inc.
|
||
|
- This file is part of Red Hat elfutils.
|
||
|
- Written by Ulrich Drepper <drepper@redhat.com>, 2008.
|
||
|
-
|
||
|
- Red Hat elfutils is free software; you can redistribute it and/or modify
|
||
|
- it under the terms of the GNU General Public License as published by the
|
||
|
- Free Software Foundation; version 2 of the License.
|
||
|
-
|
||
|
- Red Hat elfutils is distributed in the hope that it will be useful, but
|
||
|
- WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
- General Public License for more details.
|
||
|
-
|
||
|
- You should have received a copy of the GNU General Public License along
|
||
|
- with Red Hat elfutils; if not, write to the Free Software Foundation,
|
||
|
- Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
|
||
|
-
|
||
|
- Red Hat elfutils is an included package of the Open Invention Network.
|
||
|
- An included package of the Open Invention Network is a package for which
|
||
|
- Open Invention Network licensees cross-license their patents. No patent
|
||
|
- license is granted, either expressly or impliedly, by designation as an
|
||
|
- included package. Should you wish to participate in the Open Invention
|
||
|
- Network licensing program, please visit www.openinventionnetwork.com
|
||
|
- <http://www.openinventionnetwork.com>. */
|
||
|
-
|
||
|
-#include <stdio.h>
|
||
|
-#include <string.h>
|
||
|
-
|
||
|
-#include <sha1.h>
|
||
|
-
|
||
|
-
|
||
|
-int
|
||
|
-main (void)
|
||
|
-{
|
||
|
- char buf[1000];
|
||
|
- int result = 0;
|
||
|
-
|
||
|
- struct sha1_ctx ctx;
|
||
|
- sha1_init_ctx (&ctx);
|
||
|
- sha1_process_bytes ("abc", 3, &ctx);
|
||
|
- sha1_finish_ctx (&ctx, buf);
|
||
|
- static const char expected1[SHA1_DIGEST_SIZE] =
|
||
|
- "\xa9\x99\x3e\x36\x47\x06\x81\x6a\xba\x3e"
|
||
|
- "\x25\x71\x78\x50\xc2\x6c\x9c\xd0\xd8\x9d";
|
||
|
- if (memcmp (buf, expected1, SHA1_DIGEST_SIZE) != 0)
|
||
|
- {
|
||
|
- puts ("test 1 failed");
|
||
|
- result = 1;
|
||
|
- }
|
||
|
-
|
||
|
- sha1_init_ctx (&ctx);
|
||
|
- sha1_process_bytes ("\
|
||
|
-abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56, &ctx);
|
||
|
- sha1_finish_ctx (&ctx, buf);
|
||
|
- static const char expected2[SHA1_DIGEST_SIZE] =
|
||
|
- "\x84\x98\x3e\x44\x1c\x3b\xd2\x6e\xba\xae"
|
||
|
- "\x4a\xa1\xf9\x51\x29\xe5\xe5\x46\x70\xf1";
|
||
|
- if (memcmp (buf, expected2, SHA1_DIGEST_SIZE) != 0)
|
||
|
- {
|
||
|
- puts ("test 2 failed");
|
||
|
- result = 1;
|
||
|
- }
|
||
|
-
|
||
|
- sha1_init_ctx (&ctx);
|
||
|
- memset (buf, 'a', sizeof (buf));
|
||
|
- for (int i = 0; i < 1000; ++i)
|
||
|
- sha1_process_bytes (buf, sizeof (buf), &ctx);
|
||
|
- sha1_finish_ctx (&ctx, buf);
|
||
|
- static const char expected3[SHA1_DIGEST_SIZE] =
|
||
|
- "\x34\xaa\x97\x3c\xd4\xc4\xda\xa4\xf6\x1e"
|
||
|
- "\xeb\x2b\xdb\xad\x27\x31\x65\x34\x01\x6f";
|
||
|
- if (memcmp (buf, expected3, SHA1_DIGEST_SIZE) != 0)
|
||
|
- {
|
||
|
- puts ("test 3 failed");
|
||
|
- result = 1;
|
||
|
- }
|
||
|
-
|
||
|
- return result;
|
||
|
-}
|
||
|
--- elfutils-0.152/tests/Makefile.in 2011-02-15 15:30:26.000000000 +0100
|
||
|
+++ /home/mark/src/elfutils/tests/Makefile.in 2012-01-20 21:23:50.626395712 +0100
|
||
|
@@ -59,7 +59,8 @@
|
||
|
dwfl-addr-sect$(EXEEXT) dwfl-bug-report$(EXEEXT) \
|
||
|
early-offscn$(EXEEXT) dwfl-bug-getmodules$(EXEEXT) \
|
||
|
dwarf-getmacros$(EXEEXT) addrcfi$(EXEEXT) \
|
||
|
- test-flag-nobits$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3)
|
||
|
+ test-flag-nobits$(EXEEXT) md5-sha1-test$(EXEEXT) \
|
||
|
+ $(am__EXEEXT_1) $(am__EXEEXT_3)
|
||
|
TESTS = run-arextract.sh run-arsymtest.sh newfile$(EXEEXT) \
|
||
|
test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \
|
||
|
update3$(EXEEXT) update4$(EXEEXT) run-show-die-info.sh \
|
||
|
@@ -83,8 +84,8 @@
|
||
|
run-dwarf-getmacros.sh run-test-flag-nobits.sh \
|
||
|
run-prelink-addr-test.sh $(am__EXEEXT_1) $(am__EXEEXT_3)
|
||
|
# run-show-ciefde.sh
|
||
|
-@STANDALONE_FALSE@am__append_5 = msg_tst sha1-tst
|
||
|
-@STANDALONE_FALSE@am__append_6 = msg_tst sha1-tst
|
||
|
+@STANDALONE_FALSE@am__append_5 = msg_tst md5-sha1-test
|
||
|
+@STANDALONE_FALSE@am__append_6 = msg_tst md5-sha1-test
|
||
|
@HAVE_LIBASM_TRUE@am__append_7 = $(asm_TESTS)
|
||
|
@HAVE_LIBASM_TRUE@am__append_8 = $(asm_TESTS)
|
||
|
subdir = tests
|
||
|
@@ -98,7 +99,8 @@
|
||
|
CONFIG_HEADER = $(top_builddir)/config.h
|
||
|
CONFIG_CLEAN_FILES =
|
||
|
CONFIG_CLEAN_VPATH_FILES =
|
||
|
-@STANDALONE_FALSE@am__EXEEXT_1 = msg_tst$(EXEEXT) sha1-tst$(EXEEXT)
|
||
|
+@STANDALONE_FALSE@am__EXEEXT_1 = msg_tst$(EXEEXT) \
|
||
|
+@STANDALONE_FALSE@ md5-sha1-test$(EXEEXT)
|
||
|
am__EXEEXT_2 = asm-tst1$(EXEEXT) asm-tst2$(EXEEXT) asm-tst3$(EXEEXT) \
|
||
|
asm-tst4$(EXEEXT) asm-tst5$(EXEEXT) asm-tst6$(EXEEXT) \
|
||
|
asm-tst7$(EXEEXT) asm-tst8$(EXEEXT) asm-tst9$(EXEEXT)
|
||
|
@@ -252,6 +254,9 @@
|
||
|
line2addr_SOURCES = line2addr.c
|
||
|
line2addr_OBJECTS = line2addr.$(OBJEXT)
|
||
|
line2addr_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_1)
|
||
|
+md5_sha1_test_SOURCES = md5-sha1-test.c
|
||
|
+md5_sha1_test_OBJECTS = md5-sha1-test.$(OBJEXT)
|
||
|
+md5_sha1_test_DEPENDENCIES = $(libeu)
|
||
|
msg_tst_SOURCES = msg_tst.c
|
||
|
msg_tst_OBJECTS = msg_tst.$(OBJEXT)
|
||
|
msg_tst_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
|
||
|
@@ -273,9 +278,6 @@
|
||
|
sectiondump_SOURCES = sectiondump.c
|
||
|
sectiondump_OBJECTS = sectiondump.$(OBJEXT)
|
||
|
sectiondump_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1)
|
||
|
-sha1_tst_SOURCES = sha1-tst.c
|
||
|
-sha1_tst_OBJECTS = sha1-tst.$(OBJEXT)
|
||
|
-sha1_tst_DEPENDENCIES = $(libeu) $(am__DEPENDENCIES_1)
|
||
|
show_abbrev_SOURCES = show-abbrev.c
|
||
|
show_abbrev_OBJECTS = show-abbrev.$(OBJEXT)
|
||
|
show_abbrev_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2) \
|
||
|
@@ -323,11 +325,11 @@
|
||
|
dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \
|
||
|
dwflmodtest.c early-offscn.c ecp.c find-prologues.c \
|
||
|
funcretval.c funcscopes.c get-aranges.c get-files.c \
|
||
|
- get-lines.c get-pubnames.c hash.c line2addr.c msg_tst.c \
|
||
|
- newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \
|
||
|
- sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \
|
||
|
- showptable.c test-flag-nobits.c test-nlist.c update1.c \
|
||
|
- update2.c update3.c update4.c
|
||
|
+ get-lines.c get-pubnames.c hash.c line2addr.c md5-sha1-test.c \
|
||
|
+ msg_tst.c newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \
|
||
|
+ sectiondump.c show-abbrev.c show-die-info.c showptable.c \
|
||
|
+ test-flag-nobits.c test-nlist.c update1.c update2.c update3.c \
|
||
|
+ update4.c
|
||
|
DIST_SOURCES = addrcfi.c addrscopes.c allfcts.c allregs.c arextract.c \
|
||
|
arls.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \
|
||
|
asm-tst5.c asm-tst6.c asm-tst7.c asm-tst8.c asm-tst9.c \
|
||
|
@@ -335,11 +337,11 @@
|
||
|
dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \
|
||
|
dwflmodtest.c early-offscn.c ecp.c find-prologues.c \
|
||
|
funcretval.c funcscopes.c get-aranges.c get-files.c \
|
||
|
- get-lines.c get-pubnames.c hash.c line2addr.c msg_tst.c \
|
||
|
- newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \
|
||
|
- sectiondump.c sha1-tst.c show-abbrev.c show-die-info.c \
|
||
|
- showptable.c test-flag-nobits.c test-nlist.c update1.c \
|
||
|
- update2.c update3.c update4.c
|
||
|
+ get-lines.c get-pubnames.c hash.c line2addr.c md5-sha1-test.c \
|
||
|
+ msg_tst.c newfile.c newscn.c rdwrmmap.c saridx.c scnnames.c \
|
||
|
+ sectiondump.c show-abbrev.c show-die-info.c showptable.c \
|
||
|
+ test-flag-nobits.c test-nlist.c update1.c update2.c update3.c \
|
||
|
+ update4.c
|
||
|
ETAGS = etags
|
||
|
CTAGS = ctags
|
||
|
am__tty_colors = \
|
||
|
@@ -611,10 +613,10 @@
|
||
|
dwfl_bug_report_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
dwfl_bug_getmodules_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
dwfl_addr_sect_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
-sha1_tst_LDADD = $(libeu) $(libmudflap)
|
||
|
dwarf_getmacros_LDADD = $(libdw) $(libmudflap)
|
||
|
addrcfi_LDADD = $(libdw) $(libebl) $(libelf) $(libmudflap) -ldl
|
||
|
test_flag_nobits_LDADD = $(libelf) $(libmudflap)
|
||
|
+md5_sha1_test_LDADD = $(libeu)
|
||
|
all: all-am
|
||
|
|
||
|
.SUFFIXES:
|
||
|
@@ -754,6 +756,9 @@
|
||
|
line2addr$(EXEEXT): $(line2addr_OBJECTS) $(line2addr_DEPENDENCIES)
|
||
|
@rm -f line2addr$(EXEEXT)
|
||
|
$(LINK) $(line2addr_OBJECTS) $(line2addr_LDADD) $(LIBS)
|
||
|
+md5-sha1-test$(EXEEXT): $(md5_sha1_test_OBJECTS) $(md5_sha1_test_DEPENDENCIES)
|
||
|
+ @rm -f md5-sha1-test$(EXEEXT)
|
||
|
+ $(LINK) $(md5_sha1_test_OBJECTS) $(md5_sha1_test_LDADD) $(LIBS)
|
||
|
msg_tst$(EXEEXT): $(msg_tst_OBJECTS) $(msg_tst_DEPENDENCIES)
|
||
|
@rm -f msg_tst$(EXEEXT)
|
||
|
$(LINK) $(msg_tst_OBJECTS) $(msg_tst_LDADD) $(LIBS)
|
||
|
@@ -775,9 +780,6 @@
|
||
|
sectiondump$(EXEEXT): $(sectiondump_OBJECTS) $(sectiondump_DEPENDENCIES)
|
||
|
@rm -f sectiondump$(EXEEXT)
|
||
|
$(LINK) $(sectiondump_OBJECTS) $(sectiondump_LDADD) $(LIBS)
|
||
|
-sha1-tst$(EXEEXT): $(sha1_tst_OBJECTS) $(sha1_tst_DEPENDENCIES)
|
||
|
- @rm -f sha1-tst$(EXEEXT)
|
||
|
- $(LINK) $(sha1_tst_OBJECTS) $(sha1_tst_LDADD) $(LIBS)
|
||
|
show-abbrev$(EXEEXT): $(show_abbrev_OBJECTS) $(show_abbrev_DEPENDENCIES)
|
||
|
@rm -f show-abbrev$(EXEEXT)
|
||
|
$(LINK) $(show_abbrev_OBJECTS) $(show_abbrev_LDADD) $(LIBS)
|
||
|
@@ -846,6 +848,7 @@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/get-pubnames.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line2addr.Po@am__quote@
|
||
|
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5-sha1-test.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_tst.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newfile.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/newscn.Po@am__quote@
|
||
|
@@ -853,7 +856,6 @@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saridx.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scnnames.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sectiondump.Po@am__quote@
|
||
|
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1-tst.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-abbrev.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/show-die-info.Po@am__quote@
|
||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/showptable.Po@am__quote@
|