7 Commits

Author SHA1 Message Date
Wycheproof Team 91ee28e1c4 third_party/wycheproof: add a missing sLen value to rsassa_pss_verify_schema.json
NOKEYCHECK=True
PiperOrigin-RevId: 282561885
GitOrigin-RevId: 38893647f278ff09f4c47a729168bfdfe442a80e
2019-12-06 17:03:48 -08:00
bleichen a8b9d3d935 Adding test vectors and tests for DSA with P1363 encoding.
Splitting DSA test vectors into several files depending on key size and hash.

I'm only adding files for DSA parameters that are supported by libraries that are used in google3. Most projects now prefer ECDSA.
Tests with additional parameters (e.g. 4096-bit keys or other hash functions) can be added, if there is a reason for doing so.

Tested providers:
  jdk8 supports DSA with ASN encoding.
  jdk11 supports DSA with ASN and P1363 encoding.
  BouncyCastle only supports DSA with ASN encoding.
    (P1363 format is only supported for ECDSA).
  ConsCrypt does not support DSA at all.

b/33446454: The tests ignore this issue to avoid missing bigger mistakes.

NOKEYCHECK=True
PiperOrigin-RevId: 281068296
GitOrigin-RevId: 7c4178527d940fccbcfcfdd88f1cb850a17746db
2019-11-25 17:45:33 -08:00
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 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 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
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 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