From 50714832d152a9f6bd0c251b7c921921b0e45a8f Mon Sep 17 00:00:00 2001 From: Fabrice Benhamouda <1146316+fabrice102@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:07:48 -0400 Subject: [PATCH] Use `LibCryptoRng` instead of `DEFAULT` in Random benchmark (#392) Following reversal of PR #376 in PR #388, using the ACCP SecureRandom algorithm `DEFAULT` (which is an alias of `LibCryptoRng`) yields lower performance in multi-threaded settings. See #376 for details. This PR is meant to use the algorithm `LibCryptoRng` in the benchmark, instead of its alias `DEFAULT`. This solves the performance drop in multi-threaded settings. This also corresponds to the most common use of ACCP SecureRandom. Indeed, if ACCP is the first security provider and if ACCP SecureRandom is registered, then when instantiating SecureRandom as `new SecureRandom()`, the algorithm `LibCryptoRng` will be selected. Co-authored-by: Fabrice Benhamouda --- .../com/amazon/corretto/crypto/provider/benchmarks/Random.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/benchmarks/lib/src/jmh/java/com/amazon/corretto/crypto/provider/benchmarks/Random.java b/benchmarks/lib/src/jmh/java/com/amazon/corretto/crypto/provider/benchmarks/Random.java index c1a1690f..e3eb7dea 100644 --- a/benchmarks/lib/src/jmh/java/com/amazon/corretto/crypto/provider/benchmarks/Random.java +++ b/benchmarks/lib/src/jmh/java/com/amazon/corretto/crypto/provider/benchmarks/Random.java @@ -53,7 +53,7 @@ public static class Shared { // !!! WARNING: java.util.random is not a secure randomness generator // !!! WARNING: we add it here just for comparison @Param({ - AmazonCorrettoCryptoProvider.PROVIDER_NAME + "/DEFAULT", + AmazonCorrettoCryptoProvider.PROVIDER_NAME + "/LibCryptoRng", "BC/DEFAULT", "SUN/NativePrng", "SUN/DRBG",