Skip to content

Commit

Permalink
Suppress more warnings, sighed (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
thaidn authored Feb 2, 2017
1 parent 9130b76 commit 06d73e0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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 @@ -192,6 +192,7 @@ public DHParameterSpec openJdk1024() {
}

/** Check that key agreement using DH works. */
@SuppressWarnings("InsecureCryptoUsage")
public void testDh() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
DHParameterSpec dhparams = ike2048();
Expand Down Expand Up @@ -320,6 +321,7 @@ public void testKeyPair(KeyPair keyPair, int expectedKeySize) throws Exception {
* <p> This is a slow test since some providers (e.g. BouncyCastle) generate new safe primes
* for each new key.
*/
@SuppressWarnings("InsecureCryptoUsage")
public void testKeyPairGenerator() throws Exception {
int keySize = 1024;
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
Expand All @@ -329,6 +331,7 @@ public void testKeyPairGenerator() throws Exception {
}

/** This test tries a key agreement with keys using distinct parameters. */
@SuppressWarnings("InsecureCryptoUsage")
public void testDHDistinctParameters() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
keyGen.initialize(ike1536());
Expand Down Expand Up @@ -361,6 +364,7 @@ public void testDHDistinctParameters() throws Exception {
*
* <p> CVE-2016-1000346: BouncyCastle before v.1.56 did not validate the other parties public key.
*/
@SuppressWarnings("InsecureCryptoUsage")
public void testSubgroupConfinement() throws Exception {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("DH");
DHParameterSpec params = ike2048();
Expand Down
8 changes: 7 additions & 1 deletion java/com/google/security/wycheproof/testcases/DsaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,8 @@ public class DsaTest extends TestCase {
+ "22e342be484c05763939601cd667",
"300a090380fe01090380fe01",
};


@SuppressWarnings("InsecureCryptoUsage")
public void testVectors(
String[] signatures,
DSAPublicKeySpec key,
Expand Down Expand Up @@ -790,6 +791,7 @@ public void testOutdatedProvider() throws Exception {
* when an implementation is seriously broken.
*/
@SlowTest(providers = {ProviderType.BOUNCY_CASTLE, ProviderType.SPONGY_CASTLE})
@SuppressWarnings("InsecureCryptoUsage")
public void testBasic() throws Exception {
int keySize = 2048;
String algorithm = "SHA256WithDSA";
Expand Down Expand Up @@ -833,6 +835,7 @@ public void testBasic() throws Exception {
System.out.println("s:" + extractS(signature).toString());
}

@SuppressWarnings("InsecureCryptoUsage")
public void testKeyGeneration(int keysize) throws Exception {
KeyPairGenerator generator = KeyPairGenerator.getInstance("DSA");
generator.initialize(keysize);
Expand Down Expand Up @@ -886,6 +889,7 @@ public void testKeyGenerationAll() throws Exception {
* Checks whether the one time key k in DSA is biased. For example the SUN provider fell for this
* test until April 2016.
*/
@SuppressWarnings("InsecureCryptoUsage")
public void testDsaBias() throws Exception {
// q is close to 2/3 * 2^160.
BigInteger q = new BigInteger("974317976835659416858874959372334979171063697271");
Expand Down Expand Up @@ -962,6 +966,7 @@ public void testDsaBias() throws Exception {
* the private key.
*/
@SlowTest(providers = {ProviderType.BOUNCY_CASTLE, ProviderType.SPONGY_CASTLE})
@SuppressWarnings("InsecureCryptoUsage")
public void testBiasSha1WithDSA() throws Exception {
String hashAlgorithm = "SHA";
String message = "Hello";
Expand Down Expand Up @@ -1050,6 +1055,7 @@ public void testBiasSha1WithDSA() throws Exception {
*/
@SlowTest(providers = {ProviderType.BOUNCY_CASTLE, ProviderType.OPENJDK,
ProviderType.SPONGY_CASTLE})
@SuppressWarnings("InsecureCryptoUsage")
public void testTiming() throws Exception {
ThreadMXBean bean = ManagementFactory.getThreadMXBean();
if (!bean.isCurrentThreadCpuTimeSupported()) {
Expand Down
4 changes: 4 additions & 0 deletions java/com/google/security/wycheproof/testcases/EcdhTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ public void testDecode() throws Exception {
* the public key. Also a severe bug would be to reduce the private key modulo the order given in
* the public key parameters.
*/
@SuppressWarnings("InsecureCryptoUsage")
public void testModifiedPublic(String algorithm) throws Exception {
KeyAgreement ka;
try {
Expand Down Expand Up @@ -922,6 +923,7 @@ public void testModifiedPublic(String algorithm) throws Exception {
* This is a similar test as testModifiedPublic. However, this test uses test vectors
* ECPublicKeySpec
*/
@SuppressWarnings("InsecureCryptoUsage")
public void testModifiedPublicSpec(String algorithm) throws Exception {
KeyAgreement ka;
try {
Expand Down Expand Up @@ -977,6 +979,7 @@ public void testModifiedPublicSpec() throws Exception {
testModifiedPublicSpec("ECDHC");
}

@SuppressWarnings("InsecureCryptoUsage")
public void testDistinctCurves(String algorithm, ECPrivateKey priv, ECPublicKey pub)
throws Exception {
KeyAgreement kaA;
Expand Down Expand Up @@ -1039,6 +1042,7 @@ public void testDistinctCurves(String algorithm, ECPrivateKey priv, ECPublicKey
* the public key parameters.
*/
// TODO(bleichen): This can be merged with testModifiedPublic once this is fixed.
@SuppressWarnings("InsecureCryptoUsage")
public void testWrongOrder(String algorithm, ECParameterSpec spec) throws Exception {
KeyAgreement ka;
try {
Expand Down

0 comments on commit 06d73e0

Please sign in to comment.