make compilable on aarch64 (M1)
This commit is contained in:
parent
0406085ed5
commit
700f6e1d6f
@ -60,11 +60,11 @@ base64 = "0.13"
|
|||||||
# Used for generating mnemonics
|
# Used for generating mnemonics
|
||||||
getrandom = "0.2"
|
getrandom = "0.2"
|
||||||
|
|
||||||
|
# Used for the hot signer
|
||||||
|
bip39 = "2.0"
|
||||||
|
|
||||||
# Additional entropy for generating mnemonics
|
# Additional entropy for generating mnemonics
|
||||||
[target.'cfg(target_arch = "x86")'.dependencies]
|
[target.'cfg(target_arch = "x86")'.dependencies]
|
||||||
rdrand = "0.8"
|
rdrand = "0.8"
|
||||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||||
rdrand = "0.8"
|
rdrand = "0.8"
|
||||||
|
|
||||||
# Used for the hot signer
|
|
||||||
bip39 = "2.0"
|
|
||||||
|
|||||||
@ -41,11 +41,6 @@ fn cpu_randomness() -> Result<Option<[u8; 32]>, RandomnessError> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
|
|
||||||
fn hardware_randomness() -> Result<Option<[u8; 32]>, RandomnessError> {
|
|
||||||
Ok(None)
|
|
||||||
}
|
|
||||||
|
|
||||||
// OS-generated randomness. See https://docs.rs/getrandom/latest/getrandom/#supported-targets
|
// OS-generated randomness. See https://docs.rs/getrandom/latest/getrandom/#supported-targets
|
||||||
// (basically this calls `getrandom()` or polls `/dev/urandom` on Linux, `BCryptGenRandom` on
|
// (basically this calls `getrandom()` or polls `/dev/urandom` on Linux, `BCryptGenRandom` on
|
||||||
// Windows, and `getentropy()` / `/dev/random` on Mac.
|
// Windows, and `getentropy()` / `/dev/random` on Mac.
|
||||||
@ -82,9 +77,11 @@ fn additional_data() -> Result<[u8; 32], RandomnessError> {
|
|||||||
pub fn random_bytes() -> Result<[u8; 32], RandomnessError> {
|
pub fn random_bytes() -> Result<[u8; 32], RandomnessError> {
|
||||||
let mut engine = sha256::HashEngine::default();
|
let mut engine = sha256::HashEngine::default();
|
||||||
|
|
||||||
|
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
|
||||||
if let Some(bytes) = cpu_randomness()? {
|
if let Some(bytes) = cpu_randomness()? {
|
||||||
engine.input(&bytes);
|
engine.input(&bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.input(&system_randomness()?);
|
engine.input(&system_randomness()?);
|
||||||
engine.input(&additional_data()?);
|
engine.input(&additional_data()?);
|
||||||
// TODO: add more sources of randomness
|
// TODO: add more sources of randomness
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user