]> git.codecow.com Git - Monocypher.git/commitdiff
Cleaned up the tests/ folder
authorLoup Vaillant <loup@loup-vaillant.fr>
Mon, 21 Oct 2019 12:57:03 +0000 (14:57 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Mon, 21 Oct 2019 12:57:03 +0000 (14:57 +0200)
Just moving files around so it's better organised.

Also changed the vectors.h header a little:
- It now includes inttypes.h and and stddef.h only once.
- There's a note at the top saying where it comes from.

31 files changed:
makefile
tarball_ignore
tests/externals/ed25519-donna/curve25519-donna-32bit.h [moved from tests/ed25519-donna/curve25519-donna-32bit.h with 100% similarity]
tests/externals/ed25519-donna/curve25519-donna-helpers.h [moved from tests/ed25519-donna/curve25519-donna-helpers.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-32bit-tables.h [moved from tests/ed25519-donna/ed25519-donna-32bit-tables.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-basepoint-table.h [moved from tests/ed25519-donna/ed25519-donna-basepoint-table.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-batchverify.h [moved from tests/ed25519-donna/ed25519-donna-batchverify.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-impl-base.h [moved from tests/ed25519-donna/ed25519-donna-impl-base.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-portable-identify.h [moved from tests/ed25519-donna/ed25519-donna-portable-identify.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna-portable.h [moved from tests/ed25519-donna/ed25519-donna-portable.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-donna.h [moved from tests/ed25519-donna/ed25519-donna.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-hash-custom.h [moved from tests/ed25519-donna/ed25519-hash-custom.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-hash.h [moved from tests/ed25519-donna/ed25519-hash.h with 100% similarity]
tests/externals/ed25519-donna/ed25519-randombytes.h [moved from tests/ed25519-donna/ed25519-randombytes.h with 100% similarity]
tests/externals/ed25519-donna/ed25519.c [moved from tests/ed25519-donna/ed25519.c with 100% similarity]
tests/externals/ed25519-donna/ed25519.h [moved from tests/ed25519-donna/ed25519.h with 100% similarity]
tests/externals/ed25519-donna/modm-donna-32bit.h [moved from tests/ed25519-donna/modm-donna-32bit.h with 100% similarity]
tests/externals/tweetnacl.c [moved from tests/tweetnacl.c with 100% similarity]
tests/externals/tweetnacl.h [moved from tests/tweetnacl.h with 100% similarity]
tests/gen/makefile
tests/gen/vector_to_header.c [moved from tests/vector_to_header.c with 95% similarity]
tests/gen/vectors/argon2i [moved from tests/vectors/argon2i with 100% similarity]
tests/gen/vectors/chacha20 [moved from tests/vectors/chacha20 with 100% similarity]
tests/gen/vectors/ed_25519_check [moved from tests/vectors/ed_25519_check with 100% similarity]
tests/gen/vectors/key_exchange [moved from tests/vectors/key_exchange with 100% similarity]
tests/gen/vectors/poly1305 [moved from tests/vectors/poly1305 with 100% similarity]
tests/gen/vectors/x25519 [moved from tests/vectors/x25519 with 100% similarity]
tests/speed/speed-sodium.c [moved from tests/speed-sodium.c with 100% similarity]
tests/speed/speed-tweetnacl.c [moved from tests/speed-tweetnacl.c with 100% similarity]
tests/speed/speed.c [moved from tests/speed.c with 100% similarity]
tests/speed/speed.h [moved from tests/speed.h with 100% similarity]

index 344f3e23522b37b58e5d29daf0c0252cfd3d6d84..ca28aed343547cec2c8e6633ef29b9e121e7328c 100644 (file)
--- a/makefile
+++ b/makefile
@@ -83,19 +83,21 @@ lib/monocypher.o lib/sha512.o:
        $(CC) $(CFLAGS) -I src -I src/optional -fPIC -c -o $@ $<
 
 # Test & speed libraries
-$TEST_COMMON=tests/utils.h src/monocypher.h src/optional/sha512.h
-lib/test.o           : tests/test.c            $(TEST_COMMON) tests/vectors.h
-lib/speed.o          : tests/speed.c           $(TEST_COMMON) tests/speed.h
-lib/speed-tweetnacl.o: tests/speed-tweetnacl.c $(TEST_COMMON) tests/speed.h
+TEST_COMMON = tests/utils.h src/monocypher.h src/optional/sha512.h
+SPEED       = tests/speed
+lib/test.o           :tests/test.c               $(TEST_COMMON) tests/vectors.h
+lib/speed.o          :$(SPEED)/speed.c           $(TEST_COMMON) $(SPEED)/speed.h
+lib/speed-tweetnacl.o:$(SPEED)/speed-tweetnacl.c $(TEST_COMMON) $(SPEED)/speed.h
 lib/utils.o lib/test.o lib/speed.o lib/speed-tweetnacl.o:
        @mkdir -p $(@D)
-       $(CC) $(CFLAGS) -I src -I src/optional -fPIC -c -o $@ $<
+       $(CC) $(CFLAGS)                                        \
+            -I src -I src/optional -I tests -I tests/externals \
+            -fPIC -c -o $@ $<
 
-lib/speed-sodium.o   : tests/speed-sodium.c    $(TEST_COMMON) tests/speed.h
+lib/speed-sodium.o:$(SPEED)/speed-sodium.c $(TEST_COMMON) $(SPEED)/speed.h
        @mkdir -p $(@D)
-       $(CC) $(CFLAGS)                       \
-            -I src                            \
-            -I src/optional                   \
+       $(CC) $(CFLAGS)                     \
+            -I src -I src/optional -I tests \
             `pkg-config --cflags libsodium` \
             -fPIC -c -o $@ $<
 
@@ -108,7 +110,7 @@ speed-sodium.out: lib/speed-sodium.o
        $(CC) $(CFLAGS) -o $@ $^              \
             `pkg-config --cflags libsodium` \
             `pkg-config --libs   libsodium`
-lib/tweetnacl.o: tests/tweetnacl.c tests/tweetnacl.h
+lib/tweetnacl.o: tests/externals/tweetnacl.c tests/externals/tweetnacl.h
        $(CC) $(CFLAGS) -c -o $@ $<
 speed-tweetnacl.out: lib/speed-tweetnacl.o lib/tweetnacl.o
        $(CC) $(CFLAGS) -o $@ $^
index 634630771efb7f4ba78fbb1cb21aa87f868bd8a2..cc2a5c04f841de863b02c8818168094b320de490 100644 (file)
@@ -27,8 +27,5 @@ lib*
 release.sh
 tarball_ignore
 tests/gen*
-tests/vector_to_header.c
-tests/vectors
-tests/vectors/*
-tests/ed25519-donna*
+tests/externals/ed25519-donna*
 doc/man2html.sh
index 3096dac1ecdeb19bbc560e74e7f593c716114b98..85f0f3280a076524531b0e52a0358488f82cf76e 100644 (file)
@@ -21,19 +21,20 @@ clean:
 %.vec: %.out
        ./$< > $@
 
-%.o: %.c ../utils.h ../ed25519-donna/ed25519.h
-       $(CC) $(CFLAGS) -c $<     \
-            -I ..                 \
-            -I ../ed25519-donna   \
-            -I ../../src          \
-            -I ../../src/optional \
+%.o: %.c ../utils.h ../externals/ed25519-donna/ed25519.h
+       $(CC) $(CFLAGS) -c $<              \
+            -I ..                          \
+            -I ../externals/ed25519-donna  \
+            -I ../../src                   \
+            -I ../../src/optional          \
             $$(pkg-config --cflags libsodium)
 
 %.out: %.o ed25519.o
        $(CC) $(CFLAGS) -o $@ $^ \
             $$(pkg-config --libs libsodium)
 
-ed25519.o: ../ed25519-donna/ed25519.c  $(wildcard ../ed25519-donna/*.h)
+ed25519.o: ../externals/ed25519-donna/ed25519.c \
+           $(wildcard ../externals/ed25519-donna/*.h)
        $(CC) $(CFLAGS) -c $<                 \
             -I ../../src                      \
             -I ../../src/optional             \
@@ -43,24 +44,24 @@ ed25519.o: ../ed25519-donna/ed25519.c  $(wildcard ../ed25519-donna/*.h)
             -DED25519_NO_INLINE_ASM           \
             -DED25519_FORCE_32BIT
 
-vector_to_header.out: ../vector_to_header.c
+vector_to_header.out: vector_to_header.c
        $(CC) $(CFLAGS) $< -o $@
 
-chacha20.all.vec      : chacha20.vec    ../vectors/chacha20
-poly1305.all.vec      : poly1305.vec    ../vectors/poly1305
-x25519.all.vec        : x25519.vec      ../vectors/x25519
+chacha20.all.vec      : chacha20.vec    vectors/chacha20
+poly1305.all.vec      : poly1305.vec    vectors/poly1305
+x25519.all.vec        : x25519.vec      vectors/x25519
 x25519_pk.all.vec     : x25519_pk.vec
 hchacha20.all.vec     : hchacha20.vec
 xchacha20.all.vec     : xchacha20.vec
 aead_ietf.all.vec     : aead_ietf.vec
 blake2b.all.vec       : blake2b.vec
 sha512.all.vec        : sha512.vec
-argon2i.all.vec       : argon2i.vec     ../vectors/argon2i
+argon2i.all.vec       : argon2i.vec     vectors/argon2i
 edDSA.all.vec         : edDSA.vec
 edDSA_pk.all.vec      : edDSA_pk.vec
 ed_25519.all.vec      : ed_25519.vec
-ed_25519_check.all.vec:                 ../vectors/ed_25519_check
-key_exchange.all.vec  :                 ../vectors/key_exchange
+ed_25519_check.all.vec:                 vectors/ed_25519_check
+key_exchange.all.vec  :                 vectors/key_exchange
 monokex_xk1.all.vec   : monokex_xk1.vec
 monokex_x.all.vec     : monokex_x.vec
 $(VEC2):
@@ -70,5 +71,14 @@ $(VEC2):
 %.h.vec: %.all.vec vector_to_header.out
        ./vector_to_header.out  $(patsubst %.all.vec,%,$<) < $< > $@
 
- $(VECTORS): $(HEADERS)
+prelude.h.vec:
+       @echo "creating prelude.h.vec"
+       @echo "// Generated with hard coded official vectors, and"     >  $@
+       @echo "// random vectors with Libsodium and ed25519-donna."    >> $@
+       @echo "// Download Monocypher's git repository to regenerate." >> $@
+       @echo "#include <inttypes.h>"                                  >> $@
+       @echo "#include <stddef.h>"                                    >> $@
+       @echo ""                                                       >> $@
+
+$(VECTORS): prelude.h.vec $(HEADERS)
        cat $^ > $@
similarity index 95%
rename from tests/vector_to_header.c
rename to tests/gen/vector_to_header.c
index 1c2cbdd98447a45226a20eac5e1fc48cc30852f3..73cf195a2abff6142ac969cff532aa3ef77c7cc2 100644 (file)
@@ -22,8 +22,6 @@ int main(int argc, char** argv)
     int   c      = getchar();
     int   nb_vec = 0;
 
-    printf("#include <inttypes.h>\n");
-    printf("#include <stddef.h>\n");
     while (c != EOF) {
         int size = 0;
         if (c == ':') {
similarity index 100%
rename from tests/speed.c
rename to tests/speed/speed.c
similarity index 100%
rename from tests/speed.h
rename to tests/speed/speed.h