Update syscall
This commit is contained in:
Generated
+2
-2
@@ -123,9 +123,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8380fe0152551244f0747b1bf41737e0f8a74f97a14ccefd1148187271634f3c"
|
||||
checksum = "8ae183fc1b06c149f0c1793e1eb447c8b04bfe46d48e9e48bfb8d2d7ed64ecf0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ version = "0.1.0"
|
||||
[dependencies]
|
||||
rand_chacha = "0.2"
|
||||
rand_core = "0.5"
|
||||
redox_syscall = "0.2.9"
|
||||
redox_syscall = "0.2.12"
|
||||
sha2 = "0.8"
|
||||
|
||||
[target.'cfg(target_arch = "x86_64")'.dependencies]
|
||||
|
||||
+4
-8
@@ -1,5 +1,3 @@
|
||||
#![feature(llvm_asm)]
|
||||
|
||||
extern crate syscall;
|
||||
|
||||
extern crate rand_chacha;
|
||||
@@ -12,6 +10,8 @@ use std::fs::File;
|
||||
use std::io::{Read, Write};
|
||||
use std::process;
|
||||
|
||||
use std::arch::asm;
|
||||
|
||||
use rand_chacha::ChaCha20Rng;
|
||||
use rand_core::RngCore;
|
||||
|
||||
@@ -58,11 +58,7 @@ fn create_rdrand_seed() -> [u8; SEED_BYTES] {
|
||||
// We get 8 bytes at a time from rdrand instruction
|
||||
let rand: u64;
|
||||
unsafe {
|
||||
llvm_asm!("rdrand rax"
|
||||
: "={rax}"(rand)
|
||||
:
|
||||
:
|
||||
: "intel", "volatile");
|
||||
asm!("rdrand rax", out("rax") rand);
|
||||
}
|
||||
|
||||
rng[i * 8..(i * 8 + 8)].copy_from_slice(&rand.to_le_bytes());
|
||||
@@ -396,7 +392,7 @@ impl SchemeMut for RandScheme {
|
||||
}
|
||||
}
|
||||
|
||||
fn daemon(daemon: syscall::Daemon) -> ! {
|
||||
fn daemon(daemon: syscall::Daemon) -> core::convert::Infallible {
|
||||
let socket = File::create(":rand").expect("randd: failed to create rand scheme");
|
||||
|
||||
let mut scheme = RandScheme::new(socket);
|
||||
|
||||
Reference in New Issue
Block a user