Commit Graph

110 Commits

Author SHA1 Message Date
bleichen 68482d5d8d Moving test vectors for primality test into a JSON file.
Adding more tests:
- the previous test did not include any primes. Hence arithmetic
  errors in a primality test would likely remain undetected.
- some primes have been generated so that the multiplier for a
  Montgomery reduction is an edge case (e.g. high or low Hamming weight).
- adding negatives of primes. Different libraries disagree, whether such
  integers are prime or not. The corresponding test vectors have a flag
  and result "acceptable".

The following libraries have been tested:

java.math.BigInteger: primality testing is not part of JCA and hence is
    provider independent.
sympy: Old versions of sympy used a weak set of bases and was deterministic.
    This is no longer the case.
NOKEYCHECK=True
PiperOrigin-RevId: 278337837
GitOrigin-RevId: 02debe45343e8da38b21a6e7a56a4a2b1c050bd8
2019-11-25 17:44:27 -08:00
bleichen f63678bb71 Including some of the tink failures for EDDSA.
The full list of failures is longer (~2800 cases).
They should be tested separately.

NOKEYCHECK=True
PiperOrigin-RevId: 276078119
GitOrigin-RevId: 06cbec6bed9413992b14a766134cbfc9bd826259
2019-11-25 17:44:19 -08:00
bleichen a5b8266776 New versions for HKDF.
E.g., since HMAC simply pads the key with 0s, it does not matter
whether the salt is a empty byte array or any other array of size <= 64.

NOKEYCHECK=True
PiperOrigin-RevId: 275468663
GitOrigin-RevId: 9982a2f0675aee0035a78ea1889d2b23b9ede597
2019-11-25 17:44:11 -08:00
bleichen 04b8adc7ba Adding test vectors RSA primitives with truncated hashes:
SHA-512/224 and SHA-512/256.

I don't expect these hashes to be heavily used. But there is
some potential for incompatibilities. E.g. BouncyCastle
previously used algorithm names such as "SHA512(224)WITHRSA"
while jdk uses "SHA512/224WithRSA".

RSA-OAEP would in principle allow the same hashes as RSA-PSS,
but the algorithm name in JCA is not well-defined,
using truncated hashes with OAEP doesn't make much sense,
and providers don't seem to implement it.

Test results:
jdk11 supports the truncated signatures.
BouncyCastle does not support the algorithm names
ConsCrypt does not support the algorithms.

Tested in a different CL:
boringSSL does not implement the algorithms.

Bugs: b/120406853 is about an alternative ASN encoding
of PSS-keys. This is an encoding that contains all the
parameters of signature scheme. This will be added by
jdk11. But so far, jdk11 fails to read its own key encodings.
I have test vectors for this encoding, but can't add them
without having at least one library accepting them.
NOKEYCHECK=True
PiperOrigin-RevId: 275018282
GitOrigin-RevId: 42c8b6d8e768858b6ec5a273d53f1e111268ecd7
2019-11-25 17:44:03 -08:00
bleichen e50b5bf1dd Adding truncated hashes.
NOKEYCHECK=True
PiperOrigin-RevId: 274586173
GitOrigin-RevId: 8fe2fc1e432ee4c5b6835335c25d421acaa9ff67
2019-11-25 17:43:55 -08:00
bleichen 65e05340c6 Adding tests for ECDSA with SHA-3.
BouncyCastle: supports SHA-3 an passes the tests.
jdk8: does not support SHA-3 (and hence also not ECDSA signatures with SHA-3)
jdk11: supports SHA-3, but currently does not support ECDSA with SHA-3.
ConsCrypt: does not support ECDSA with SHA-3 at this time.

