summaryrefslogtreecommitdiff
path: root/keystore
diff options
context:
space:
mode:
authorNikita Iashchenko <nikitai@google.com>2021-04-20 20:27:02 +0000
committerNikita Iashchenko <nikitai@google.com>2021-04-21 14:10:43 +0000
commit1bc8a1f88616f3b4e54219075a971196f3492874 (patch)
treebf843db90f63a6d1557b1bb1c683c74a8a5d9fb1 /keystore
parent87c254de0ea13e2ac250d6c69309b24da7e73edc (diff)
Remove usage of Math.randomLongInternal
As a part of internal libcore API cleanup some of the functions previously exposed are getting removed from public surface. Math#randomLongInternal is a wrapper around java.util.Random and has no specific implications so its usages are get refactored. Bug: 154796679 Test: m droid Change-Id: I29e0e9307fbaf9c1ac018b83014efb2d3dd74479
Diffstat (limited to 'keystore')
-rw-r--r--keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java b/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java
index 0006b92b1b9b..850c55166edc 100644
--- a/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java
+++ b/keystore/java/android/security/keystore2/KeyStoreCryptoOperationUtils.java
@@ -40,6 +40,7 @@ import java.security.InvalidKeyException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
/**
* Assorted utility methods for implementing crypto operations on top of KeyStore.
@@ -49,6 +50,7 @@ import java.util.List;
abstract class KeyStoreCryptoOperationUtils {
private static volatile SecureRandom sRng;
+ private static final Random sRandom = new Random();
private KeyStoreCryptoOperationUtils() {}
@@ -211,7 +213,7 @@ abstract class KeyStoreCryptoOperationUtils {
} else {
// Keystore won't give us an operation challenge if the operation doesn't
// need user authorization. So we make our own.
- return Math.randomLongInternal();
+ return sRandom.nextLong();
}
}
}