Commit graph

1075 commits

Author SHA1 Message Date
Jaeden Amero fa66c9eba2 Merge remote-tracking branch 'upstream-public/pr/1629' into evaluation 2018-05-14 17:54:25 +01:00
Janos Follath c4e14e1ff5 CCM*: Add minimal test for fixed tag length 2018-05-14 14:32:41 +01:00
Jaeden Amero b1e4fc60ac Merge remote-tracking branch 'upstream-public/pr/1617' into evaluation-2 2018-05-11 11:07:30 +01:00
Jaeden Amero 7d8f00e1b5 Merge remote-tracking branch 'upstream-public/pr/1602' into evaluation-2 2018-05-11 10:56:21 +01:00
Jaeden Amero b7f36548df Merge remote-tracking branch 'upstream-public/pr/1593' into evaluation-2 2018-05-11 10:24:43 +01:00
Thomas Fossati eb01024a06 Add an HKDF (RFC 5869) implementation 2018-05-10 13:18:13 +01:00
Manuel Pégourié-Gonnard f66a4bd11d cipher: add stream test vectors for chacha20(poly1305) 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 619b3092c2 chachapoly: add test for state flow 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 7a2c7f1475 poly1305: add test with multiple small fragments
This exercises the code path where data is just appended to the waiting queue
while it isn't empty.
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 6dbfb69c12 chachapoly: add test for parameter validation
Also fix two bugs found by the new tests.

Also remove redundant test case dependency declarations while at it.
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 550c20fcf9 poly1305: add test for parameter validation
Also fix two validation bugs found while adding the tests.

Also handle test dependencies the right way while at it.
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 114f28b3d9 chacha20: add test for parameter validation 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard e9ea6d6e11 Fix selftest verbosity in test suites 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 996477d84b cipher: add chachapoly test vector + unauth case 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 97e34bf2f2 poly1305: fix bug in starts() and add test for it 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard b60045aacb chacha20: fix bug in starts() and add test for it
Previously the streaming API would fail when encrypting multiple messages with
the same key.
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 2faaa10e68 chachapoly: add test with unauthentic data 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard f11d8e5f4d Reduce size of buffers in test suites 2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 9b7a93cf1f poly1305: adjust parameter order
This module used (len, pointer) while (pointer, len) is more common in the
rest of the library, in particular it's what's used in the CMAC API that is
very comparable to Poly1305, so switch to (pointer, len) for consistency.
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard 52a56d3b86 chachapoly: split crypt_and_mac() to match GCM API
In addition to making the APIs of the various AEAD modules more consistent
with each other, it's useful to have an auth_decrypt() function so that we can
safely check the tag ourselves, as the user might otherwise do it in an
insecure way (or even forget to do it altogether).
2018-05-10 13:23:02 +02:00
Manuel Pégourié-Gonnard d4bd8569d4 Rename aead_chacha20_poly1305 to chachapoly
While the old name is explicit and aligned with the RFC, it's also very long,
so with the mbedtls_ prefix prepended we get a 31-char prefix to each
identifier, which quickly conflicts with our 80-column policy.

The new name is shorter, it's what a lot of people use when speaking about
that construction anyway, and hopefully should not introduce confusion at
it seems unlikely that variants other than 20/1305 be standardised in the
foreseeable future.
2018-05-10 13:23:02 +02:00
Daniel King 5b7f1d8035 Fix test suite when GCM Is disabled, but AEAD_ChaCha20_Poly1305 is enabled. 2018-05-10 13:21:40 +02:00
Daniel King 89c7b10c6a Add ChaCha20 test vectors from RFC 7539 2018-05-10 13:21:40 +02:00
Daniel King b437a98faf Add ChaCha20+Poly1305 to the Cipher module 2018-05-10 13:21:40 +02:00
Daniel King 31ac12e004 Implement AEAD-ChaCha20-Poly1305.
This implementation is based off the description in RFC 7539.

The ChaCha20 code is also updated to provide a means of generating
keystream blocks with arbitrary counter values. This is used to
generated the one-time Poly1305 key in the AEAD construction.
2018-05-10 13:20:52 +02:00
Daniel King 5d77eaa233 Add Poly1305 authenticator algorithm (RFC 7539)
Test vectors are included from RFC 7539.