Tested elsewhere:
hazmat: does not support SHA-3 (since it is using boringssl)
NOKEYCHECK=True
PiperOrigin-RevId: 273530767
GitOrigin-RevId: 0f6daacc167dd8944e9f4ce549899d9b08b3ce00
2019-11-25 17:43:47 -08:00
bleichen 3373b63f27 Updating documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 271746606
GitOrigin-RevId: b87303d019b6453402a8a1babf99539bb867d6ad
2019-11-25 17:43:40 -08:00
bleichen 7172b0fce8 Adding RSA signatures with SHA-3.
Test results:
BouncyCastle: the tests pass
jdk8: fails since the algorithms are not supported
jdk11: Supports SHA3, but does not support SHA3-xxxWithRSA.
ConsCrypt: does not support SHA3.

In a different CL, I also tried the following:
OpenSSL/BoringSSL can't verify the signatures, since functions such as EVP_sha3_256()
are not supported.
hazmat: can't verify the signatures since the backend does not support SHA3.

References used:

https://docs.oracle.com/en/java/javase/11/docs/specs/security/standard-names.html
Defines the algorithm names in jdk for RSA PKCS #1 signatures.

https://csrc.nist.gov/projects/computer-security-objects-register/algorithm-registration#Hash
Defines the OIDs for the hash functions.

https://csrc.nist.rip/groups/ST/crypto_apps_infra/csor/algorithms.html
Defines the OIDs for the Signature algorithms.

NOKEYCHECK=True
PiperOrigin-RevId: 271367540
GitOrigin-RevId: fde524837d16b118a8e18fd15e39dd7ed26e7b46
2019-11-25 17:43:32 -08:00
bleichen 0d659a5d4f Adding PEM encoded test vectors for XDH.
The test vectors allow to check libraries that read PEM
files against bugs similar to:
https://bugs.openjdk.java.net/browse/JDK-8213363

Testing:
So far I'm testing against hazmat (i.e. a python wrapper
around openssl).
The version in google3
google3/third_party/py/cryptography/hazmat/
only supports x25519, hence the x448 test vectors are not tested.
The test vectors are essentially the same as in x448_asn_test.json,
which pass BouncyCastle (with some fixes for overflow).
NOKEYCHECK=True
PiperOrigin-RevId: 269317802
GitOrigin-RevId: f29c60bccd75d3a9a16f833e108bdf83e385fc87
2019-11-25 17:43:24 -08:00
bleichen e4219aa4c8 Updating documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 267625688
GitOrigin-RevId: 4df73e541c5ef5164fe76a6aa985c095c5ff88fb
2019-11-25 17:43:16 -08:00
bleichen c2f1a59591 Adding difference between NIST standard and RFC for KeyWrap.
NOKEYCHECK=True
PiperOrigin-RevId: 265045010
GitOrigin-RevId: e6a7420bac93cc3e0e610f8f511a3c5f36309f7f
2019-11-25 17:43:09 -08:00
bleichen 4672ff74d6 New version of the test vectors.
Main changes:
BigInteger encoding is now always a multiple of 2.
Comments try to be a bit more precise. This leads to a different
grouping of the test vectors.
All test vectors with result="acceptable" have at least one
flag.

New vectors:
AEGIS: adding test vectors with the same tag (basically just
answers the question: is AEGIS a hash?)
Test vectors from old versions of the cipher now have ciphertext.
I.e. both encrypting or decrypting should tell testers that they
are using old versions.
AES-CMAC: more test vectors with 128-bit tag.
DSA, ECDSA: better description of the ASN modifications (this reorders
  the test vectors) and a few more ASN modifications
KWP: adding modified paddings
XDH: adding more edge cases, no longer using the same private key for multiple
  test vectors.
RSA-PSS: adding more valid test vectors. The new test vectors have an edge case
  message digest.
NOKEYCHECK=True
PiperOrigin-RevId: 264817632
GitOrigin-RevId: 0c8e6eec11db1ca7088f89d0c1de48c5af892e47
2019-11-25 17:42:59 -08:00
bleichen 06b80c9dcd Adding test vectors and tests for the bug fix in CL 264115794.
BouncyCastle had an implementation for X25519 and X448 for some time.
But the JCA interface has been added only recently in version 1.61.
There is an overflow bug in this version that will be fixed
upstream in verion 1.63.
The tests ignore some minor bugs (Runtime exceptions instead of
checked exceptions) so that the test against BouncyCastle can be
added as a presubmit test.

