From: Loup Vaillant Date: Wed, 20 Sep 2017 07:11:39 +0000 (+0200) Subject: Move everything back from the dist/ directory X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=9d569930c7fe02965c2b084b3cd664f523232129;p=Monocypher.git Move everything back from the dist/ directory Making a separate dist/ folder was stupid, we can use tar's exclusion patterns to take care of clean archiving. It's simpler for everyone without the indirection. --- diff --git a/.gitignore b/.gitignore index 7ddd1d5..159de6b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,4 @@ *.profdata formal-analysis/* man/3monocypher/*.html -dist/AUTHORS.md -dist/LICENCE.md -dist/tests/vectors.h +tests/vectors.h diff --git a/README.md b/README.md index fde07bc..1b68119 100644 --- a/README.md +++ b/README.md @@ -4,29 +4,14 @@ Monocypher Monocypher is an easy to use, easy to deploy, auditable crypto library inspired by [libsodium][] and [TweetNaCl][], written in portable C. +It means to eat libsodium's lunch. + [Official site.](http://loup-vaillant.fr/projects/monocypher/) [libsodium]: http://libsodium.org [TweetNaCl]: http://tweetnacl.cr.yp.to/ -Generating the test vectors ---------------------------- - -You are currently using the source repository, meant for developers. -You need to generate the test vectors before you can run the test -suite. This requires requires Libsodium 1.0.12 or later: - - $ cd tests/gen/ - $ make - $ cd ../.. - -This will generate `dist/tests/vectors.h`, which contains all the test -vectors. You can now go to the `dist/` directory, then compile and -test Monocypher like end users. There's also a -[README.md](dist/README.md) there. - - Installation ------------ @@ -34,8 +19,14 @@ The easiest way to use Monocypher is to include `src/monocypher.h` and `src/monocypher.c` directly into your project. They compile as C99, C11, C++98, C++11, C++14, and C++17. -Alternatively, you can go to the `dist` directory, and follow the -installation instructions there. +Alternatively, you can run + + $ make + +then grab `lib/libmonocypher.a` or `lib/libmonocypher.so`. + +_TODO: make install_ + ### Known language bindings @@ -44,6 +35,7 @@ installation instructions there. * [Zig](https://bitbucket.org/mihailp/zig-monocypher/src/default) (http://ziglang.org/). + ### Known alternate distributions * [AUR package](https://aur.archlinux.org/packages/monocypher/) for @@ -51,3 +43,94 @@ installation instructions there. * If you are using [Buck Build](https://buckbuild.com) and [Buckaroo](https://buckaroo.pm), then there is a Buck port maintained at [njlr/Monocypher](https://github.com/njlr/Monocypher). + + +Test suite +---------- + + $ make test + +It should display a nice printout of all the tests, all starting with +"OK". If you see "FAILURE" anywhere, something has gone very wrong +somewhere. + +*Do not* use Monocypher without running the self contained tests at +least once. + + +### More serious testing + +_TODO: This section is obsolete._ + +The makefile may be modified to activate sanitising. Just run the +previous tests under the various sanitisers. If you compile for +coverage mapping, the `coverage.sh` mapping can generate a report. +Just run one of those (make sure the makefile is set up accordingly): + + $ ./coverage.sh test.out + +You can also run the tests under Valgrind: + + $ valgrind ./test.out + +### Serious auditing + +_TODO: This section is obsolete._ + +The code may be analysed more formally with [Frama-c][] and the +[TIS interpreter][TIS]. To analyse the code with Frama-c, run: + + $ make formal-analysis + $ ./frama-c.sh + +This will have Frama-c parse, and analyse the code, then launch a GUI. +You must have Frama-c installed. See `frama-c.sh` for the recommended +settings. To run the code under the TIS interpreter, run + + $ make formal-analysis + $ cd formal-analysis + $ tis-interpreter.sh *.c + +(Note: `tis-interpreter.sh` is part of TIS. If it is not in your +path, adjust the command accordingly.) + +[Frama-c]:http://frama-c.com/ +[TIS]: http://trust-in-soft.com/tis-interpreter/ + + +Speed benchmark +--------------- + +_TODO: The speed benchmark don't run yet._ + + $ make speed + +This will give you an idea how fast Monocypher is on your machine. +Make sure you run it on the target platform if performance is a +concern. If Monocypher is too slow, try libsodium or NaCl. If you're +not sure, you can always switch later. + +Note: the speed benchmark currently requires the POSIX +`clock_gettime()` function. + + +Customisation +------------- + +_TODO: the test suite doesn't support the customisation yet._ + +For simplicity, compactness, and performance reasons, Monocypher +signatures default to EdDSA with curve25519 and Blake2b. This is +different from the more mainstream Ed25519, which uses SHA-512 +instead. + +If you need Ed25519 compatibility, you need to do the following: + +- Compile Monocypher.c with option -DED25519_SHA512. +- Link the final program with a suitable SHA-512 implementation. You + can use the sha512.c and sha512.h files provided in `src/`. + +Note that even though the default hash (Blake2b) is not "standard", +you can still upgrade to faster implementations if you really need to. +The Donna implementations of ed25519 for instance can use a custom +hash —one test does just that. diff --git a/dist/README.md b/dist/README.md deleted file mode 100644 index 1b68119..0000000 --- a/dist/README.md +++ /dev/null @@ -1,136 +0,0 @@ -Monocypher ----------- - -Monocypher is an easy to use, easy to deploy, auditable crypto library -inspired by [libsodium][] and [TweetNaCl][], written in portable C. - -It means to eat libsodium's lunch. - -[Official site.](http://loup-vaillant.fr/projects/monocypher/) - -[libsodium]: http://libsodium.org -[TweetNaCl]: http://tweetnacl.cr.yp.to/ - - -Installation ------------- - -The easiest way to use Monocypher is to include `src/monocypher.h` and -`src/monocypher.c` directly into your project. They compile as C99, -C11, C++98, C++11, C++14, and C++17. - -Alternatively, you can run - - $ make - -then grab `lib/libmonocypher.a` or `lib/libmonocypher.so`. - -_TODO: make install_ - - -### Known language bindings - -* [Crystal](https://github.com/konovod/monocypher.cr) -* [Lua](https://github.com/philanc/luanacha) -* [Zig](https://bitbucket.org/mihailp/zig-monocypher/src/default) - (http://ziglang.org/). - - -### Known alternate distributions - -* [AUR package](https://aur.archlinux.org/packages/monocypher/) for - Arch Linux. -* If you are using [Buck Build](https://buckbuild.com) and - [Buckaroo](https://buckaroo.pm), then there is a Buck port - maintained at [njlr/Monocypher](https://github.com/njlr/Monocypher). - - -Test suite ----------- - - $ make test - -It should display a nice printout of all the tests, all starting with -"OK". If you see "FAILURE" anywhere, something has gone very wrong -somewhere. - -*Do not* use Monocypher without running the self contained tests at -least once. - - -### More serious testing - -_TODO: This section is obsolete._ - -The makefile may be modified to activate sanitising. Just run the -previous tests under the various sanitisers. If you compile for -coverage mapping, the `coverage.sh` mapping can generate a report. -Just run one of those (make sure the makefile is set up accordingly): - - $ ./coverage.sh test.out - -You can also run the tests under Valgrind: - - $ valgrind ./test.out - -### Serious auditing - -_TODO: This section is obsolete._ - -The code may be analysed more formally with [Frama-c][] and the -[TIS interpreter][TIS]. To analyse the code with Frama-c, run: - - $ make formal-analysis - $ ./frama-c.sh - -This will have Frama-c parse, and analyse the code, then launch a GUI. -You must have Frama-c installed. See `frama-c.sh` for the recommended -settings. To run the code under the TIS interpreter, run - - $ make formal-analysis - $ cd formal-analysis - $ tis-interpreter.sh *.c - -(Note: `tis-interpreter.sh` is part of TIS. If it is not in your -path, adjust the command accordingly.) - -[Frama-c]:http://frama-c.com/ -[TIS]: http://trust-in-soft.com/tis-interpreter/ - - -Speed benchmark ---------------- - -_TODO: The speed benchmark don't run yet._ - - $ make speed - -This will give you an idea how fast Monocypher is on your machine. -Make sure you run it on the target platform if performance is a -concern. If Monocypher is too slow, try libsodium or NaCl. If you're -not sure, you can always switch later. - -Note: the speed benchmark currently requires the POSIX -`clock_gettime()` function. - - -Customisation -------------- - -_TODO: the test suite doesn't support the customisation yet._ - -For simplicity, compactness, and performance reasons, Monocypher -signatures default to EdDSA with curve25519 and Blake2b. This is -different from the more mainstream Ed25519, which uses SHA-512 -instead. - -If you need Ed25519 compatibility, you need to do the following: - -- Compile Monocypher.c with option -DED25519_SHA512. -- Link the final program with a suitable SHA-512 implementation. You - can use the sha512.c and sha512.h files provided in `src/`. - -Note that even though the default hash (Blake2b) is not "standard", -you can still upgrade to faster implementations if you really need to. -The Donna implementations of ed25519 for instance can use a custom -hash —one test does just that. diff --git a/dist/doc/man/3monocypher/crypto_aead_lock.3monocypher b/doc/man/3monocypher/crypto_aead_lock.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_aead_lock.3monocypher rename to doc/man/3monocypher/crypto_aead_lock.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_aead_unlock.3monocypher b/doc/man/3monocypher/crypto_aead_unlock.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_aead_unlock.3monocypher rename to doc/man/3monocypher/crypto_aead_unlock.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_argon2i.3monocypher b/doc/man/3monocypher/crypto_argon2i.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_argon2i.3monocypher rename to doc/man/3monocypher/crypto_argon2i.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b.3monocypher b/doc/man/3monocypher/crypto_blake2b.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b.3monocypher rename to doc/man/3monocypher/crypto_blake2b.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b_final.3monocypher b/doc/man/3monocypher/crypto_blake2b_final.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b_final.3monocypher rename to doc/man/3monocypher/crypto_blake2b_final.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b_general.3monocypher b/doc/man/3monocypher/crypto_blake2b_general.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b_general.3monocypher rename to doc/man/3monocypher/crypto_blake2b_general.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b_general_init.3monocypher b/doc/man/3monocypher/crypto_blake2b_general_init.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b_general_init.3monocypher rename to doc/man/3monocypher/crypto_blake2b_general_init.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b_init.3monocypher b/doc/man/3monocypher/crypto_blake2b_init.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b_init.3monocypher rename to doc/man/3monocypher/crypto_blake2b_init.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_blake2b_update.3monocypher b/doc/man/3monocypher/crypto_blake2b_update.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_blake2b_update.3monocypher rename to doc/man/3monocypher/crypto_blake2b_update.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_H.3monocypher b/doc/man/3monocypher/crypto_chacha20_H.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_H.3monocypher rename to doc/man/3monocypher/crypto_chacha20_H.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_encrypt.3monocypher b/doc/man/3monocypher/crypto_chacha20_encrypt.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_encrypt.3monocypher rename to doc/man/3monocypher/crypto_chacha20_encrypt.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_init.3monocypher b/doc/man/3monocypher/crypto_chacha20_init.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_init.3monocypher rename to doc/man/3monocypher/crypto_chacha20_init.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_set_ctr.3monocypher b/doc/man/3monocypher/crypto_chacha20_set_ctr.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_set_ctr.3monocypher rename to doc/man/3monocypher/crypto_chacha20_set_ctr.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_stream.3monocypher b/doc/man/3monocypher/crypto_chacha20_stream.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_stream.3monocypher rename to doc/man/3monocypher/crypto_chacha20_stream.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_chacha20_x_init.3monocypher b/doc/man/3monocypher/crypto_chacha20_x_init.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_chacha20_x_init.3monocypher rename to doc/man/3monocypher/crypto_chacha20_x_init.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_check.3monocypher b/doc/man/3monocypher/crypto_check.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_check.3monocypher rename to doc/man/3monocypher/crypto_check.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_key_exchange.3monocypher b/doc/man/3monocypher/crypto_key_exchange.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_key_exchange.3monocypher rename to doc/man/3monocypher/crypto_key_exchange.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_lock.3monocypher b/doc/man/3monocypher/crypto_lock.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_lock.3monocypher rename to doc/man/3monocypher/crypto_lock.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_memcmp.3monocypher b/doc/man/3monocypher/crypto_memcmp.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_memcmp.3monocypher rename to doc/man/3monocypher/crypto_memcmp.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_poly1305_auth.3monocypher b/doc/man/3monocypher/crypto_poly1305_auth.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_poly1305_auth.3monocypher rename to doc/man/3monocypher/crypto_poly1305_auth.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_poly1305_final.3monocypher b/doc/man/3monocypher/crypto_poly1305_final.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_poly1305_final.3monocypher rename to doc/man/3monocypher/crypto_poly1305_final.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_poly1305_init.3monocypher b/doc/man/3monocypher/crypto_poly1305_init.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_poly1305_init.3monocypher rename to doc/man/3monocypher/crypto_poly1305_init.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_poly1305_update.3monocypher b/doc/man/3monocypher/crypto_poly1305_update.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_poly1305_update.3monocypher rename to doc/man/3monocypher/crypto_poly1305_update.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_sign.3monocypher b/doc/man/3monocypher/crypto_sign.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_sign.3monocypher rename to doc/man/3monocypher/crypto_sign.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_sign_public_key.3monocypher b/doc/man/3monocypher/crypto_sign_public_key.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_sign_public_key.3monocypher rename to doc/man/3monocypher/crypto_sign_public_key.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_unlock.3monocypher b/doc/man/3monocypher/crypto_unlock.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_unlock.3monocypher rename to doc/man/3monocypher/crypto_unlock.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_x25519.3monocypher b/doc/man/3monocypher/crypto_x25519.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_x25519.3monocypher rename to doc/man/3monocypher/crypto_x25519.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_x25519_public_key.3monocypher b/doc/man/3monocypher/crypto_x25519_public_key.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_x25519_public_key.3monocypher rename to doc/man/3monocypher/crypto_x25519_public_key.3monocypher diff --git a/dist/doc/man/3monocypher/crypto_zerocmp.3monocypher b/doc/man/3monocypher/crypto_zerocmp.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/crypto_zerocmp.3monocypher rename to doc/man/3monocypher/crypto_zerocmp.3monocypher diff --git a/dist/doc/man/3monocypher/intro.3monocypher b/doc/man/3monocypher/intro.3monocypher similarity index 100% rename from dist/doc/man/3monocypher/intro.3monocypher rename to doc/man/3monocypher/intro.3monocypher diff --git a/dist/doc/man/3monocypher/style.css b/doc/man/3monocypher/style.css similarity index 100% rename from dist/doc/man/3monocypher/style.css rename to doc/man/3monocypher/style.css diff --git a/dist/makefile b/makefile similarity index 100% rename from dist/makefile rename to makefile diff --git a/dist/src/monocypher.c b/src/monocypher.c similarity index 100% rename from dist/src/monocypher.c rename to src/monocypher.c diff --git a/dist/src/monocypher.h b/src/monocypher.h similarity index 100% rename from dist/src/monocypher.h rename to src/monocypher.h diff --git a/dist/src/sha512.c b/src/sha512.c similarity index 100% rename from dist/src/sha512.c rename to src/sha512.c diff --git a/dist/src/sha512.h b/src/sha512.h similarity index 100% rename from dist/src/sha512.h rename to src/sha512.h diff --git a/dist/tests/coverage.sh b/tests/coverage.sh similarity index 100% rename from dist/tests/coverage.sh rename to tests/coverage.sh diff --git a/dist/tests/frama-c.sh b/tests/frama-c.sh similarity index 100% rename from dist/tests/frama-c.sh rename to tests/frama-c.sh diff --git a/tests/gen/makefile b/tests/gen/makefile index 1532b50..e1bb1e4 100644 --- a/tests/gen/makefile +++ b/tests/gen/makefile @@ -10,7 +10,7 @@ VEC = chacha20.vec xchacha20.vec poly1305.vec blake2b.vec \ sha512.vec argon2i.vec edDSA.vec x25519.vec VEC2 = $(patsubst %.vec, %.all.vec, $(VEC)) key_exchange.all.vec HEADERS = $(patsubst %.all.vec, %.h.vec, $(VEC2)) -VECTORS = ../../dist/tests/vectors.h +VECTORS = ../vectors.h all: $(VECTORS) @@ -22,33 +22,33 @@ clean: %.vec: %.out ./$< > $@ -%.o: %.c ../../dist/tests/utils.h ../ed25519-donna/ed25519.h - $(CC) $(CFLAGS) -c $< \ - -I ../../dist/tests \ +%.o: %.c ../utils.h ../ed25519-donna/ed25519.h + $(CC) $(CFLAGS) -c $< \ + -I .. \ -I ../ed25519-donna \ - -I ../../dist/src \ + -I ../../src \ $$(pkg-config --cflags libsodium) %.out: %.o monocypher.o utils.o ed25519.o $(CC) $(CFLAGS) -o $@ $^ \ $$(pkg-config --libs libsodium) -utils.o: ../../dist/tests/utils.c ../../dist/tests/utils.h - $(CC) $(CFLAGS) -c $< -I ../../dist/tests -I ../../dist/src +utils.o: ../utils.c ../utils.h + $(CC) $(CFLAGS) -c $< -I .. -I ../../src ed25519.o: ../ed25519-donna/ed25519.c $(wildcard ../ed25519-donna/*.h) $(CC) $(CFLAGS) -c $< \ - -I ../../dist/src \ + -I ../../src \ $(HASH) \ -DED25519_CUSTOMHASH \ -DED25519_TEST \ -DED25519_NO_INLINE_ASM \ -DED25519_FORCE_32BIT -monocypher.o: ../../dist/src/monocypher.c ../../dist/src/monocypher.h -m_sha512.o : ../../dist/src/sha512.c ../../dist/src/sha512.h +monocypher.o: ../../src/monocypher.c ../../src/monocypher.h +m_sha512.o : ../../src/sha512.c ../../src/sha512.h monocypher.o m_sha512.o: - $(CC) $(CFLAGS) -c $< -I ../../dist/src + $(CC) $(CFLAGS) -c $< -I ../../src vector_to_header.out: ../vector_to_header.c $(CC) $(CFLAGS) $< -o $@ diff --git a/dist/tests/speed.c b/tests/speed.c similarity index 100% rename from dist/tests/speed.c rename to tests/speed.c diff --git a/dist/tests/test.c b/tests/test.c similarity index 100% rename from dist/tests/test.c rename to tests/test.c diff --git a/dist/tests/utils.c b/tests/utils.c similarity index 100% rename from dist/tests/utils.c rename to tests/utils.c diff --git a/dist/tests/utils.h b/tests/utils.h similarity index 100% rename from dist/tests/utils.h rename to tests/utils.h