Merge "Use SecureRandom instead of java.util.Random." am: 415be6e357 am: 69cb81929d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2485125 Change-Id: Ic2fb637eb822ba56490ae0d849468934af2c6121 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -40,7 +40,6 @@ import java.security.InvalidKeyException;
|
|||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assorted utility methods for implementing crypto operations on top of KeyStore.
|
* Assorted utility methods for implementing crypto operations on top of KeyStore.
|
||||||
@@ -50,7 +49,6 @@ import java.util.Random;
|
|||||||
abstract class KeyStoreCryptoOperationUtils {
|
abstract class KeyStoreCryptoOperationUtils {
|
||||||
|
|
||||||
private static volatile SecureRandom sRng;
|
private static volatile SecureRandom sRng;
|
||||||
private static final Random sRandom = new Random();
|
|
||||||
|
|
||||||
private KeyStoreCryptoOperationUtils() {}
|
private KeyStoreCryptoOperationUtils() {}
|
||||||
|
|
||||||
@@ -213,7 +211,7 @@ abstract class KeyStoreCryptoOperationUtils {
|
|||||||
} else {
|
} else {
|
||||||
// Keystore won't give us an operation challenge if the operation doesn't
|
// Keystore won't give us an operation challenge if the operation doesn't
|
||||||
// need user authorization. So we make our own.
|
// need user authorization. So we make our own.
|
||||||
return sRandom.nextLong();
|
return getRng().nextLong();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user