Changing the ASN encoding of XDH keys.
Previously they used the jdk encoding.
This encoding was wrong.

NOKEYCHECK=True
PiperOrigin-RevId: 264348566
GitOrigin-RevId: 6564f188a3ed50f73c48cb8c41833d8c3798ab78
2019-11-25 17:42:50 -08:00
Wycheproof Team 2f40e86f93 LSC: Delete uses of goog.isDefAndNotNull, goog.isDef, goog.isNull, goog.isString, goog.isBoolean, and goog.isNumber.
These functions are all trivial one-liners that inline to clearer code that is nearly as small (and in some cases even smaller) than the function call.

See go/lsc-goog-isdef

Tested:
    TAP --sample ran all affected tests and none failed
    http://test/OCL:263067138:BASE:263057012:1565671265213:a988ea45
NOKEYCHECK=True
PiperOrigin-RevId: 263257614
GitOrigin-RevId: b9879442a887349646d064825c5c86ce904ab6f9
2019-11-25 17:42:42 -08:00
bleichen 3bab7ff533 Adding tests for EDDSA to Wycheproof.
jdk11 did add ED25519 and ED448.
BC supports ED25519, but is slightly malleable.
Conscrypt supports none (rsp. uses different algorithm names).

This is related to
https://github.com/google/tink/issues/224

However, tests for signatures are still missing.

NOKEYCHECK=True
PiperOrigin-RevId: 260726100
GitOrigin-RevId: c4c5855aa3e86c0e47ad88f16e6496b98149364f
2019-11-25 17:42:34 -08:00
bleichen 2927eee6ed Adding a new test vector.
https://github.com/google/tink/issues/224
So far I haven't been able to reproduce the bug.
However, a lot of tests just check the signature verification.

NOKEYCHECK=True
PiperOrigin-RevId: 260466789
GitOrigin-RevId: bc252d53eaede4ec4eb89fef072dc5d19d17dbf5
2019-11-25 17:42:27 -08:00
bleichen 90b33e27b2 Updating documentation:
New algorithms are GMAC and VMAC.

NOKEYCHECK=True
PiperOrigin-RevId: 257602522
GitOrigin-RevId: d5c7564b2fc364a38f05fef328308f21af7334f7
2019-11-25 17:42:19 -08:00
bleichen 0941e7b012 Adding test vectors for AES-GMAC to Wycheproof.
AES-GMAC is equivalent to encrypting with AES-GCM an empty plaintext, using passing the
data to authenticate as additional data.

AES-GMAC is supported by keymaster and BouncyCastle.
keymaster has fixed nonce sizes and tag sizes (128-bits).
BouncyCastle has a fixed tag size (128-bit) when used through the JCE
interface.

NOKEYCHECK=True
PiperOrigin-RevId: 257385648
GitOrigin-RevId: d6947fd3604ca782078b7a02bab2a95160df2501
2019-11-25 17:42:11 -08:00
bleichen e9f9b7b234 Adding test vectors for VMAC.
The main purpose is to test / explore the robustness of the VMAC implementation
such as the one in security/util (e.g. CL 254384251) as well as finding potential weaknesses if VMAC is used in an unconventional way. VMAC is widely used in
Google, but so far there is no list of test vector that check corner cases,
such as carry propagation.

VMAC has a number of odd features, which are tested with these vectors:
- The nonce is at most 127-bit long. This is necessary, because VMAC uses
  an AES-block cipher. Inputs with the most significant bit set are used
  for the key derivation. The same inputs must not be used for encrypting
  the nonce.
- VMAC requires 128-bit integer arithmetic for some of its temporary results.
  This leaves a lot of opportunities for overflow and carry errors.
  The test vectors contain a fairly large number of edge cases to check
  for such problems.
- VMAC lacks "plaintext awareness". A valid VMAC does not prove that the
  sender knows the plaintext. An example is this: if the VMAC is computed
  over eg.  tag = VMAC(msg || password) then it would be possible for the
  sender to choose msg, such that is valid for any password.

