]> git.codecow.com Git - Monocypher.git/commit
Remove EdDSA incremental & custom hash API
authorLoup Vaillant <loup@loup-vaillant.fr>
Thu, 1 Dec 2022 15:27:08 +0000 (16:27 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Thu, 1 Dec 2022 15:51:39 +0000 (16:51 +0100)
commit77812533af12acb83843fbe29d210eddbb8fa127
treead75dbff0371525a9bf3b791d874e7aa0f64529d
parent692206aec00159161717ef02b114a3903a22eaca
Remove EdDSA incremental & custom hash API

The incremental and custom hash API was too complex and too niche to
justify itself.  I'm removing them in favour of a more flexible
approach: giving the basic building blocks necessary to implement EdDSA
manually.

Those building blocks comprise 5 specialised functions:

- crypto_eddsa_trim_scalar: turn 32 random bytes into a proper scalar.
- crypto_eddsa_reduce     : reduces a 64 bytes number modulo L.
- crypto_eddsa_mul_add    : like MUL_ADD, except modulo L.
- crypto_eddsa_scalarbase : multiplies a scalar by the base point.
- crypto_eddsa_r_check    : generates R independently for verification.

These make it fairly easy to implement EdDSA (including Ed25519) in
various ways, including the streaming and custom hash functions I just
removed, replacing the deterministic nonce by a random one, or adding a
random prefix to mitigate the energy side channel in some settings.

I believe only minimal tweaks are required to implement the Edwards25519
half of RFC 8032 entirely (including the context and pre-hash variants),
as well as XEdDSA (which should only require a single Montgomery to
Edwards conversion function).

This is a prototype, and the extensibility promises remain to be tested.
Ideally that means implementing all the fancy extensions in a separate
project, and _maybe_ include some of them in the optional files.

Related to #227
23 files changed:
doc/man/man3/advanced/crypto_check_final.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_check_init.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_check_init_custom_hash.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_check_update.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_sign_final.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_sign_init_first_pass.3monocypher [deleted file]
doc/man/man3/advanced/crypto_sign_init_first_pass_custom_hash.3monocypher [deleted file]
doc/man/man3/advanced/crypto_sign_init_second_pass.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_sign_public_key_custom_hash.3monocypher [deleted symlink]
doc/man/man3/advanced/crypto_sign_update.3monocypher [deleted symlink]
doc/man/man3/intro.3monocypher
doc/man/man3/optional/crypto_ed25519_check_final.3monocypher [deleted symlink]
doc/man/man3/optional/crypto_ed25519_check_init.3monocypher [deleted symlink]
doc/man/man3/optional/crypto_ed25519_check_update.3monocypher [deleted symlink]
doc/man/man3/optional/crypto_ed25519_sign_final.3monocypher [deleted symlink]
doc/man/man3/optional/crypto_ed25519_sign_init_first_pass.3monocypher [deleted file]
doc/man/man3/optional/crypto_ed25519_sign_init_second_pass.3monocypher [deleted symlink]
doc/man/man3/optional/crypto_ed25519_sign_update.3monocypher [deleted symlink]
src/monocypher.c
src/monocypher.h
src/optional/monocypher-ed25519.c
src/optional/monocypher-ed25519.h
tests/test.c