2
0
Karel Miko 8 жил өмнө
parent
commit
3ea8a00ecd

+ 1 - 1
coverage.sh

@@ -31,7 +31,7 @@ fi
 
 
 ./sizes
 ./sizes
 ./constants
 ./constants
-./multi
+
 for i in $(./hashsum | tail -n +3 | awk '{print $1}' | sort); do echo -n "$i: " && ./hashsum $i testprof/test.key ; done > hashsum_tv.txt
 for i in $(./hashsum | tail -n +3 | awk '{print $1}' | sort); do echo -n "$i: " && ./hashsum $i testprof/test.key ; done > hashsum_tv.txt
 difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
 difftroubles=$(diff -i -w -B hashsum_tv.txt notes/hashsum_tv.txt | grep '^<') || true
 if [ -n "$difftroubles" ]; then
 if [ -n "$difftroubles" ]; then

+ 1 - 0
demos/test.c

@@ -25,6 +25,7 @@ static const struct {
       LTC_TEST_FN(dsa_test),
       LTC_TEST_FN(dsa_test),
       LTC_TEST_FN(katja_test),
       LTC_TEST_FN(katja_test),
       LTC_TEST_FN(file_test),
       LTC_TEST_FN(file_test),
+      LTC_TEST_FN(multi_test),
 };
 };
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)

+ 1 - 1
makefile

@@ -351,7 +351,7 @@ clean:
 	rm -f `find . -type f -name "*.dpi" | xargs`
 	rm -f `find . -type f -name "*.dpi" | xargs`
 	rm -rf `find . -type d -name "*.libs" | xargs`
 	rm -rf `find . -type d -name "*.libs" | xargs`
 	rm -f crypt.aux  crypt.dvi  crypt.idx  crypt.ilg  crypt.ind  crypt.log crypt.toc
 	rm -f crypt.aux  crypt.dvi  crypt.idx  crypt.ilg  crypt.ind  crypt.log crypt.toc
-	rm -f $(TV) $(SMALL) $(CRYPT) $(HASH) $(MULTI) $(TIMING) $(TEST)
+	rm -f $(TV) $(SMALL) $(CRYPT) $(HASH) $(TIMING) $(TEST)
 	rm -f $(SIZES) $(CONSTANTS)
 	rm -f $(SIZES) $(CONSTANTS)
 	rm -rf doc/doxygen
 	rm -rf doc/doxygen
 	rm -f `find . -type f -name "*.pdf" | grep -FL crypt.pdf | xargs`
 	rm -f `find . -type f -name "*.pdf" | grep -FL crypt.pdf | xargs`

+ 0 - 1
makefile.icc

@@ -77,7 +77,6 @@ CRYPT=encrypt
 SMALL=small
 SMALL=small
 PROF=x86_prof
 PROF=x86_prof
 TV=tv_gen
 TV=tv_gen
-MULTI=multi
 TIMING=timing
 TIMING=timing
 TEST=test
 TEST=test
 
 

+ 1 - 2
makefile.include

@@ -75,13 +75,12 @@ HASH=hashsum
 CRYPT=encrypt
 CRYPT=encrypt
 SMALL=small
 SMALL=small
 TV=tv_gen
 TV=tv_gen
-MULTI=multi
 TIMING=timing
 TIMING=timing
 TEST=test
 TEST=test
 SIZES=sizes
 SIZES=sizes
 CONSTANTS=constants
 CONSTANTS=constants
 
 
-DEMOS=hashsum crypt small tv_gen multi sizes constants
+DEMOS=hashsum crypt small tv_gen sizes constants
 
 
 TIMINGS=demos/timing.o
 TIMINGS=demos/timing.o
 TESTS=demos/test.o
 TESTS=demos/test.o

+ 1 - 6
makefile.mingw

@@ -23,7 +23,6 @@ CRYPT=encrypt
 SMALL=small
 SMALL=small
 PROF=x86_prof
 PROF=x86_prof
 TV=tv_gen
 TV=tv_gen
-MULTI=multi
 TIMING=timing
 TIMING=timing
 TEST=test
 TEST=test
 
 
@@ -197,7 +196,6 @@ HASHOBJECTS=demos/hashsum.o
 CRYPTOBJECTS=demos/encrypt.o
 CRYPTOBJECTS=demos/encrypt.o
 SMALLOBJECTS=demos/small.o
 SMALLOBJECTS=demos/small.o
 TVS=demos/tv_gen.o
 TVS=demos/tv_gen.o
-MULTIS=demos/multi.o
 TIMINGS=demos/timing.o
 TIMINGS=demos/timing.o
 TESTS=demos/test.o
 TESTS=demos/test.o
 
 
@@ -246,9 +244,6 @@ small: library $(SMALLOBJECTS)
 tv_gen: library $(TVS)
 tv_gen: library $(TVS)
 	$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
 	$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
 
 