NOKEYCHECK=True
PiperOrigin-RevId: 255599337
GitOrigin-RevId: 22d336b66c370dae251f1fa119cf952035f9c8d5
2019-11-25 17:42:03 -08:00
Wycheproof Team 098eeb5616 Wycheproof g3doc: Fix typo and add link to GitHub source-code
NOKEYCHECK=True
PiperOrigin-RevId: 253518500
GitOrigin-RevId: 4b56508500c5d535c5a033b3d40ef3098cb61b79
2019-11-25 17:41:55 -08:00
bleichen df9b1f3811 Adding test vectors for AEGIS256 to wycheproof.
AEGIS256 is described here:
https://eprint.iacr.org/2013/695.pdf
https://competitions.cr.yp.to/round3/aegisv11.pdf

Test vector generation:
I'm using a python version for the generation of the test vectors:
CL 252436459
The test vectors are then compared against a second implementation:
CL 252613429

Third party test vectors:
I don't have any third party test vectors.
https://eprint.iacr.org/2013/695.pdf contains some test vectors.
But, these test vectors can only be reproduced if the number of rounds
in finalize is reduced from 7 to 6.
Both papers describe AEGIS256 with 7 rounds in finalize.
All third party implementations I've found use 7 rounds, such as
this one:

https://github.com/torvalds/linux/blob/master/crypto/aegis256.c

NOKEYCHECK=True
PiperOrigin-RevId: 252811267
GitOrigin-RevId: 1de1fb2cb2c4e7d33a1ab8a23ddd63c79b143d3a
2019-11-25 17:41:47 -08:00
bleichen cf457615e3 Updating documentation.
* including new primitives
* more detailed description of JSON types.
* adding links for algorithms

NOKEYCHECK=True
PiperOrigin-RevId: 252799091
GitOrigin-RevId: ebf54ad59ebc55f4cbee010d67867ee9a95ce987
2019-11-25 17:41:39 -08:00
bleichen 763b2b03ea Adding test vectors for Aegis128 and Aegis128L to third_party/wycheproof.
Versions:
Aegis128 and Aegis128L use
https://competitions.cr.yp.to/round3/aegisv11.pdf
The eprint version of Aegis128L in
https://eprint.iacr.org/2013/695.pdf
is slightly different, since the tag is computed differently.
To make this difference easier to spot, I'm including
the test vectors from the eprint version (the result is
of course invalid).

Generation:
The test vectors were generated with a 2nd implementation
(in python). This would hopefully allow to spot boundary
errors.
NOKEYCHECK=True
PiperOrigin-RevId: 251426918
GitOrigin-RevId: 3fc993aa9e84495cefd1f20bcc5a0fb3a3179883
2019-11-25 17:41:31 -08:00
bleichen 29ccd8ecac Updating Wycheproof documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 247415707
GitOrigin-RevId: 8efba735f6dd1f735aa1ee0a963453e2801bf3fb
2019-11-25 17:41:22 -08:00
bleichen 8bc50bbb51 Updating the test vectors.
Changes:
* Unused flags are no longer listed in "notes:"
* Added some new invalid encoding containing special values such as NaN.
* Adding jwk keys to RSA-OAEP test vectors if the jwk key is defined.
* Adding a flag InvalidOaepPadding to RSA-OAEP test vectors to test vectors
  where leaking padding information might allow Manger's attack.
* Adding test vectors for invalid padding: PKCS-1 padding for PSS signatures
  signatures without hashing.
