Skip to content

Commit

Permalink
Stop scrubbing @NoPresubmitTest annotation to make it easier to impor…
Browse files Browse the repository at this point in the history
…t external changes.

Also fixing a typo in Java transformation rules.

PiperOrigin-RevId: 199870545
GitOrigin-RevId: b2bf283c8f782205598503e14b0f13278ac0b4db
  • Loading branch information
thaidn authored and Tink Team committed Jun 27, 2018
1 parent b9b3b21 commit 2904be6
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 0 deletions.
8 changes: 8 additions & 0 deletions java/com/google/security/wycheproof/testcases/AesGcmTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ public void testByteBufferAlias() throws Exception {
}

/** Encryption and decryption with large arrays should be copy-safe. */
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/64378943"}
)
@Test
public void testLargeArrayAlias() throws Exception {
byte[] ptVector = new byte[8192];
Expand Down Expand Up @@ -484,6 +488,10 @@ public void testLargeArrayAlias() throws Exception {
*
* @see https://bugs.openjdk.java.net/browse/JDK-8181386
*/
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE, ProviderType.OPENJDK},
bugs = {"b/64378943"}
)
@Test
public void testByteBufferShiftedAlias() throws Exception {
byte[] ptVector = new byte[8192];
Expand Down
4 changes: 4 additions & 0 deletions java/com/google/security/wycheproof/testcases/DhTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ public void testKeyPairGenerator() throws Exception {
* https://docs.oracle.com/javase/7/docs/api/java/security/KeyPairGenerator.html an implementation
* of the Java platform is only required to support 1024 bit keys.
*/
@NoPresubmitTest(
providers = {ProviderType.OPENJDK, ProviderType.BOUNCY_CASTLE},
bugs = {"b/33190860", "b/33190677"}
)
@SlowTest(providers = {ProviderType.BOUNCY_CASTLE, ProviderType.SPONGY_CASTLE})
@Test
public void testDefaultKeyPairGenerator() throws Exception {
Expand Down
9 changes: 9 additions & 0 deletions java/com/google/security/wycheproof/testcases/DhiesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,19 @@ public void testSemanticSecurityDhies() throws Exception {
* <li>CVE-2016-1000344 BouncyCaslte before v.1.56 used ECB mode as a default.
* </ul>
*/
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/31101111: won't fix, all BC DHIES modes are banned"}
)
@Test
public void testSemanticSecurityDhiesWithAes() throws Exception {
testNotEcb("DHIESWithAES");
}

@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/31101111: won't fix, all BC DHIES modes are banned"}
)
@Test
public void testSemanticSecurityDhiesWithDesede() throws Exception {
testNotEcb("DHIESWITHDESEDE");
Expand Down
4 changes: 4 additions & 0 deletions java/com/google/security/wycheproof/testcases/DsaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,10 @@ public void testKeyGenerationAll() throws Exception {
* https://docs.oracle.com/javase/7/docs/api/java/security/KeyPairGenerator.html only requires
* that 1024 bits are supported.
*/
@NoPresubmitTest(
providers = {ProviderType.OPENJDK, ProviderType.BOUNCY_CASTLE},
bugs = {"b/33190860", "b/33190677"}
)
@Test
public void testDefaultKeySize() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DSA");
Expand Down
10 changes: 10 additions & 0 deletions java/com/google/security/wycheproof/testcases/EcdhTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1888,6 +1888,11 @@ public void testVectors() throws Exception {
}
}
}

@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"BouncyCastle uses long encoding. Is this a bug?"}
)
@Test
public void testEncode() throws Exception {
KeyFactory kf = KeyFactory.getInstance("EC");
Expand Down Expand Up @@ -2209,6 +2214,11 @@ public void testLargePrivateKey() throws Exception {
// testLargePrivateKey(EcUtil.getNistP521Params());
testLargePrivateKey(EcUtil.getBrainpoolP256r1Params());
}

@NoPresubmitTest(
providers = {ProviderType.OPENJDK},
bugs = {"CVE-2017-10176"}
)
@Test
public void testLargePrivateKeyNoPresubmit() throws Exception {
testLargePrivateKey(EcUtil.getNistP521Params());
Expand Down
21 changes: 21 additions & 0 deletions java/com/google/security/wycheproof/testcases/EciesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ public void testExceptions(String algorithm) throws Exception {
public void testEciesCorruptDefault() throws Exception {
testExceptions("ECIES");
}

@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/30424901: won't fix, all BC ECIES modes are banned"}
)
@Test
public void testEciesCorruptAesCbc() throws Exception {
testExceptions("ECIESWithAES-CBC");
Expand Down Expand Up @@ -283,11 +288,19 @@ public void testDefaultEcies() throws Exception {
}

/** BouncyCastle v1.52 uses ECB as default for ECIES with AES. */
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/30424901: won't fix, all BC ECIES modes are banned"}
)
@Test
public void testDefaultEciesWithAes() throws Exception {
testNotEcb("ECIESWithAES");
}
/** BouncyCastle v1.52 uses ECB as default for ECIES with DESede. */
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/30424901: won't fix, all BC ECIES modes are banned"}
)
@Test
public void testDefaultEciesWithDESede() throws Exception {
testNotEcb("ECIESwithDESede");
Expand Down Expand Up @@ -341,6 +354,10 @@ public void testAlias() throws Exception {
* Encryption with ByteBuffers. This currently fails with BouncyCastle. Possibly this is the same
* bug as http://www.bouncycastle.org/jira/browse/BJA-577 and should be fixed in version 1.53.
*/
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/30424901: won't fix, all BC ECIES modes are banned"}
)
@Test
public void testByteBuffer() throws Exception {
ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256r1");
Expand Down Expand Up @@ -375,6 +392,10 @@ public void testByteBuffer() throws Exception {
*
* <p>This test tries to verify this.
*/
@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/30424901: won't fix, all BC ECIES modes are banned"}
)
@Test
public void testByteBufferAlias() throws Exception {
byte[] message = "Hello".getBytes("UTF-8");
Expand Down
10 changes: 10 additions & 0 deletions java/com/google/security/wycheproof/testcases/JsonKeyWrapTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,20 @@ public void testKeywrap(String filename, String algorithm, String wrappedAlgorit
assertEquals(1, exceptions.size());
}
}

@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/77572633"}
)
@Test
public void testAesWrap() throws Exception {
testKeywrap("kw_test.json", "AESWRAP", "HMACSHA256", false);
}

@NoPresubmitTest(
providers = {ProviderType.BOUNCY_CASTLE},
bugs = {"b/77572633"}
)
@Test
public void testAesRFC5649Wrap() throws Exception {
testKeywrap("kwp_test.json", "AESRFC5649WRAP", "HMACSHA256", false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ public void testRsaSignatures() throws Exception {
}

// Testing DSA signatures.
@NoPresubmitTest(
providers = {ProviderType.OPENJDK},
bugs = {"b/33446454"}
)
@ExcludedTest(
providers = {ProviderType.CONSCRYPT},
comment = "Conscrypt does not support DSA.")
Expand Down
8 changes: 8 additions & 0 deletions java/com/google/security/wycheproof/testcases/RsaKeyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,10 @@ private void checkKeyPair(KeyPair keypair, int keySizeInBits) throws Exception {
* implementation of the Java platform is required to implement RSA with both 1024 and 2048 bit
* key sizes. Hence a 2048 bit default should not lead to compatibility problems.
*/
@NoPresubmitTest(
providers = {ProviderType.OPENJDK},
bugs = {"b/33190530"}
)
@Test
public void testDefaultKeySize() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA");
Expand Down Expand Up @@ -1640,6 +1644,10 @@ public void testEncodeDecodePublic() throws Exception {
};

// TODO(bleichen): This test is only needed as long as there are open issues.
@NoPresubmitTest(
providers = {ProviderType.OPENJDK},
bugs = {"b/32656910"}
)
@Test
public void testProblematicPublicKeyDecoding() throws Exception {
KeyFactory kf = KeyFactory.getInstance("RSA");
Expand Down

0 comments on commit 2904be6

Please sign in to comment.