-multi: library $(MULTIS)
-	$(CC) $(MULTIS) $(LIBNAME) $(EXTRALIBS) -o $(MULTI)
-
 timing: library testprof/$(LIBTEST) $(TIMINGS)
 timing: library testprof/$(LIBTEST) $(TIMINGS)
 	$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
 	$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
 
 
@@ -256,7 +251,7 @@ timing: library testprof/$(LIBTEST) $(TIMINGS)
 test: library testprof/$(LIBTEST) $(TESTS)
 test: library testprof/$(LIBTEST) $(TESTS)
 	$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
 	$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
 
 
-all_test: test tv_gen hashsum crypt small multi timing
+all_test: test tv_gen hashsum crypt small timing
 
 
 install: library
 install: library
 	cmd /c if not exist "$(DESTDIR)$(LIBPATH)" mkdir "$(DESTDIR)$(LIBPATH)"
 	cmd /c if not exist "$(DESTDIR)$(LIBPATH)" mkdir "$(DESTDIR)$(LIBPATH)"

+ 1 - 6
makefile.unix

@@ -22,7 +22,6 @@ CRYPT=encrypt
 SMALL=small
 SMALL=small
 PROF=x86_prof
 PROF=x86_prof
 TV=tv_gen
 TV=tv_gen
-MULTI=multi
 TIMING=timing
 TIMING=timing
 TEST=test
 TEST=test
 
 
@@ -202,7 +201,6 @@ HASHOBJECTS=demos/hashsum.o
 CRYPTOBJECTS=demos/encrypt.o
 CRYPTOBJECTS=demos/encrypt.o
 SMALLOBJECTS=demos/small.o
 SMALLOBJECTS=demos/small.o
 TVS=demos/tv_gen.o
 TVS=demos/tv_gen.o
-MULTIS=demos/multi.o
 TIMINGS=demos/timing.o
 TIMINGS=demos/timing.o
 TESTS=demos/test.o
 TESTS=demos/test.o
 
 
@@ -254,9 +252,6 @@ small: library $(SMALLOBJECTS)
 tv_gen: library $(TVS)
 tv_gen: library $(TVS)
 	$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
 	$(CC) $(LDFLAGS) $(TVS) $(LIBNAME) $(EXTRALIBS) -o $(TV)
 
 
-multi: library $(MULTIS)
-	$(CC) $(MULTIS) $(LIBNAME) $(EXTRALIBS) -o $(MULTI)
-
 timing: library testprof/$(LIBTEST) $(TIMINGS)
 timing: library testprof/$(LIBTEST) $(TIMINGS)
 	$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
 	$(CC) $(LDFLAGS) $(TIMINGS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TIMING)
 
 
@@ -264,7 +259,7 @@ timing: library testprof/$(LIBTEST) $(TIMINGS)
 test: library testprof/$(LIBTEST) $(TESTS)
 test: library testprof/$(LIBTEST) $(TESTS)
 	$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
 	$(CC) $(LDFLAGS) $(TESTS) testprof/$(LIBTEST) $(LIBNAME) $(EXTRALIBS) -o $(TEST)
 
 
-all_test: test tv_gen hashsum crypt small multi timing
+all_test: test tv_gen hashsum crypt small timing
 
 
 #This rule installs the library and the header files. This must be run
 #This rule installs the library and the header files. This must be run
 #as root in order to have a high enough permission to write to the correct
 #as root in order to have a high enough permission to write to the correct

+ 1 - 1
testprof/makefile

@@ -20,7 +20,7 @@ endif
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 dsa_test.o ecc_test.o mac_test.o misc_test.o modes_test.o pkcs_1_test.o rsa_test.o       \
 dsa_test.o ecc_test.o mac_test.o misc_test.o modes_test.o pkcs_1_test.o rsa_test.o       \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o               \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o               \
-pkcs_1_pss_test.o pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o
+pkcs_1_pss_test.o pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o multi_test.o
 
 
 ifndef LIBTEST_S
 ifndef LIBTEST_S
    LIBTEST_S=libtomcrypt_prof.a
    LIBTEST_S=libtomcrypt_prof.a

+ 1 - 1
testprof/makefile.icc

@@ -4,7 +4,7 @@ CC?=icc
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 dsa_test.o ecc_test.o mac_test.o modes_test.o pkcs_1_test.o rsa_test.o                   \
 dsa_test.o ecc_test.o mac_test.o modes_test.o pkcs_1_test.o rsa_test.o                   \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o misc_test.o   \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o misc_test.o   \
-pkcs_1_pss_test.o pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o
+pkcs_1_pss_test.o pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o multi_test.o
 
 
 ifndef LIBTEST_S
 ifndef LIBTEST_S
    LIBTEST_S = libtomcrypt_prof.a
    LIBTEST_S = libtomcrypt_prof.a

+ 1 - 1
testprof/makefile.mingw

