]> git.codecow.com Git - Monocypher.git/log
Monocypher.git
5 years agoelligator.py: fix comment typo
Fabio Scotoni [Mon, 9 Nov 2020 16:39:11 +0000 (17:39 +0100)]
elligator.py: fix comment typo

5 years agoMoved fe constant with the others
Loup Vaillant [Mon, 9 Nov 2020 13:25:29 +0000 (14:25 +0100)]
Moved fe constant with the others

5 years agoAdded test vectors from Kleshni
Loup Vaillant [Mon, 9 Nov 2020 13:04:18 +0000 (14:04 +0100)]
Added test vectors from Kleshni

Fixes #181

The MON-01-004 issue from Cure53's audit noted that Monocypher did not
compare to <https://github.com/Kleshni/Elligator-2>, which I didn't know
of at the time.  Some test vectors were added back then, but full
interoperability was not yet ascertained.  (Moreover, I though I'd added
vectors for the reverse map, and somehow didn't. This is now fixed.)

Now I have been able to generate decoding (direct map) test vectors from
Kleshni's implementation, that Monocypher matches perfectly.  For the
inverse map however, I was not so lucky: Monocypher and Kleshni disagree
on quite a few points, including those used in Kleshni's test vectors.

Some investigation revealed that currently, Kleshni's encoding (inverse
map) is not reliable.  In some cases, the round trip fails to yield the
same point we started with (and it's not just a matter of chopping off
the most significant bit).

However, Monocypher and Kleshni *do* agree on some points, which I have
added (and *checked* I have added) to the list of test vectors.  There's
just one divergence left: Monocypher fails to encode the zero point,
which is a departure from the standard (we're supposed to output the
zero representative instead).

5 years agoDocumented 2^255-19 carry propagation
Loup Vaillant [Sun, 8 Nov 2020 21:41:58 +0000 (22:41 +0100)]
Documented 2^255-19 carry propagation

Fixes #185

