From: Loup Vaillant Date: Sun, 1 Dec 2019 14:56:34 +0000 (+0100) Subject: Added USE_ED25519 makefile option X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=75442f07309f56490e171d5f75ade41ba33cb664;p=Monocypher.git Added USE_ED25519 makefile option --- diff --git a/README.md b/README.md index 3d31381..2ae96d8 100644 --- a/README.md +++ b/README.md @@ -150,21 +150,16 @@ and c25519 (the default is `-O3 march=native`): Customisation ------------- -Monocypher has two preprocessor flags: `ED25519_SHA512` and -`BLAKE2_NO_UNROLLING`, which are activated by compiling monocypher.c -with the options `-DED25519_SHA512` and `-DBLAKE2_NO_UNROLLING` -respectively. - -The `-DED25519_SHA512` option is a compatibility feature for public key -signatures. The default is EdDSA with Curve25519 and Blake2b. -Activating the option replaces it by Ed25519 (EdDSA with Curve25519 and -SHA-512). When this option is activated, you will need to link the -final program with a suitable SHA-512 implementation. You can use the -`sha512.c` and `sha512.h` files provided in `src/optional`. The -makefile does this linking automatically whenever the `$CFLAGS` variable -contains the `-DED25519_SHA512` option. For instance: - - $ make CFLAGS="-O2 -DED25519_SHA512" +Monocypher has optional compatibility with Ed25519. To have that, add +`ed25519.h` and `ed25519.h` provided in `src/optional` to your project. +If you're using the makefile, define the `USE_ED25519` variable to link +it to monocypher.a and monocypher.so: + + $ make USE_ED25519=true + +Monocypher also has the `BLAKE2_NO_UNROLLING` preprocessor flag, which +is activated by compiling monocypher.c with the `-DBLAKE2_NO_UNROLLING` +option. The `-DBLAKE2_NO_UNROLLING` option is a performance tweak. By default, Monocypher unrolls the Blake2b inner loop, because doing so is over 25% diff --git a/makefile b/makefile index 58b9d0c..dc029f7 100644 --- a/makefile +++ b/makefile @@ -8,8 +8,9 @@ SONAME=libmonocypher.so.3 VERSION=__git__ -ifdef LINK_ED25519 +ifdef USE_ED25519 LINK_ED25519=lib/ed25519.o +INSTALL_ED25519=cp src/optional/ed25519.h $(DESTDIR)/$(PREFIX)/include endif .PHONY: all library static-library dynamic-library \ @@ -26,6 +27,7 @@ install: library src/monocypher.h install-doc mkdir -p $(PKGCONFIG) cp -P lib/libmonocypher.a lib/libmonocypher.so* $(DESTDIR)/$(PREFIX)/lib cp src/monocypher.h $(DESTDIR)/$(PREFIX)/include + $(INSTALL_ED25519) @echo "Creating $(PKGCONFIG)/monocypher.pc" @echo "prefix=/$(PREFIX)" > $(PKGCONFIG)/monocypher.pc @echo 'exec_prefix=$${prefix}' >> $(PKGCONFIG)/monocypher.pc