@@ -7,7 +7,7 @@ CFLAGS = $(CFLAGS_OPTS) -I../src/headers -I../../libtommath -I. -Wall -Wextra -D
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 OBJECTS = base64_test.o cipher_hash_test.o der_tests.o no_prng.o file_test.o             \
 dsa_test.o ecc_test.o mac_test.o misc_test.o modes_test.o pkcs_1_test.o rsa_test.o       \
 dsa_test.o ecc_test.o mac_test.o misc_test.o modes_test.o pkcs_1_test.o rsa_test.o       \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o pkcs_1_pss_test.o \
 store_test.o rotate_test.o test_driver.o x86_prof.o katja_test.o dh_test.o pkcs_1_pss_test.o \
-pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o
+pkcs_1_oaep_test.o pkcs_1_emsa_test.o pkcs_1_eme_test.o multi_test.o
 
 
 default: $(LIBTEST_S)
 default: $(LIBTEST_S)
 
 

+ 1 - 1
testprof/makefile.msvc

@@ -4,7 +4,7 @@ OBJECTS=base64_test.obj cipher_hash_test.obj der_tests.obj no_prng.obj file_test
 dsa_test.obj ecc_test.obj mac_test.obj modes_test.obj pkcs_1_test.obj \
 dsa_test.obj ecc_test.obj mac_test.obj modes_test.obj pkcs_1_test.obj \
 rsa_test.obj store_test.obj rotate_test.obj test_driver.obj x86_prof.obj katja_test.obj \
 rsa_test.obj store_test.obj rotate_test.obj test_driver.obj x86_prof.obj katja_test.obj \
 dh_test.obj misc_test.obj pkcs_1_pss_test.obj pkcs_1_oaep_test.obj \
 dh_test.obj misc_test.obj pkcs_1_pss_test.obj pkcs_1_oaep_test.obj \
-pkcs_1_emsa_test.obj pkcs_1_eme_test.obj
+pkcs_1_emsa_test.obj pkcs_1_eme_test.obj multi_test.obj
 
 
 .c.obj:
 .c.obj:
 	$(CC) $(CFLAGS) /c $< /Fo$@
 	$(CC) $(CFLAGS) /c $< /Fo$@

+ 30 - 36
testprof/multi_test.c

@@ -1,7 +1,7 @@
 /* test the multi helpers... */
 /* test the multi helpers... */
-#include <tomcrypt.h>
+#include <tomcrypt_test.h>
 
 
-int main(void)
+int multi_test(void)
 {
 {
    unsigned char key[32], buf[2][MAXBLOCKSIZE];
    unsigned char key[32], buf[2][MAXBLOCKSIZE];
    unsigned long len, len2;
    unsigned long len, len2;
@@ -17,19 +17,19 @@ int main(void)
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL, 0);
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL, 0);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    hash_memory_multi(find_hash("sha256"), buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 
 
 #ifdef LTC_HMAC
 #ifdef LTC_HMAC
@@ -39,19 +39,19 @@ int main(void)
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    hmac_memory_multi(find_hash("sha256"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -62,19 +62,19 @@ int main(void)
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    omac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -85,19 +85,19 @@ int main(void)
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    pmac_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -108,19 +108,19 @@ int main(void)
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    xcbc_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -131,19 +131,19 @@ int main(void)
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    f9_memory_multi(find_cipher("aes"), key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -158,19 +158,19 @@ int main(void)
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = sizeof(buf[0]);
    len2 = sizeof(buf[0]);
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    poly1305_memory_multi(key, 32, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -181,19 +181,19 @@ int main(void)
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = 32;
    len2 = 32;
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = 32;
    len2 = 32;
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    blake2smac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
@@ -204,27 +204,21 @@ int main(void)
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"hello", 5, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = 64;
    len2 = 64;
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"he", 2UL, "llo", 3UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
    len2 = 64;
    len2 = 64;
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    blake2bmac_memory_multi(key, 16, buf[1], &len2, (unsigned char*)"h", 1UL, "e", 1UL, "l", 1UL, "l", 1UL, "o", 1UL, NULL);
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
    if (len != len2 || memcmp(buf[0], buf[1], len)) {
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
       printf("Failed: %d %lu %lu\n", __LINE__, len, len2);
-      return EXIT_FAILURE;
+      return CRYPT_FAIL_TESTVECTOR;
    }
    }
 #endif
 #endif
 
 
-   printf("All passed\n");
-   return EXIT_SUCCESS;
+   return CRYPT_OK;
 }
 }
-
-
-/* $Source$ */
-/* $Revision$ */
-/* $Date$ */

+ 1 - 0
testprof/tomcrypt_test.h

@@ -66,6 +66,7 @@ int der_tests(void);
 int misc_test(void);
 int misc_test(void);
 int base64_test(void);
 int base64_test(void);
 int file_test(void);
 int file_test(void);
+int multi_test(void);
 
 
 /* timing */
 /* timing */
 #define KTIMES  25
 #define KTIMES  25