]> git.codecow.com Git - Monocypher.git/commitdiff
organised stuff into folders
authorLoup Vaillant <loup@loup-vaillant.fr>
Wed, 26 Apr 2017 16:06:00 +0000 (18:06 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Wed, 26 Apr 2017 16:06:00 +0000 (18:06 +0200)
22 files changed:
makefile
src/monocypher.c [moved from monocypher.c with 100% similarity]
src/monocypher.h [moved from monocypher.h with 100% similarity]
src/more_speed.c [moved from more_speed.c with 100% similarity]
src/sha512.c [moved from sha512.c with 100% similarity]
src/sha512.h [moved from sha512.h with 100% similarity]
tests/sodium.c [moved from sodium.c with 100% similarity]
tests/test.c [moved from test.c with 92% similarity]
tests/vectors/argon2i [moved from vectors_argon2i with 100% similarity]
tests/vectors/blake2b [moved from vectors_blake2b with 100% similarity]
tests/vectors/blake2b_easy [moved from vectors_blake2b_easy with 100% similarity]
tests/vectors/chacha20 [moved from vectors_chacha20 with 100% similarity]
tests/vectors/ed25519_key [moved from vectors_ed25519_key with 100% similarity]
tests/vectors/ed25519_sign [moved from vectors_ed25519_sign with 100% similarity]
tests/vectors/h_chacha20 [moved from vectors_h_chacha20 with 100% similarity]
tests/vectors/key_exchange [moved from vectors_key_exchange with 100% similarity]
tests/vectors/poly1305 [moved from vectors_poly1305 with 100% similarity]
tests/vectors/sha512 [moved from vectors_sha512 with 100% similarity]
tests/vectors/test_diff [moved from vectors_test_diff with 100% similarity]
tests/vectors/test_equal [moved from vectors_test_equal with 100% similarity]
tests/vectors/x25519 [moved from vectors_x25519 with 100% similarity]
tests/vectors/x_chacha20 [moved from vectors_x_chacha20 with 100% similarity]

index f09ea76716d10046c1786c6199f7ddac3d7880d0..0586057e9f1764bd8532305ad30859cf73bb3b19 100644 (file)
--- a/makefile
+++ b/makefile
@@ -1,37 +1,43 @@
 CC=gcc
-CFLAGS=-O2 -Wall -Wextra -std=c11 -pedantic
+CFLAGS= -I src -O2 -Wall -Wextra -std=c11 -pedantic
 
-.PHONY: all clean
+.PHONY: all clean directories
 # disable implicit rules
 .SUFFIXES:
 
 all: test sodium
 
 clean:
-       rm -f *.o *.gch test rename_*
+       rm -rf bin
+       rm -f src/*.gch src/rename_*
+       rm -f test sodium
 
 # Test suite based on test vectors
-test: test.c monocypher.o sha512.o
+test: tests/test.c bin/monocypher.o bin/sha512.o
        $(CC) $(CFLAGS) -o $@ $^
 
 # Test suite based on comparison with libsodium
 C_SODIUM_FLAGS=$$(pkg-config --cflags libsodium)
 LD_SODIUM_FLAGS=$$(pkg-config --libs libsodium)
-sodium: sodium.c rename_monocypher.o rename_sha512.o
+sodium: tests/sodium.c bin/rename_monocypher.o bin/rename_sha512.o
        $(CC) $(CFLAGS) -o $@ $^ $(C_SODIUM_FLAGS) $(LD_SODIUM_FLAGS)
 
 # compile monocypher
 # use -DED25519_SHA512 for ed25519 compatibility
-rename_monocypher.o: rename_monocypher.c rename_monocypher.h rename_sha512.h
-       $(CC) $(CFLAGS) -c $^ -DED25519_SHA512
-monocypher.o: monocypher.c monocypher.h sha512.h
-       $(CC) $(CFLAGS) -c $^ -DED25519_SHA512
+bin/rename_monocypher.o: src/rename_monocypher.c src/rename_monocypher.h src/rename_sha512.h
+       @mkdir -p $(@D)
+       $(CC) $(CFLAGS) -o $@ -c $< -DED25519_SHA512
+bin/monocypher.o: src/monocypher.c src/monocypher.h src/sha512.h
+       @mkdir -p $(@D)
+       $(CC) $(CFLAGS) -o $@ -c $< -DED25519_SHA512
 
 # compile sha512.  Only used for ed15519 compatibility
-sha512.o: sha512.c sha512.h
-       $(CC) $(CFLAGS) -c $^
-rename_sha512.o: rename_sha512.c rename_sha512.h
-       $(CC) $(CFLAGS) -c $^
+bin/sha512.o: src/sha512.c src/sha512.h
+       @mkdir -p $(@D)
+       $(CC) $(CFLAGS) -o $@ -c $<
+bin/rename_sha512.o: src/rename_sha512.c src/rename_sha512.h
+       @mkdir -p $(@D)
+       $(CC) $(CFLAGS) -o $@ -c $<
 
 # change the "crypto_" prefix to the "rename_" prefix, so you can use
 # monocypher with other crypto libraries without conflict.
similarity index 100%
rename from monocypher.c
rename to src/monocypher.c
similarity index 100%
rename from monocypher.h
rename to src/monocypher.h
similarity index 100%
rename from more_speed.c
rename to src/more_speed.c
similarity index 100%
rename from sha512.c
rename to src/sha512.c
similarity index 100%
rename from sha512.h
rename to src/sha512.h
similarity index 100%
rename from sodium.c
rename to tests/sodium.c
similarity index 92%
rename from test.c
rename to tests/test.c
index b2205232717fbf72ad97f28c773a2ee683288517..ace06d547a8b6b39b2c72d1997838d8fd0145ce0 100644 (file)
--- a/test.c
@@ -433,21 +433,21 @@ static int test_aead()
 int main(void)
 {
     int status = 0;
-    status |= generic_test(equal, "vectors_test_equal"  , 2);
-    status |= generic_test(diff , "vectors_test_diff"   , 2);
-    status |= test(chacha20     , "vectors_chacha20"    , 2);
-    status |= test(hchacha20    , "vectors_h_chacha20"  , 2);
-    status |= test(xchacha20    , "vectors_x_chacha20"  , 2);
-    status |= test(blake2b      , "vectors_blake2b"     , 2);
-    status |= test(blake2b_easy , "vectors_blake2b_easy", 1);
-    status |= test(poly1305     , "vectors_poly1305"    , 2);
-    status |= test(argon2i      , "vectors_argon2i"     , 6);
-    status |= test(x25519       , "vectors_x25519"      , 2);
-    status |= test(key_exchange , "vectors_key_exchange", 2);
-    status |= test(sha512       , "vectors_sha512"      , 1);
-    status |= test(ed25519_key  , "vectors_ed25519_key" , 1);
-    status |= test(ed25519_sign1, "vectors_ed25519_sign", 3);
-    status |= test(ed25519_sign2, "vectors_ed25519_sign", 3);
+    status |= generic_test(equal, "tests/vectors/test_equal"  , 2);
+    status |= generic_test(diff , "tests/vectors/test_diff"   , 2);
+    status |= test(chacha20     , "tests/vectors/chacha20"    , 2);
+    status |= test(hchacha20    , "tests/vectors/h_chacha20"  , 2);
+    status |= test(xchacha20    , "tests/vectors/x_chacha20"  , 2);
+    status |= test(blake2b      , "tests/vectors/blake2b"     , 2);
+    status |= test(blake2b_easy , "tests/vectors/blake2b_easy", 1);
+    status |= test(poly1305     , "tests/vectors/poly1305"    , 2);
+    status |= test(argon2i      , "tests/vectors/argon2i"     , 6);
+    status |= test(x25519       , "tests/vectors/x25519"      , 2);
+    status |= test(key_exchange , "tests/vectors/key_exchange", 2);
+    status |= test(sha512       , "tests/vectors/sha512"      , 1);
+    status |= test(ed25519_key  , "tests/vectors/ed25519_key" , 1);
+    status |= test(ed25519_sign1, "tests/vectors/ed25519_sign", 3);
+    status |= test(ed25519_sign2, "tests/vectors/ed25519_sign", 3);
     status |= test_x25519();
     status |= test_aead();
     printf(status ? "TESTS FAILED\n" : "ALL TESTS OK\n");
similarity index 100%
rename from vectors_argon2i
rename to tests/vectors/argon2i
similarity index 100%
rename from vectors_blake2b
rename to tests/vectors/blake2b
similarity index 100%
rename from vectors_chacha20
rename to tests/vectors/chacha20
similarity index 100%
rename from vectors_h_chacha20
rename to tests/vectors/h_chacha20
similarity index 100%
rename from vectors_poly1305
rename to tests/vectors/poly1305
similarity index 100%
rename from vectors_sha512
rename to tests/vectors/sha512
similarity index 100%
rename from vectors_test_diff
rename to tests/vectors/test_diff
similarity index 100%
rename from vectors_test_equal
rename to tests/vectors/test_equal
similarity index 100%
rename from vectors_x25519
rename to tests/vectors/x25519
similarity index 100%
rename from vectors_x_chacha20
rename to tests/vectors/x_chacha20