AtlatestRepositorysigil-crypto
sigil-crypto / tree / vendorMONOCYPHER.md
1
# Monocypher vendor provenance3
Version: 4.0.3 (released 2026-06-15).4
Upstream: https://monocypher.org/ (source: https://github.com/LoupVaillant/Monocypher)5
Archive: https://monocypher.org/download/monocypher-4.0.3.tar.gz6
SHA512: 40904ada5c7ee4f7741733e38b69a30a4b0561cbffba5ffe7c2dce16136d540251ec0d9056ff606510d3b5b708fb8a40db7e0870d4a0b2dc17ba2bfb880f89658
The archive's SHA-512 matches the `.sha512` file published beside it on9
monocypher.org, and the same tarball downloaded from the GitHub release10
(https://github.com/LoupVaillant/Monocypher/releases/download/4.0.3/monocypher-4.0.3.tar.gz)11
has the same digest.13
Licence: dual BSD-2-Clause OR CC0-1.0, at the user's choice14
(`SPDX-License-Identifier: BSD-2-Clause OR CC0-1.0`). sigil-crypto uses it15
under BSD-2-Clause. The full text is in `monocypher/LICENCE.md`.17
## What is mirrored19
Under `monocypher/`, byte-identical to the archive:21
src/monocypher.c core: BLAKE2b, EdDSA arithmetic, ...22
src/monocypher.h23
src/optional/monocypher-ed25519.c SHA-512 and Ed25519 (RFC 8032)24
src/optional/monocypher-ed25519.h25
LICENCE.md AUTHORS.md CHANGELOG.md README.md27
No file is modified. Tests, docs and the build system are not mirrored.29
## Why Monocypher31
sigil-crypto needs Ed25519 verification and BLAKE2b-512 for minisign32
signatures. Mbed TLS 3.6 has neither EdDSA nor BLAKE2b.34
- Small: about 3,500 lines of C99 for the two files, no allocation, no35
platform calls, so it compiles unchanged for wasm32-wasi.36
- Audited: Cure53 reviewed Monocypher in June 2020 and found no High or37
Critical issues (https://monocypher.org/quality-assurance/audit). That38
audit covered the 3.x line; the 4.x EdDSA API was reworked after it.39
- Tested upstream against RFC 8032 and Wycheproof-derived vectors, under40
sanitisers, Valgrind, TIS-CI and Frama-C.41
- 4.0.3 rather than 4.0.2: 4.0.3 fixes a timing leak in EdDSA/Ed2551942
signing. Verification only handles public data, but the signing entry43
point is exported too.45
Alternatives considered: libsodium (what minisign itself uses, ISC; a much46
larger library with its own platform and entropy layer, which the wasm build47
would have to carry), TweetNaCl (public domain and smallest, but its48
verification skips the S < L check and it is not maintained as a library),49
and the SUPERCOP ref10 code (public domain, not packaged as a library).50
Monocypher 3.1.3 was reconsidered during review because its verification is51
cofactorless like libsodium's; it was not taken because 3.x lacks 4.0.3's52
signing timing fix (topics/monocypher-cofactored-verification-vs-libsodium53
in the estate notes).55
## Verification rules57
`crypto_ed25519_check` checks the cofactored equation `[8](sB - hA - R) = 0`,58
rejects `S >= L`, and accepts non-canonical encodings of A and R. sigil-crypto's59
wrapper (`native/ed25519-verify.c`) additionally rejects non-canonical encodings of A60
and R (RFC 8032 section 5.1.3) and small-order A and R (as libsodium does), so61
the accept set is RFC 8032 section 5.1.7 plus libsodium's small-order rule.