Poly1305 is also added to the benchmark program.
2018-05-10 13:20:52 +02:00
Daniel King 0fe7b5b8c5 Add ChaCha20 to the Cipher module 2018-05-10 13:19:31 +02:00
Daniel King a98ff5eadf Initial implementation of ChaCha20 2018-05-10 13:19:31 +02:00
Jaeden Amero e4daf77c2e cipher: Add wrappers for AES-XTS
AES-XTS does not support multipart use as it can only operate on an entire
sector at a time.
2018-05-10 09:17:25 +01:00
Jaeden Amero 184d06942e tests: Add AES-XTS test suite
Add a test suite for AES-XTS, comprising checks for error reporting and
running the IEEE P1619/D16 test vectors.
2018-05-09 17:41:48 +01:00
Jaeden Amero 49411ccd0d tests: Fix name of 33 byte AES cipher tests
We named the tests "32 bytes", but actually tested with 33 bytes. Fix the
mistake.
2018-05-09 17:03:12 +01:00
Jaeden Amero 7d7bad6b1f Update version to 2.9.0
Bump SOVERSION for parity with 2.7.2 and 2.7.3.
2018-04-30 09:58:33 +01:00
Simon Butcher df67d3a575 Remove unused variable in AES OFB test suite
Remove iv_len, an unused variable, in AES OFB test suite function, to fix gcc
compiler warning.
2018-04-29 14:51:35 +01:00
Simon Butcher 7ac93f430c Fix AES-OFB support for errors, tests and self-test
Adds error handling into mbedtls_aes_crypt_ofb for AES errors, a self-test
for the OFB mode using NIST SP 800-38A test vectors and adds a check to
potential return errors in setting the AES encryption key in the OFB test
suite.
2018-04-29 11:40:01 +01:00
Simon Butcher 91e254cdaa Add cipher abstraction and test cases for OFB block mode
Adds OFB as additional block mode in the cipher abstraction, and additional
test cases for that block mode.
2018-04-29 11:40:01 +01:00
Simon Butcher a11c940b63 Add test cases for AES OFB block mode
Adds test cases from NIST SP800-38A for OFB block mode to AES-128/192/256, for
the configuration of MBEDTLS_CIPHER_MODE_OFB.
2018-04-29 11:36:38 +01:00
Jaeden Amero 38c42d5afa Merge remote-tracking branch 'upstream-public/pr/1570' into development-proposed
Resolve merge conflict in ChangeLog.
2018-04-25 14:20:08 +01:00
Andrzej Kurek f13ca9536c Test suites: print error on failed platform_setup
Return encountered errors instead of covering them
Fix return value on the broken snprintf implementation
2018-04-18 04:14:31 -04:00
Andrzej Kurek a282270a10 Add explicit checks for non-zero result of platform setup in test suites 2018-04-16 06:33:28 -04:00
Andrzej Kurek 32a675f032 Add conditional platform context creation & usage
Add another layer of abstraction before calling platform setup and teardown.
2018-04-13 06:16:04 -04:00
Andrzej Kurek 1152fa83f9 Add platform setup and teardown calls to test suites
Add a global platform context variable available for tests
2018-04-13 05:15:17 -04:00
Jethro Beekman 666892792d Generate primes according to FIPS 186-4
The specification requires that numbers are the raw entropy (except for odd/
even) and at least 2^(nbits-0.5). If not, new random bits need to be used for
the next number. Similarly, if the number is not prime new random bits need to
be used.
2018-04-11 08:38:37 -07:00
Gilles Peskine be2371c3d9 Merge branch 'pr_348' into development-proposed 2018-04-04 09:18:27 +02:00
Gilles Peskine 695d557dcf Merge branch 'pr_1180' into development-proposed 2018-04-01 12:26:36 +02:00
Nicholas Wilson 08f3ef1861 Basic support for Curve448, similar to the current level of support for Curve25519 2018-03-29 14:29:06 +01:00
Jaeden Amero 78a03ec230 Merge remote-tracking branch 'upstream-public/pr/1379' into development-proposed 2018-03-29 10:57:57 +01:00
Jaeden Amero 2843d21d99 Merge remote-tracking branch 'upstream-public/pr/1523' into development-proposed 2018-03-28 15:32:13 +01:00
Jethro Beekman 6c563fa7cd Add tests for "return plaintext data faster on unpadded decryption" 2018-03-27 19:25:35 -07:00
Andres Amaya Garcia 576d474704 Fix test dependencies of pkcs5 pbs2 on asn1 parse 2018-03-27 20:53:56 +01:00
Deomid Ryabkov de420a47b6 Fix some test deps
* Cert revocation tests require `MBEDTLS_HAVE_TIME_DATE`.
 * Verison features tests require... well, `MBEDTLS_VERSION_FEATURES`, actually.

Fixes https://github.com/ARMmbed/mbedtls/issues/1475
2018-03-27 14:39:26 +01:00