Carry propagation is now justified, in a way that I can personally vouch
for (I used to rely on SUPERCOP's ref10 code and proofs).

The use of arithmetic right shifts is also documented, and a workaround
has been devised in case someone somewhere uses a platforms that does
not perform sign extension. (That will never happen.)

5 years agoFixed assumption in 2^255-19 carry propagation
Loup Vaillant [Sun, 8 Nov 2020 12:17:08 +0000 (13:17 +0100)]
Fixed assumption in 2^255-19 carry propagation

Careful re-examination of the carry propagation code revealed that
SUPERCOP's invariants for fe_tobytes() were not respected: there is a
possibility that the inputs slightly outrange the set of input for which
SUPERCOP's original proof was intended.

This happens in invsqrt(), used for EdDSA verification And Elligator,
and the reverse map of Elligator.  X25519 is unaffected.

Note that we were unable to produce a set of input that actually
triggers this range overflow.  Moreover, careful mathematical analysis
(and tests with SAGE) showed that fe_tobytes() is actually much more
tolerant than SUPERCOP's proof let on.  As far as I can tell, this
slight overflow cannot trigger any observable bug.

Still, I figured it would be a good idea to abide those invariants
anyway, if only to facilitate future audits.  To this end, I made sure
the inputs of fe_tobytes() came directly from either multiplications
(which perform a carry propagation), or constants (where carry
propagation has been pre-computed).

5 years agoTIS-CI: ensure results are correct
Loup Vaillant [Sun, 8 Nov 2020 12:01:12 +0000 (13:01 +0100)]
TIS-CI: ensure results are correct

5 years agoLighter TIS-CI tests
Loup Vaillant [Sun, 8 Nov 2020 11:50:03 +0000 (12:50 +0100)]
Lighter TIS-CI tests

5 years agoOverhauled TIS-CI test suite
Loup Vaillant [Sat, 7 Nov 2020 23:51:31 +0000 (00:51 +0100)]
Overhauled TIS-CI test suite

5 years agoTests: fixed tweak coverage for Elligator.
Loup Vaillant [Sat, 7 Nov 2020 23:22:09 +0000 (00:22 +0100)]
Tests: fixed tweak coverage for Elligator.

Shifting the index by 6 caused a reuse of one bit, leading to 4
different configurations instead of 8.
Shifting by 5 means we are using the 3 least significant bits of the
index, as was always intended.

5 years agoFixed tis-ci.c declarations
Loup Vaillant [Sat, 7 Nov 2020 11:20:28 +0000 (12:20 +0100)]
Fixed tis-ci.c declarations

5 years agoRemoved non-standard empty array
Loup Vaillant [Sat, 7 Nov 2020 11:05:05 +0000 (12:05 +0100)]
Removed non-standard empty array

5 years agoManual: fixed old HChacha20 function name
Loup Vaillant [Thu, 5 Nov 2020 18:37:35 +0000 (19:37 +0100)]
Manual: fixed old HChacha20 function name

5 years agoManual: function prototype typo
Loup Vaillant [Thu, 5 Nov 2020 18:25:20 +0000 (19:25 +0100)]
Manual: function prototype typo

5 years agoTests: all messages to standard ouput
Loup Vaillant [Mon, 2 Nov 2020 16:58:05 +0000 (17:58 +0100)]
Tests: all messages to standard ouput

5 years agoNever ignore test failures
Loup Vaillant [Mon, 2 Nov 2020 12:44:20 +0000 (13:44 +0100)]
Never ignore test failures

5 years agoAdded vector based Chacha20 tests
Loup Vaillant [Sun, 1 Nov 2020 17:56:06 +0000 (18:56 +0100)]
Added vector based Chacha20 tests

5 years agoRe-ignore tests/vectors.h
Loup Vaillant [Thu, 29 Oct 2020 21:31:03 +0000 (22:31 +0100)]
Re-ignore tests/vectors.h

5 years agosimplified TEST macro
Loup Vaillant [Thu, 29 Oct 2020 21:30:42 +0000 (22:30 +0100)]
simplified TEST macro

We'll no longer need the entry points, TIS-CI will have dedicated tests

5 years agoReworked test vectors header format
Loup Vaillant [Mon, 26 Oct 2020 16:45:12 +0000 (17:45 +0100)]
Reworked test vectors header format

- Removed the header from git (we will no longer need it)
- Replaced the direct arrays by character strings in hexadecimal format.

That last one is an attempt to make those vectors more readable and
smaller (vectors.h is the biggest source of bloat in the tarballs).

5 years agoMerge pull request #195 from fscoto/master+doc-malleability
Loup Vaillant [Sun, 4 Oct 2020 11:25:22 +0000 (13:25 +0200)]
Merge pull request #195 from fscoto/master+doc-malleability

doc: clarify signature malleability in crypto_sign

5 years agodoc: clarify signature malleability in crypto_sign
Fabio Scotoni [Sun, 4 Oct 2020 04:44:49 +0000 (06:44 +0200)]
doc: clarify signature malleability in crypto_sign

Fixes #189; see the discussion there for details.

5 years agoDedicated test suite for TIS-CI
Loup Vaillant [Wed, 30 Sep 2020 19:48:46 +0000 (21:48 +0200)]
Dedicated test suite for TIS-CI

TIS-CI needs a dedicated test suite, different from the regular one.  So
I'm following my Chief Testing Officer's advice, and stole his work like
I should have from the very beginning.

We'll need to refine this, but this should be a good first step.

5 years agoMerge pull request #191 from fscoto/master+doc-malleability
Loup Vaillant [Sat, 26 Sep 2020 10:52:55 +0000 (12:52 +0200)]
Merge pull request #191 from fscoto/master+doc-malleability

HISTORY: note 2.0.5 rejecting modified signatures

5 years agoMerge pull request #192 from fscoto/master+argon2i-oops-the-params-also-matter
Loup Vaillant [Sat, 26 Sep 2020 10:27:41 +0000 (12:27 +0200)]
Merge pull request #192 from fscoto/master+argon2i-oops-the-params-also-matter

argon2i: Note that all parameters influence output

5 years agoargon2i: Note that all parameters influence output
Fabio Scotoni [Sat, 26 Sep 2020 06:38:50 +0000 (08:38 +0200)]
argon2i: Note that all parameters influence output

Sparked by #190.

5 years agoHISTORY: note 2.0.5 rejecting modified signatures
Fabio Scotoni [Sat, 26 Sep 2020 06:26:58 +0000 (08:26 +0200)]
HISTORY: note 2.0.5 rejecting modified signatures

Change introduced in 974e55d21c1fac7a2e21f91cb7174601b653180a and
24f4be7acc3ec7ff613715a7a97597e587f6d6d8.

The actual reasons to introduce this were actually performance-related.

Sparked by #189.

5 years agodocumented make install USE_ED25519=true
Loup Vaillant [Tue, 22 Sep 2020 19:36:49 +0000 (21:36 +0200)]
documented make install USE_ED25519=true

5 years agoFixed copy in man2html.sh
Loup Vaillant [Mon, 24 Aug 2020 17:20:28 +0000 (19:20 +0200)]
Fixed copy in man2html.sh

5 years agoPoly1305 carry propagation now uses loops
Loup Vaillant [Thu, 13 Aug 2020 15:50:07 +0000 (17:50 +0200)]
Poly1305 carry propagation now uses loops

Mostly for consistency with 25519 arithmetic.
Also slightly reduces binary size in some cases, most notably -Os.

5 years agoSmall carry simplification
Loup Vaillant [Thu, 13 Aug 2020 14:34:51 +0000 (16:34 +0200)]
Small carry simplification

5 years agoMore readable Blake2b unrolled loop
Loup Vaillant [Fri, 31 Jul 2020 21:11:33 +0000 (23:11 +0200)]
More readable Blake2b unrolled loop

5 years agoFixed compiler warning
Loup Vaillant [Fri, 31 Jul 2020 21:04:16 +0000 (23:04 +0200)]
Fixed compiler warning

Fixes #187

Note: w should remain a signed integer, so w-1 is correctly compared in
the FOR_T loop.

5 years agoNo longer ignore tests/vectors.h (for TIS-CI)
Loup Vaillant [Tue, 28 Jul 2020 18:18:12 +0000 (20:18 +0200)]
No longer ignore tests/vectors.h (for TIS-CI)

5 years agoFixed tis.config (3)
Loup Vaillant [Tue, 28 Jul 2020 13:55:39 +0000 (15:55 +0200)]
Fixed tis.config (3)

5 years agoFixed tis.config (2)
Loup Vaillant [Tue, 28 Jul 2020 13:53:08 +0000 (15:53 +0200)]
Fixed tis.config (2)

5 years agoFixed tis.config
Loup Vaillant [Tue, 28 Jul 2020 13:47:54 +0000 (15:47 +0200)]
Fixed tis.config

5 years agoAdded TIS-CI support
Loup Vaillant [Tue, 28 Jul 2020 13:42:25 +0000 (15:42 +0200)]
Added TIS-CI support

5 years agoPrepared entry points for TIS-CI
Loup Vaillant [Tue, 28 Jul 2020 12:47:09 +0000 (14:47 +0200)]
Prepared entry points for TIS-CI

5 years agoSeparated basic/advanced functions in different folders
Loup Vaillant [Tue, 28 Jul 2020 00:08:28 +0000 (02:08 +0200)]
Separated basic/advanced functions in different folders

Addresses MON-01-005
Fixes #182

5 years agoBetter low/high level separation in the header.
Loup Vaillant [Mon, 27 Jul 2020 11:10:32 +0000 (13:10 +0200)]
Better low/high level separation in the header.

Partially addreses MON-01-005.  #182

Also added various warnings in comments.

Also pretend the min number of Argon2i iterations passes is 3.
It's not true, but any less would not be secure.

5 years agoArgon2i hash is now allowed to overlap with the work area
Loup Vaillant [Fri, 10 Jul 2020 22:46:38 +0000 (00:46 +0200)]
Argon2i hash is now allowed to overlap with the work area

Fixes #183

Almost all of Monocypher allows arguments to overlap. Users may come to
expect it, and misuse those who don't allow such an overlap. (Chacha20
and AEAD are an exception, but (i) portability concerns prevents us to
allow it properly, and (ii) disallowed overlaps tend to trigger visible
corruptions immediately.)

