Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5287885
use randSecure and randABytes
bpangWR Sep 10, 2019
83e7976
Merge pull request #20 from Wind-River/rand
BaoshanPang Sep 11, 2019
5e8bf87
Merge pull request #21 from rust-lang/master
BaoshanPang Sep 11, 2019
b731e11
declare EnvKey before use to fix build error
bpangWR Sep 11, 2019
a8c5f90
Fix inconsistent link formatting.
tomasz-rozanski Sep 11, 2019
223600a
Guarantee vec.clear/truncate is O(1) for trivial types
kornelski Sep 11, 2019
08fa803
Merge pull request #22 from Wind-River/master_002
BaoshanPang Sep 12, 2019
612c394
Trim rustc-workspace-hack
mati865 Sep 11, 2019
e9214a1
codegen: be more explicit about setting giving names to allocas.
eddyb Sep 12, 2019
34d71f1
Ban non-extern rust intrinsics
Mark-Simulacrum Sep 12, 2019
a47a5c3
typo fix
Sep 9, 2019
bd25507
Remove raw string literal quotes from error index descriptions
ollie27 Sep 13, 2019
69112a2
Add self to .mailmap
ollie27 Sep 13, 2019
7437f77
Make fn ptr always structural match, regardless of whether formal typ…
pnkfelix Sep 13, 2019
c529294
Regression tests for fn ptr and `#[structural_match]` as discussed in…
pnkfelix Sep 13, 2019
bdad2c5
codegen: use "_N" (like for other locals) instead of "argN", for argu…
eddyb Sep 13, 2019
8b3beb5
Rollup merge of #64372 - Wind-River:master, r=alexcrichton
Centril Sep 13, 2019
b058147
Rollup merge of #64375 - kornelski:vecdrop, r=rkruppe
Centril Sep 13, 2019
fc8a4bd
Rollup merge of #64378 - Rosto75:master, r=jonas-schievink
Centril Sep 13, 2019
0eba870
Rollup merge of #64384 - mati865:tools_hack, r=alexcrichton
Centril Sep 13, 2019
8581865
Rollup merge of #64393 - Wind-River:master_002_envKey, r=alexcrichton
Centril Sep 13, 2019
3c05a3e
Rollup merge of #64406 - Mark-Simulacrum:error-unknown-intrinsic, r=C…
Centril Sep 13, 2019
8a38c80
Rollup merge of #64422 - ollie27:error_index_generator_stringify, r=M…
Centril Sep 13, 2019
cd214aa
Rollup merge of #64423 - ollie27:mailmap, r=Mark-Simulacrum
Centril Sep 13, 2019
8ccaf76
Rollup merge of #64425 - guanqun:typo-fix, r=matthewjasper
Centril Sep 13, 2019
99e9fc1
Rollup merge of #64431 - pnkfelix:issue-63479-fnptr-is-structural-mat…
Centril Sep 13, 2019
589e238
Rollup merge of #64435 - eddyb:arguments-against-arg, r=rkruppe
Centril Sep 13, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
use randSecure and randABytes
  • Loading branch information
bpangWR committed Sep 10, 2019
commit 5287885481c018eeef3ee815f9ceab4b4106d5a2
21 changes: 14 additions & 7 deletions src/libstd/sys/vxworks/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@ pub fn hashmap_random_keys() -> (u64, u64) {
mod imp {
use libc;
use crate::io;

extern "C" {
fn randBytes (randBuf: *mut libc::c_uchar,
numOfBytes: libc::c_int) -> libc::c_int;
}
use core::sync::atomic::{AtomicBool, Ordering::Relaxed};

pub fn fill_bytes(v: &mut [u8]) {
static RNG_INIT: AtomicBool = AtomicBool::new(false);
while !RNG_INIT.load(Relaxed) {
let ret = unsafe { libc::randSecure() };
if ret < 0 {
panic!("couldn't generate random bytes: {}", io::Error::last_os_error());
} else if ret > 0 {
RNG_INIT.store(true, Relaxed);
break;
}
unsafe { libc::usleep(10) };
}
let ret = unsafe {
randBytes(v.as_mut_ptr() as *mut libc::c_uchar, v.len() as libc::c_int)
libc::randABytes(v.as_mut_ptr() as *mut libc::c_uchar, v.len() as libc::c_int)
};
if ret == -1 {
if ret < 0 {
panic!("couldn't generate random bytes: {}", io::Error::last_os_error());
}
}
Expand Down