36 Commits

Author SHA1 Message Date
Jesper Louis Andersen
edd95498d1 Fix pwhash_str* functions.
The API for pwhash_str returns a cstring in the output buffer. These
are null terminated. However, we return the full buffer as a binary
back to Erlang. This means that we have a buffer with 0'es in the end.

The tests take this buffer and passes it back in as is. Hence all the
tests pass. However, it is conceivable that if we write said buffer to
disk somewhere, we are not going to write those 0's out.

When we then load the ASCII-armored Argon2 string into memory again,
it is not 0-terminated as a cstring should be, and this produces
errors all over the place.

The fix is twofold:

* Return the full buffer to Erlang, but use binary:split/2 to create a
  subbinary with the relevant part.
* Add a 0 in the end of ASCII Argon2 string before passing it to
  libsodium

Since we are looking at pwhashing, and Argon2, we expect the
computational problem to be memory bound. Thus, spending a bit more
work in memory is not going to have any considerable impact on the
speed of this system.
2018-05-21 15:21:09 +02:00
Jesper Louis Andersen
3b9bc848e9 Move functions around. Mark untested functionality.
A lot of people who pushed functions they missed have not pushed any
kind of test cases for them. To make sure we have test coverage, I've
marked the functions we have under test and the functions we are still
missing tests for.
2018-05-21 12:27:24 +02:00
Jesper Louis Andersen
75042a24ba Compile helper for development 2018-05-21 12:09:32 +02:00
Jesper Louis Andersen
fb7de2cbb4
Merge pull request #21 from aeternity/add_aead_chacha20poly1305
Add AEAD chacha20poly1305
2018-05-20 19:38:14 +02:00
Jesper Louis Andersen
0c5acd2fba Fix test cases for the pwhash_str_* calls 2018-05-20 19:36:31 +02:00
Hans Svensson
7181600cb4 Simple QuickCheck properties for ChaCha20Poly1305 2018-03-05 09:53:08 +01:00
daveed-al
fb5985da27 pwhash_str_verify test update 2018-02-01 18:25:16 +08:00
daveed-al
b2efb45126 pwhash_str_verify 2018-02-01 18:23:23 +08:00
daveed-al
d4a2a14bc9 adding test for pwhash_str_verify 2018-02-01 00:54:20 +08:00
Irina Guberman
43835abafe fix EQC fault calls 2017-08-16 23:52:31 -05:00
Irina Guberman
cfd654c275 Add eqc_mini_run and eqc_run directives to Makefile 2017-08-16 23:40:51 -05:00
Irina Guberman
fd796440db replace xrouter_clientd with xrouter_procd 2017-08-16 18:42:30 -05:00
Zane Beckwith
207ec85f8c Modify QuickCheck tests to be runnable to eqc-mini.
This involves:
- Removing calls to conjunction function
- Modifying fault* functions to _always_ return "Good" generator
- Commenting-out the eqc_parallelize parse_transform
2017-08-16 21:17:28 +00:00
Jesper Louis Andersen
61be95caad Bump version to 0.16.0 2017-03-25 23:25:25 +01:00
Jesper Louis Andersen
8c567be6a6 Also test large binaries, which forces the dirty scheduler variants. 2015-08-29 21:32:08 +02:00
Jesper Louis Andersen
f444d1e4ac Fix box_seal/2 and box_seal_open/3.
* Call the functions `box_seal` and `box_seal_open` to match the libsodium names in module `enacl`.
* Fix a bug in the C NIF: We should fail if the input is `<` SEALBYTES but not on `<=` SEALBYTES. The latter made it impossible to encode empty messages.
* Add variants which run directly on the interpreter scheduler for small messages.

Also:

* Provide full EQC functions for the testing purposes. This generated around 13000 random test cases in a 5 minute run, all passing.# Please enter the commit message for your changes. Lines starting
2015-08-14 22:03:33 +02:00
Jesper Louis Andersen
92109eb354 Improve and verify sign_*_detached functions.
Provide non-dirty-scheduler variants for small strings, accurately bump
reductions for these strings.