Before, having the hash coincide with the working area meant the output
was always zero.  All passwords have the same hash.  Therefore all
passwords are correct.  Oops.  For the record, I made the mistake, and
caught the bug only days later, by pure luck.

Now overlap is allowed, and gives the right result. Note that the work
area is still wiped.  The wipe just happens *before* the final hash is
computed.

5 years agoMerge pull request #184 from fscoto/master+mon-01-001
Loup Vaillant [Fri, 10 Jul 2020 22:32:33 +0000 (00:32 +0200)]
Merge pull request #184 from fscoto/master+mon-01-001

intro: macOS, illumos and Solaris have arc4random_buf(3)

Fix #180

5 years agointro: macOS, illumos and Solaris have arc4random_buf(3)
Fabio Scotoni [Fri, 10 Jul 2020 18:14:46 +0000 (20:14 +0200)]
intro: macOS, illumos and Solaris have arc4random_buf(3)

5 years agoBetter test for crypto_x25519_inverse()
Loup Vaillant [Sun, 5 Jul 2020 09:46:13 +0000 (11:46 +0200)]
Better test for crypto_x25519_inverse()

5 years agoRemoved redundant all zero test vector
Loup Vaillant [Mon, 29 Jun 2020 18:13:15 +0000 (20:13 +0200)]
Removed redundant all zero test vector

