Skip to content

Commit bd82709

Browse files
author
Jack Tjaden
committed
Changed RSA_TIME variable to more generic TEST_TIME
1 parent 6f6adf1 commit bd82709

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/provider/CryptoBenchmark.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class CryptoBenchmark {
3030
private static final int DES3_BLOCK_SIZE = 8;
3131
private static final int GCM_TAG_LENGTH = 128;
3232
private static final int[] RSA_KEY_SIZES = {2048, 3072, 4096};
33-
private static final int RSA_MIN_TIME_SECONDS = 1; /* minimum time to run each test */
33+
private static final int TEST_MIN_TIME_SECONDS = 1; /* minimum time to run each test */
3434
private static final int SMALL_MESSAGE_SIZE = 32; /* small message size for RSA ops */
3535
private static final String[] ECC_CURVES = {"secp256r1"}; /* Can add more curves benchmark.c only uses secp256r1 */
3636
private static final int[] DH_KEY_SIZES = {2048}; /* Can add more key sizes benchmark.c only uses 2048 */
@@ -357,7 +357,7 @@ private static void runRSABenchmark(String providerName, int keySize) throws Exc
357357
keyGen.generateKeyPair();
358358
keyGenOps++;
359359
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
360-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
360+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
361361

362362
keyGenOp = String.format("RSA %d key gen", keySize);
363363
printKeyGenResults(keyGenOps, elapsedTime, keyGenOp, providerName, cipherMode);
@@ -376,7 +376,7 @@ private static void runRSABenchmark(String providerName, int keySize) throws Exc
376376
cipher.doFinal(testData);
377377
publicOps++;
378378
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
379-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
379+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
380380

381381
printKeyGenResults(publicOps, elapsedTime, "RSA 2048 public", providerName, cipherMode);
382382

@@ -392,7 +392,7 @@ private static void runRSABenchmark(String providerName, int keySize) throws Exc
392392
cipher.doFinal(encrypted);
393393
privateOps++;
394394
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
395-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
395+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
396396

397397
printKeyGenResults(privateOps, elapsedTime, "RSA 2048 private", providerName, cipherMode);
398398
}
@@ -423,7 +423,7 @@ private static void runECCBenchmark(String providerName, String curveName) throw
423423
keyGen.generateKeyPair();
424424
keyGenOps++;
425425
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
426-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
426+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
427427

428428
String keyGenOp = String.format("ECC %s key gen", curveName);
429429
printKeyGenResults(keyGenOps, elapsedTime, keyGenOp, providerName, "EC");
@@ -523,7 +523,7 @@ private static void runDHBenchmark(String providerName, int keySize) throws Exce
523523
keyGen.generateKeyPair();
524524
keyGenOps++;
525525
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
526-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
526+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
527527

528528
String keyGenOp = String.format("DH %d key gen", keySize);
529529
printKeyGenResults(keyGenOps, elapsedTime, keyGenOp, providerName, DH_ALGORITHM);
@@ -545,7 +545,7 @@ private static void runDHBenchmark(String providerName, int keySize) throws Exce
545545
keyAgreement.generateSecret();
546546
agreementOps++;
547547
elapsedTime = (System.nanoTime() - startTime) / 1_000_000_000.0;
548-
} while (elapsedTime < RSA_MIN_TIME_SECONDS);
548+
} while (elapsedTime < TEST_MIN_TIME_SECONDS);
549549

550550
String agreementOp = String.format("DH %d agree", keySize);
551551
printKeyGenResults(agreementOps, elapsedTime, agreementOp, providerName, DH_ALGORITHM);

0 commit comments

Comments
 (0)