summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2012-12-16 17:33:57 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2012-12-16 17:33:57 +0100
commitf95d74a4ad782371b4f6fe63b93bf9bb8acc70b7 (patch)
treef9c45171b86f6e0dfc1bb3507b68ac0b3889b569
parentposix: Doxygen Enhancement Task #7 (diff)
downloadrtems-f95d74a4ad782371b4f6fe63b93bf9bb8acc70b7.tar.bz2
libtests/md501: New test
-rw-r--r--testsuites/libtests/Makefile.am1
-rw-r--r--testsuites/libtests/configure.ac1
-rw-r--r--testsuites/libtests/md501/Makefile.am19
-rw-r--r--testsuites/libtests/md501/init.c215
-rw-r--r--testsuites/libtests/md501/md501.doc13
-rw-r--r--testsuites/libtests/md501/md501.scn2
6 files changed, 251 insertions, 0 deletions
diff --git a/testsuites/libtests/Makefile.am b/testsuites/libtests/Makefile.am
index 119774277b..f6f1b0d5a6 100644
--- a/testsuites/libtests/Makefile.am
+++ b/testsuites/libtests/Makefile.am
@@ -1,6 +1,7 @@
ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = POSIX
+SUBDIRS += md501
SUBDIRS += sparsedisk01
SUBDIRS += block16
SUBDIRS += block15
diff --git a/testsuites/libtests/configure.ac b/testsuites/libtests/configure.ac
index b8be927f47..b07b9bc3df 100644
--- a/testsuites/libtests/configure.ac
+++ b/testsuites/libtests/configure.ac
@@ -43,6 +43,7 @@ AM_CONDITIONAL(HAS_POSIX,test x"${rtems_cv_RTEMS_POSIX_API}" = x"yes")
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
+md501/Makefile
sparsedisk01/Makefile
block16/Makefile
mghttpd01/Makefile
diff --git a/testsuites/libtests/md501/Makefile.am b/testsuites/libtests/md501/Makefile.am
new file mode 100644
index 0000000000..5751738069
--- /dev/null
+++ b/testsuites/libtests/md501/Makefile.am
@@ -0,0 +1,19 @@
+rtems_tests_PROGRAMS = md501
+md501_SOURCES = init.c
+
+dist_rtems_tests_DATA = md501.scn md501.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(md501_OBJECTS)
+LINK_LIBS = $(md501_LDLIBS)
+
+md501$(EXEEXT): $(md501_OBJECTS) $(md501_DEPENDENCIES)
+ @rm -f md501$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/libtests/md501/init.c b/testsuites/libtests/md501/init.c
new file mode 100644
index 0000000000..6f8b6bf392
--- /dev/null
+++ b/testsuites/libtests/md501/init.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2012 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include "tmacros.h"
+
+#include <md5.h>
+
+static const uint32_t sample_data[] = {
+ 0U,
+ 1U,
+ 1U,
+ 2U,
+ 3U,
+ 5U,
+ 8U,
+ 13U,
+ 21U,
+ 34U,
+ 55U,
+ 89U,
+ 144U,
+ 233U,
+ 377U,
+ 610U,
+ 987U,
+ 1597U,
+ 2584U,
+ 4181U,
+ 6765U,
+ 10946U,
+ 17711U,
+ 28657U,
+ 46368U,
+ 75025U,
+ 121393U,
+ 196418U,
+ 317811U,
+ 514229U,
+ 832040U,
+ 1346269U,
+ 2178309U,
+ 3524578U,
+ 5702887U,
+ 9227465U,
+ 14930352U,
+ 24157817U,
+ 39088169U,
+ 63245986U,
+ 102334155U,
+ 165580141U,
+ 267914296U,
+ 433494437U,
+ 701408733U,
+ 1134903170U,
+ 1836311903U,
+ 2971215073U
+};
+
+static const uint8_t
+expected_digests[RTEMS_ARRAY_SIZE(sample_data)][16] = {
+ { 0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04,
+ 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e },
+ { 0x93, 0xb8, 0x85, 0xad, 0xfe, 0x0d, 0xa0, 0x89,
+ 0xcd, 0xf6, 0x34, 0x90, 0x4f, 0xd5, 0x9f, 0x71 },
+ { 0xc4, 0x10, 0x3f, 0x12, 0x2d, 0x27, 0x67, 0x7c,
+ 0x9d, 0xb1, 0x44, 0xca, 0xe1, 0x39, 0x4a, 0x66 },
+ { 0x69, 0x3e, 0x9a, 0xf8, 0x4d, 0x3d, 0xfc, 0xc7,
+ 0x1e, 0x64, 0x0e, 0x00, 0x5b, 0xdc, 0x5e, 0x2e },
+ { 0xf1, 0xd3, 0xff, 0x84, 0x43, 0x29, 0x77, 0x32,
+ 0x86, 0x2d, 0xf2, 0x1d, 0xc4, 0xe5, 0x72, 0x62 },
+ { 0xca, 0x9c, 0x49, 0x1a, 0xc6, 0x6b, 0x2c, 0x62,
+ 0x50, 0x08, 0x82, 0xe9, 0x3f, 0x37, 0x19, 0xa8 },
+ { 0x73, 0x19, 0x46, 0x88, 0x47, 0xd7, 0xb1, 0xae,
+ 0xe4, 0x0d, 0xbf, 0x5d, 0xd9, 0x63, 0xc9, 0x99 },
+ { 0xd3, 0x10, 0xa4, 0x04, 0x83, 0xf9, 0x39, 0x9d,
+ 0xd7, 0xed, 0x17, 0x12, 0xe0, 0xfd, 0xd7, 0x02 },
+ { 0xfa, 0x5a, 0xd9, 0xa8, 0x55, 0x7e, 0x5a, 0x84,
+ 0xcf, 0x23, 0xe5, 0x2d, 0x3d, 0x3a, 0xdf, 0x77 },
+ { 0x7d, 0x54, 0x9f, 0x72, 0x14, 0x2d, 0xc6, 0xd3,
+ 0x55, 0xff, 0x74, 0x2e, 0xdf, 0xe0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x2b, 0x51, 0x12, 0xca, 0xfb },
+ { 0xda, 0x10, 0xff, 0x74, 0x10, 0xfe, 0x79, 0xa3,
+ 0x33, 0x68, 0xac, 0x10, 0x99, 0x13, 0xc8, 0x2a },
+ { 0xc5, 0x47, 0xa0, 0xd7, 0x8b, 0xcd, 0xc4, 0xc5,
+ 0xdb, 0x0d, 0x5c, 0xba, 0x21, 0xba, 0xa9, 0x68 },
+ { 0x8f, 0xa8, 0x7b, 0x3d, 0xfd, 0xd3, 0x41, 0x6b,
+ 0xa7, 0x3f, 0xb0, 0x25, 0x7d, 0xe4, 0xa7, 0x48 },
+ { 0xc9, 0x64, 0x99, 0x9c, 0xaa, 0x54, 0x7c, 0x95,
+ 0xd0, 0x78, 0x97, 0x16, 0xfe, 0x55, 0xf7, 0x99 },
+ { 0xa4, 0xea, 0xa3, 0x20, 0xb7, 0xa2, 0x71, 0xb7,
+ 0xdd, 0x59, 0xca, 0x81, 0xe8, 0x19, 0x04, 0xb3 },
+ { 0x11, 0x99, 0x0a, 0xab, 0x09, 0xa0, 0x7d, 0x96,
+ 0x9e, 0x0a, 0xe6, 0x07, 0xe5, 0x6b, 0xfb, 0x7c }
+};
+
+static void test(void)
+{
+ size_t n = RTEMS_ARRAY_SIZE(sample_data);
+ size_t i;
+
+ for (i = 0; i < n; ++i) {
+ uint8_t digest[16];
+ MD5_CTX ctx;
+
+ MD5Init(&ctx);
+ MD5Update(&ctx, &sample_data [0], i);
+ MD5Final(&digest [0], &ctx);
+
+ rtems_test_assert(
+ memcmp(&digest[0], &expected_digests[i][0], sizeof(digest)) == 0
+ );
+ }
+}
+
+static void Init(rtems_task_argument arg)
+{
+ puts("\n\n*** TEST MD5 1 ***");
+
+ test();
+
+ puts("*** END OF TEST MD5 1 ***");
+
+ rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
diff --git a/testsuites/libtests/md501/md501.doc b/testsuites/libtests/md501/md501.doc
new file mode 100644
index 0000000000..fcb994bc34
--- /dev/null
+++ b/testsuites/libtests/md501/md501.doc
@@ -0,0 +1,13 @@
+This file describes the directives and concepts tested by this test set.
+
+test set name: md501
+
+directives:
+
+ - MD5Init
+ - MD5Update
+ - MD5Final
+
+concepts:
+
+ - Ensures that the MD5 digest is calucated correctly for a sample data set.
diff --git a/testsuites/libtests/md501/md501.scn b/testsuites/libtests/md501/md501.scn
new file mode 100644
index 0000000000..3a7d31819f
--- /dev/null
+++ b/testsuites/libtests/md501/md501.scn
@@ -0,0 +1,2 @@
+*** TEST MD5 1 ***
+*** END OF TEST MD5 1 ***