5 years agoAdded Kleshni/Elligator-2 test vectors
Loup Vaillant [Sun, 28 Jun 2020 22:40:50 +0000 (00:40 +0200)]
Added Kleshni/Elligator-2 test vectors

An auditor recently told me about the following repository on GitHub:

  https://github.com/Kleshni/Elligator-2/

I was able to steal a couple test vectors from them.  Not all of them
unfortunately:

- Some representative exceed 2^254, and Monocypher do not decode
  negative representatives.  Instead, it assumes it has a positive
  representative, and clears the two most significant bits before
  decoding.

- It is not clear yet what encoding does, and some points in the (few)
  test vectors have their most significant bit set. Monocypher ignores
  the most significant bit of curve point, basically assumes they are
  all below 2^255 - 19.  Adding those points will require tweaking
  similar to the tweaking applied to the Hash to Curve RFC draft test
  vectors.

5 years agoAdded extern "C" to optional & deprecated files
Loup Vaillant [Mon, 15 Jun 2020 21:54:21 +0000 (23:54 +0200)]
Added extern "C" to optional & deprecated files

5 years agoAdjusted changelog date
Loup Vaillant [Mon, 15 Jun 2020 21:41:29 +0000 (23:41 +0200)]
Adjusted changelog date

5 years agoUpdated changelog
Loup Vaillant [Fri, 12 Jun 2020 19:43:55 +0000 (21:43 +0200)]
Updated changelog

5 years agoOptimised key loading in Blake2b
Loup Vaillant [Mon, 8 Jun 2020 15:46:16 +0000 (17:46 +0200)]
Optimised key loading in Blake2b

The idea is to avoid the slow loading code in the internal
blake2b_update() function, and avoid the overhead of calling
crypto_blake2b_update().

It's a micro-optimisation that in principle shouldn't matter that much,
but it might help a bit if we repeatedly hash small messages with a key,
as can happen in authenticated key exchanges like Monokex.

5 years agoRemoved #define from vectors.h
Loup Vaillant [Fri, 29 May 2020 21:40:50 +0000 (23:40 +0200)]
Removed #define from vectors.h

Also reduced the size of vectors.h by removing indirections and printing
numbers in decimal form. Hopefully this will make the tarball a little
smaller.

5 years agoFixed various compiler warnings
Loup Vaillant [Fri, 29 May 2020 18:09:41 +0000 (20:09 +0200)]
Fixed various compiler warnings

Fixes #179

5 years agoMerge pull request #178 from fscoto/master+fix-includes
Loup Vaillant [Sun, 24 May 2020 18:48:18 +0000 (20:48 +0200)]
Merge pull request #178 from fscoto/master+fix-includes

doc: Fix .In for optional code

5 years agodoc: Fix crypto_ed25519_public_key function name
Fabio Scotoni [Sun, 24 May 2020 13:20:39 +0000 (15:20 +0200)]
doc: Fix crypto_ed25519_public_key function name

5 years agodoc: Fix .In for optional code
Fabio Scotoni [Sun, 24 May 2020 10:54:05 +0000 (12:54 +0200)]
doc: Fix .In for optional code

5 years agoREADME: Monocypher is not compatible with NaCl
Loup Vaillant [Tue, 12 May 2020 09:49:44 +0000 (11:49 +0200)]
README: Monocypher is not compatible with NaCl