* Adding test vectors from RFC 8037 to XDH. (There is not enough cross checking
  otherwise, since most libraries don't implement XDH).

NOKEYCHECK=True
PiperOrigin-RevId: 237066566
GitOrigin-RevId: 44dd5c1fda5d152b6741824ad9d5400b4cffd6aa
2019-11-25 17:41:11 -08:00
bleichen e36f091b42 Making another doc file more? compatible.
NOKEYCHECK=True
PiperOrigin-RevId: 236832376
GitOrigin-RevId: 0548eea608460e635a820293a6d2100944addb12
2019-11-25 17:41:03 -08:00
bleichen 6e734f1166 Reverting some mdformat features off
to avoid making tables incompatible with other
markdown dialects.

NOKEYCHECK=True
PiperOrigin-RevId: 236831405
GitOrigin-RevId: 25641287cde9b5ba7b631d5d4b6c26c226c3cc18
2019-11-25 17:40:55 -08:00
bleichen 3255146de3 Adding test vectors for RSA PKCS #1 v 1.5.
The test vectors replace the previous test for padding oracles, which
had to generate a new key. The test vectors add some new
test cases that are edge cases for the modular exponentiation.

NOKEYCHECK=True
PiperOrigin-RevId: 236813461
GitOrigin-RevId: a92ab2a6af48d3285735fbf5c8ecb66c0750f46b
2019-11-25 17:40:47 -08:00
bleichen 4cd199592b Minor updates to documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 234783631
GitOrigin-RevId: da809b7f5aecc3bf184fdfe1788399cd8316c329
2019-11-25 17:40:39 -08:00
bleichen bfb11c57f3 Updating documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 234606518
GitOrigin-RevId: 1afaee2eaa4c9a9daad23f57569e035facbb8243
2019-11-25 17:40:32 -08:00
bleichen e2178c755a Adding tests for RSA key generation to the plans for version 0.8.
NOKEYCHECK=True
PiperOrigin-RevId: 234466663
GitOrigin-RevId: 89986698fa5eee07927d34d651479007d173923f
2019-11-25 17:40:24 -08:00
bleichen 386767b289 Adding more links to type names.
NOKEYCHECK=True
PiperOrigin-RevId: 233588531
GitOrigin-RevId: eb79f2b0c494cc9b993f7391494074bd98e442d7
2019-11-25 17:40:16 -08:00
bleichen 441894f256 Updating documentation
NOKEYCHECK=True
PiperOrigin-RevId: 233075077
GitOrigin-RevId: 59df0b095f9640e9f1e9f0a31e699c8396b189e7
2019-11-25 17:40:08 -08:00
bleichen 851de3dd9c Adding more links to the documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 233071591
GitOrigin-RevId: 4a3c72335c61b0d5b2e3715b139bfb62de4f0eb1
2019-11-25 17:40:01 -08:00
bleichen cb98c9f432 Adding references to types in the documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 233065086
GitOrigin-RevId: a4af2453b9798b7e14bd14c2b4c5e07a1e9d72d0
2019-11-25 17:39:53 -08:00
bleichen 7ca8c8d16f Updating files.md
NOKEYCHECK=True
PiperOrigin-RevId: 233042755
GitOrigin-RevId: 3bd24145ecdd0f6c9d4a6e7716ca188d1fa0dd19
2019-11-25 17:39:45 -08:00
bleichen 2cf601145e Adding some forgotten cases:
Adding test vectors for AES-SIV-CMAC for AEAD.
I.e. these are test vectors for AES-SIV-CMAC where encryption takes
two AAD arguments: one argument acting as the nonce and one argument
acting as the additional data.

Adding test vectors for XDH where the keys use jwk encoding.
These are mostly the same test vectors as used for other XDH tests,
but the keys are enocded according to RFC 8037.
The test vectors include two test vectors from RFC 8037 section A.6 and
A.7 to ensure that the same encoding is used.

Fixing the algorithm name for AES-GCM-SIV.

NOKEYCHECK=True
PiperOrigin-RevId: 232840812
GitOrigin-RevId: cc0604472074630f0b00894c4234e06ac0bc4f0a
2019-11-25 17:39:37 -08:00
bleichen 89b996d789 Some updates to the documentation.
NOKEYCHECK=True
PiperOrigin-RevId: 232680784
GitOrigin-RevId: b94a428ffce59724af70395a8f859d9f02841f6b
2019-11-25 17:39:30 -08:00
bleichen 35fe41359d Updating tests for DSA, ECDSA and RSA-OAEP.
Extending the tests for signature bias.
E.g. biased signature generations that
choose s' as min(s, q-s) because of
signature malleability will not be detected.
Such implementations exist:
https://eprint.iacr.org/2019/023.pdf

Removing test vectors in the tests.
These test vectors are no longer necessary, since there
are more test vectors in the JSON files. Additionally,
the test vectors here are old and have not been updated.

Replacing comparisons for test vector version with comparisons
for the JSON schema. A new schema (with a different name) will
be used whenever the format of the test vectors changes without
backwards compatibility. Hence the JSON schema should change less
frequently than the version and give a better indication whether
test vectors and test match.

Reducing the log size a bit.

Bugs:

b/33190860: default key size for DSA is now 2048. This has been
fixed by Oracle.

NOKEYCHECK=True
PiperOrigin-RevId: 232647129
GitOrigin-RevId: 76f43890f0115a2ff72c6078a3376a96882a1504
2019-11-25 17:39:22 -08:00
bleichen 2d2290c28e Updating ECDH test vectors:
Changing incorrect documentation in the header:
The public keys are X509 encoded. Private keys are just integers.

Adding some more edge cases:
These are mostly cases where the y coordinate is a special case.
Such special cases can lead to overflows if the point is normalized
during the ECDH compuation. A normalization is sometimes done in
precomputations.

Somewhat better comments: I.e. explain what the edge case is.

Removing unnecessary notes: Sometimes test vectors with labels are generated,
but not used because encoding can't handle the test vectors. Previously the
label would still end up in the notes section. This has been removed.

NOKEYCHECK=True
PiperOrigin-RevId: 232640195
GitOrigin-RevId: b2bae8ea496a482297ea92f125d7762990015a33
2019-11-25 17:39:14 -08:00
bleichen 8ca57ca2b9 Just adding a reference.
There might be some test cases not covered yet. That will be done
later.

NOKEYCHECK=True
PiperOrigin-RevId: 232472199
GitOrigin-RevId: 8821bbd10f7917f161b83e26edc19a213d67c8c0
2019-11-25 17:39:06 -08:00
bleichen 1ab23e11b0 Refactoring the documentation.
index.md is now an index.

NOKEYCHECK=True
PiperOrigin-RevId: 232468414
GitOrigin-RevId: 7dde78d93627c14c213ce5c5d8f62429cd9e4a64
2019-11-25 17:38:58 -08:00
bleichen 0fef006165 Refactoring ECDH tests:
Switching to test vector files that contain vectors for one curve only.
This covers more test cases, allows to skip test vectors for curves not
supported by a library.
ecdh_test.json contains tests for multiple curves, but is somewhat limited
in coverage.

Sanity checks for using expected files are now based on the JSON schema.
I.e. if the expected and actual JSON schema of the test vector file match,
then the test should pass, otherwise there is a problem with the test setup.

Removing tests covered by test vectors from EcdhTest.java.

Adding timing test for ECDH:
The tests require to run on a system without much noise:
E.g. running a regular unit test is too noisy.
The confidence level is too low to fail the test:
ECDH timing test:secp256r1
Timing for point 0 avg: 4062844.9155273438 std dev: 452064.39579909603 cv:0.11126794283271814
Timing for point 1 avg: 4077776.20703125 std dev: 457662.5685428607 cv:0.1122333706675025
Point 0 multiplication is faster: 1152

Running the same test locally adds less noise.
The ratio avg / std dev is 10 times smaller.
Here the test run shows that time of a point multiplication depends on the
point that is multiplied.

ECDH timing test:secp256r1
Timing for point 0 avg: 1611269.970703125 std dev: 30329.312528547747 cv:0.018823234516877802
Timing for point 1 avg: 1618931.3715820312 std dev: 29267.753517245954 cv:0.01807843990857086
Point 0 multiplication is faster: 1655

NOKEYCHECK=True
PiperOrigin-RevId: 232286329
GitOrigin-RevId: 1bbbd6422c8fd64f3d5ea2fc3ecb94c6bd7bc171
2019-11-25 17:38:50 -08:00
bleichen 30c04bdbda Refactoring ecdh.md.
Adding some references to dh.md and dsa.md
Adding a bibliography.
There does not seem to be any simple support for references in g3doc.

NOKEYCHECK=True
PiperOrigin-RevId: 231400389
GitOrigin-RevId: db928a9f57d11ee736348c468412a320e03698d4
2019-11-25 17:38:43 -08:00
bleichen 1025b43dd7 Adding timing analysis to the plans for version 0.8.
NOKEYCHECK=True
PiperOrigin-RevId: 231194032
GitOrigin-RevId: bbe9af9542f60547f7ebbfeb4efe879327e06f50
2019-11-25 17:38:35 -08:00
Wycheproof Team ec8cac4845 Fix wycheproof build.
* migrate from deprecated http_archive/new_http_archive rules
 * update io_bazel_closure_rules dependency to fix recent bazel version compatibility issues

NOKEYCHECK=True
PiperOrigin-RevId: 229606647
GitOrigin-RevId: 75f81fae2fa095ce04cad88610f77c7ba1706d6e
2019-11-25 17:38:27 -08:00
bleichen 8d36c35a19 Adding documentation for the test vector files.
NOKEYCHECK=True
PiperOrigin-RevId: 228866607
GitOrigin-RevId: a04fbc5b6604b399e1943a04713cc19e909f9905
2019-11-25 17:38:20 -08:00
bleichen 18175b38da Adding JSON schemas for the test vectors.
Requires test vectors with version 0.7 or higher.

NOKEYCHECK=True
PiperOrigin-RevId: 228853889
GitOrigin-RevId: d669cb263964511c7c95cb32f83e1f07f4bf6b51
2019-11-25 17:38:12 -08:00
bleichen 7c9c6db85c Test vectors version 0.7
There are format changes:
* All test vector files contain a new field schema,
  which points to a JSON schema definition
  in the directory wycheproof/schema.
* More consistent type definition:
  E.g. the field "type" in a testGroup is now describing the
  type of the test the vectors are intended for. The type of
  the test defines formatting (e.g. whether signatures use
  P1363 encoding or ASN encoding) and the tested operation
  (e.g. whether the test vectors signatures are primarily
  are meant for verification or signature generation)
  The test types will also be included in the documentation.
* More unified test vectors:
  RSA-PKCS#1 v1.5 signature no longer have a field "padding".
* Added public and private keys in jwk format.
  This is done when the jwk format is defined and
  where the key format is not part of the test.

Additional test vectors:
* Added vectors for edge cases that can occur
  in ECDH computations with projective or Jacobian
  coordinates. In particular this implements a detection for the
  attack in "Zero-Value Point Attacks on Elliptic Curve Cryptosystem"
  by T.Akishita and T Takagi, ISC 2003
* Added more edge cases for Xdh.
* Added more test cases for ASN parsing (e.g. high number tags)
* Added test vectors for CVE-2017-18330 to CCM and EAX.
* Added more edge cases for poly1305
* Added test vectors for HKDF.
* Removed some duplicates in the test vectors.

NOKEYCHECK=True
PiperOrigin-RevId: 228700977
GitOrigin-RevId: 5708361fc71a2089a5c102be7d73adbc3b3b8efd
2019-11-25 17:37:59 -08:00
bleichen 37bb634f23 Adding new test vector files:
ed448_test.json
Test vectors for EDDSA over the curve edwards448

xchacha20_poly1305_test.json
Test vectors for Xchacha20 with poly1305 as defined in
https://datatracker.ietf.org/doc/draft-arciszewski-xchacha

NOKEYCHECK=True
PiperOrigin-RevId: 224343437
GitOrigin-RevId: 0b9a4eb9074b6ea1f76d0ff435dac215323024a1
2019-11-25 17:37:50 -08:00