While here, provide EQC test cases for the two functions.
2015-08-12 23:11:41 +02:00
Joel Stanley
7e7ac67fb3 Add bindings to the libsodium DSA operations 'crypto_sign_detached' and 'crypto_sign_verify_detached' 2015-07-26 08:00:48 -05:00
Jesper Louis Andersen
3f8979ce64 Introduce a test case for the extension code. 2015-02-22 14:52:39 +01:00
Jesper Louis Andersen
69051e1803 Correct an afternm bug in the test cases. 2015-02-22 14:38:26 +01:00
Jesper Louis Andersen
2a23a16ed3 Add in tests for beforenm/afternm to the EQC model. 2014-12-18 08:48:05 +01:00
Jesper Louis Andersen
b6aee8365d Inject faults into iodata() values.
This further verifies the test cases and also the enacl API. By injecting
wrong data, we verify that given incorrect data will make the system fail
and error(badarg) all over the place.
2014-12-17 12:19:04 +01:00
Jesper Louis Andersen
b1ed21e71d Introduce iodata() in the EQC tests.
Introduce a type for iodata() in the EQC tests. Use this type throughout
the tests in order to make sure we can supply iodata() in all places where
we claim we can supply iodata().
2014-12-17 08:36:49 +01:00
Jesper Louis Andersen
f7dedf8236 Write tests for randombytes/1 and the scramble_block_16 extension. 2014-12-13 02:09:03 +01:00
Jesper Louis Andersen
5fec48c091 EQC Test improvements
* Generalize binary generation because it is used again and again.
* Use generalized binary generation in the hash functions since they are much faster as generators.
2014-12-13 02:00:52 +01:00
Jesper Louis Andersen
33612a083e Test enacl:sign_open/2 as well. 2014-11-28 13:31:02 +01:00
Jesper Louis Andersen
9cd38c7651 Introduce test cases for signing and partially for sign-opening. 2014-11-26 22:10:09 +01:00
Jesper Louis Andersen
57bb93683b Introduce tests for authentication verification and provide basis for signatures. 2014-11-26 20:05:59 +01:00
Jesper Louis Andersen
ec0cc1afaa Handle the Auth tests. 2014-11-26 15:08:14 +01:00
Jesper Louis Andersen
6a707aef57 Write test cases for the streaming API. 2014-11-26 14:24:14 +01:00
Jesper Louis Andersen
6354ea4f69 Improve the return values for keypairs.
To avoid the common mistake of re-arranging keypairs, provide them in a map which
forces the programmer to unpack the map in order to obtain the keys. This in turn makes
it harder to swap the PK/SK pair around and mistakenly giving out the secret key to the world.
2014-11-25 15:52:58 +01:00
Jesper Louis Andersen
f64e62d16e Provide correctness test cases for the verification codes. 2014-11-25 14:10:24 +01:00
Jesper Louis Andersen
d3471348e2 Introduce negative testing.
Negative testing means we inject faulty data into the test now and then. When this happens, we make sure the SUT will
return some kind of badarg error for bad arguments. This means we should make sure things actually work out as they should.

As a side-effect, this can also be used to test for memory leaks. If run for a while, it makes sure there are no leaks in the code base,
and it probably also makes sure there are no ways to crash the server by any means of use of these NIFs. As such, it looks like the
NIFs are fairly stable.
2014-11-22 23:26:45 +01:00
Jesper Louis Andersen
c08f83a755 Implement cryptography for secret boxes. 2014-11-21 17:42:32 +01:00
Jesper Louis Andersen
ff5196b99f Implement crypto boxing/unboxing for public key cryptographic systems. 2014-11-21 13:40:47 +01:00
Jesper Louis Andersen
9a7f4c8d4e Initial checkin. 2014-11-18 23:16:49 +01:00