Fixes #177

This removes the suggestion that we can replace Monocypher with NaCl.
We cannot, only Libsodium is compatible.

5 years agoCosmetic. compact grouping of vtables
Loup Vaillant [Sat, 2 May 2020 20:18:15 +0000 (22:18 +0200)]
Cosmetic. compact grouping of vtables

5 years agoTurned ALIGN into a function
Loup Vaillant [Sat, 2 May 2020 17:25:21 +0000 (19:25 +0200)]
Turned ALIGN into a function

5 years agoMerge pull request #173 from fscoto/master+reproball
Loup Vaillant [Wed, 22 Apr 2020 15:57:26 +0000 (17:57 +0200)]
Merge pull request #173 from fscoto/master+reproball

Make tarball generation reproducible

5 years agodist.sh: Make tarball reproducible
Fabio Scotoni [Wed, 22 Apr 2020 14:35:05 +0000 (16:35 +0200)]
dist.sh: Make tarball reproducible

5 years agoMake Elligator test vector gen deterministic
Fabio Scotoni [Wed, 22 Apr 2020 14:33:03 +0000 (16:33 +0200)]
Make Elligator test vector gen deterministic

This paves the way for reproducible tarballs.
Since the test vectors must be generated for a complete tarball,
these must agree everywhere.

The lack of actual randomness is harmless because these are test
vectors, not actual usages of Elligator.

5 years agoMore readable Blake2 round function
Loup Vaillant [Mon, 20 Apr 2020 14:29:07 +0000 (16:29 +0200)]
More readable Blake2 round function

5 years agoFixed (NULL + 0) undefined behaviour
Loup Vaillant [Mon, 20 Apr 2020 11:59:31 +0000 (13:59 +0200)]
Fixed (NULL + 0) undefined behaviour

It appears that arithmetic on NULL pointers is undefined, even when we
just add zero.

Monocypher generally allows input buffers to be NULL pointers if their
length is zero.  This is because we never dereference those pointers in
this case.  Likewise, we should not perform any arithmetic on them.

The fix is to return immediately when the input buffer length is zero.

5 years agoMerge pull request #171 from stevefan1999-personal/patch-1
Loup Vaillant [Sat, 18 Apr 2020 15:41:39 +0000 (17:41 +0200)]
Merge pull request #171 from stevefan1999-personal/patch-1

Add extern C if C++ presents

5 years agoUpdate monocypher.h
Steve Fan [Sat, 18 Apr 2020 10:14:21 +0000 (18:14 +0800)]
Update monocypher.h

5 years agoTrim scalar in place
Loup Vaillant [Thu, 16 Apr 2020 18:12:32 +0000 (20:12 +0200)]
Trim scalar in place

Fixes #170

Reverts 6411aa419f113a283feac0240b736a1f7e1e8ed1

Turns out MSVC didn't like the aliasing in trim_scalar(), and managed to
break the code.

And this wasn't very elegant in hindsight anyway.

5 years agoWorked around Microsoft compiler warning
Loup Vaillant [Thu, 16 Apr 2020 17:52:50 +0000 (19:52 +0200)]
Worked around Microsoft compiler warning

Fixes #169

MSVC issues a warning when we try to negate an unsigned number.  The goal
however was to perform bit twiddling, so I used bitwise negation.
Hopefully the compiler will not complain about overflow, which is
perfectly well defined on unsigned numbers.

5 years agoReordered functions and constants
Loup Vaillant [Wed, 15 Apr 2020 20:15:56 +0000 (22:15 +0200)]
Reordered functions and constants

5 years agoInlined fe_mul121666)
Loup Vaillant [Wed, 15 Apr 2020 19:38:32 +0000 (21:38 +0200)]
Inlined fe_mul121666)

5 years agoSimplified GF(2^255-19) carry propagation
Loup Vaillant [Wed, 15 Apr 2020 19:23:42 +0000 (21:23 +0200)]
Simplified GF(2^255-19) carry propagation

There used to be two ways to perform carry propagation: a "fast" one,
used after decoding and multiplication by small numbers, and a "safe"
one, more conservative, used after full multiplications or squarings.

Using the safe carry propagation simplifies the source code and
facilitates audits.  The cost is a 1% performance hit for X25519.

5 years agoFixed shift of integers on 16 bit machines
Loup Vaillant [Fri, 10 Apr 2020 21:22:21 +0000 (23:22 +0200)]
Fixed shift of integers on 16 bit machines

5 years agoIndentation fix
Loup Vaillant [Thu, 9 Apr 2020 23:38:19 +0000 (01:38 +0200)]
Indentation fix

5 years agocomment nitpick
Loup Vaillant [Thu, 9 Apr 2020 21:16:10 +0000 (23:16 +0200)]
comment nitpick

5 years agoMerge pull request #168 from fscoto/master+argon2-doc-iter
Loup Vaillant [Wed, 8 Apr 2020 12:21:21 +0000 (14:21 +0200)]
Merge pull request #168 from fscoto/master+argon2-doc-iter

argon2i: Warn about conequences of nb_iterations < 3

5 years agoargon2i: Warn about conequences of nb_iterations<3
Fabio Scotoni [Wed, 8 Apr 2020 11:40:13 +0000 (13:40 +0200)]
argon2i: Warn about conequences of nb_iterations<3

6 years agoUpdate CHANGELOG date
Loup Vaillant [Fri, 3 Apr 2020 07:19:34 +0000 (09:19 +0200)]
Update CHANGELOG date

6 years agoFixed CHANGELOG version number
Loup Vaillant [Fri, 3 Apr 2020 06:59:24 +0000 (08:59 +0200)]
Fixed CHANGELOG version number

6 years agoVarious makefile cleanups
Loup Vaillant [Thu, 2 Apr 2020 21:22:02 +0000 (23:22 +0200)]
Various makefile cleanups

Moved the pkg-config files elsewhere, to simplify the makefile. A simple
variable substitution takes care of $(PREFIX).

Fixed missing "/" in libdir path (which somehow didn't seem to confuse
pkg-config).

Path variable no longer include $(DESTDIR). Instead, we prefix it
explicitly every time we use a path.

6 years agoMore thorough testing
Loup Vaillant [Wed, 1 Apr 2020 19:00:54 +0000 (21:00 +0200)]
More thorough testing

6 years agoNitpicks
Loup Vaillant [Wed, 1 Apr 2020 18:31:30 +0000 (20:31 +0200)]
Nitpicks

6 years agoSome more tests
Loup Vaillant [Wed, 1 Apr 2020 18:31:07 +0000 (20:31 +0200)]
Some more tests

6 years agoMerge pull request #165 from fscoto/master+license-bump
Loup Vaillant [Tue, 31 Mar 2020 13:35:07 +0000 (15:35 +0200)]
Merge pull request #165 from fscoto/master+license-bump

LICENCE.md: Bump everyone's year

6 years agoMerge pull request #164 from fscoto/master+misc-doc
Loup Vaillant [Tue, 31 Mar 2020 13:33:50 +0000 (15:33 +0200)]
Merge pull request #164 from fscoto/master+misc-doc

Sweeping manual review nitpick fixes

6 years agoLICENCE.md: Bump everyone's year
Fabio Scotoni [Tue, 31 Mar 2020 13:32:59 +0000 (15:32 +0200)]
LICENCE.md: Bump everyone's year

Non-trivial contributions by everyone.

6 years agoAddress review concerns from #164.
Fabio Scotoni [Tue, 31 Mar 2020 13:11:10 +0000 (15:11 +0200)]
Address review concerns from #164.

1. Remove recommendation for 512-bit BLAKE2b.
   32 bytes is enough, and it's not like we offer EC functions of a
   higher security level either.
   The text added in 628f027 already does enough to recommend proper
   hash output lengths.
2. Bump .Dd date in crypto_poly1305.3monocypher.
3. crypto_verify16 add "byte by byte" for both accuracy of how a MAC
   with a variable-time comparison function will be found and
   for dramatic reasons because it sounds like doom is slowly
   approaching, byte by byte.

6 years agocrypto_ietf_chacha20: Add missing section to .Xr
Fabio Scotoni [Tue, 31 Mar 2020 12:14:09 +0000 (14:14 +0200)]
crypto_ietf_chacha20: Add missing section to .Xr

While there and bumping dates, fix authorship years for the CC0 part.

6 years agocrypto_sign_init_first_pass: Swap emphasis
Fabio Scotoni [Tue, 31 Mar 2020 12:08:19 +0000 (14:08 +0200)]
crypto_sign_init_first_pass: Swap emphasis

The original emphasis, when skimmed, made the message read that the
first pass *causes* loss of all security, which is the opposite of what
we want to emphasize.

Also bump authorship notice years while there and mdoc date that we
forgot to bump when we introduced the power-analysis and glitching
example.

6 years agocrypto_sign: s/document/message/
Fabio Scotoni [Tue, 31 Mar 2020 12:03:36 +0000 (14:03 +0200)]
crypto_sign: s/document/message/

We don't need to introduce new, confusing terminology right at the end
of the page.

6 years agocrypto_curve_to_hidden: Add missing word
Fabio Scotoni [Tue, 31 Mar 2020 12:00:15 +0000 (14:00 +0200)]
crypto_curve_to_hidden: Add missing word

6 years agocrypto_argon2i: The given usages are just examples; clarify as much
Fabio Scotoni [Tue, 31 Mar 2020 11:55:22 +0000 (13:55 +0200)]
crypto_argon2i: The given usages are just examples; clarify as much

6 years agocrypto_blake2b: Harmonize description with MAC example
Fabio Scotoni [Tue, 31 Mar 2020 11:52:30 +0000 (13:52 +0200)]
crypto_blake2b: Harmonize description with MAC example

6 years agocrypto_verify: wording nitpicks
Fabio Scotoni [Tue, 31 Mar 2020 11:49:55 +0000 (13:49 +0200)]
crypto_verify: wording nitpicks

1. s/guessed a few bytes/guessed a byte/
   Nobody guesses multiple bytes per attempt except by sheer dumb luck.
2. Add missing "functions" to make one sentence not seem incomplete.

6 years agointro, crypto_poly1305: standardize "one-time"
Fabio Scotoni [Tue, 31 Mar 2020 11:46:03 +0000 (13:46 +0200)]
intro, crypto_poly1305: standardize "one-time"

6 years agodoc: crypto_xchacha20 does XChaCha20, not Chacha20
Fabio Scotoni [Tue, 31 Mar 2020 11:44:00 +0000 (13:44 +0200)]
doc: crypto_xchacha20 does XChaCha20, not Chacha20

6 years agocrypto_x25519: Note that _from_eddsa exists
Fabio Scotoni [Tue, 31 Mar 2020 11:39:37 +0000 (13:39 +0200)]
crypto_x25519: Note that _from_eddsa exists

6 years agocrypto_key_exchange: Note that _from_eddsa exists
Fabio Scotoni [Tue, 31 Mar 2020 11:37:47 +0000 (13:37 +0200)]
crypto_key_exchange: Note that _from_eddsa exists

6 years agoManual: nits & typos
Loup Vaillant [Tue, 31 Mar 2020 08:33:23 +0000 (10:33 +0200)]
Manual: nits & typos

6 years agoUpdate changelog
Loup Vaillant [Tue, 31 Mar 2020 07:34:48 +0000 (09:34 +0200)]
Update changelog

6 years agoFixed copyright year
Loup Vaillant [Mon, 30 Mar 2020 14:43:31 +0000 (16:43 +0200)]
Fixed copyright year

6 years agoAdded constant time tests with Valgrind
Loup Vaillant [Mon, 30 Mar 2020 13:28:43 +0000 (15:28 +0200)]
Added constant time tests with Valgrind

The trick is to call Monocypher API with uninitialised buffers.

If Valgrind complains about uninitialised something, that means an array
index or a conditional jump depends on secret data.

Note that crypto_check() is not tested: that's because it doesn't even
try to be constant time.

Note that a couple tested functions do have secret dependent conditional
jumps.  Those jumps however are just final checks, that just reveal
success or failure (and those are revealed anyway, as part as the
semantics of the function being tested).

Note that optimisations are disabled for the compilation of `ctgrind.c`
and the linking of `ctgrind.out`. This is an attempt to maximise
Valgrind's findings.

Also note that Valgrind seems to miss a secret dependent conditional
jump (it finds only one where we should have 2). But that may just be
Valgrind squashing the error report, instead of an actual miss.