File tree Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Expand file tree Collapse file tree 2 files changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ authors = ["Matt Corallo"]
5
5
license = " MIT OR Apache-2.0"
6
6
repository = " https://github.com/lightningdevkit/rust-lightning/"
7
7
description = """
8
- A crate which wraps getrandom and always compiles, returning 0s when no randomness is available.
8
+ A crate that wraps getrandom and always compiles, returning 0s when no randomness is available.
9
9
"""
10
10
edition = " 2021"
11
11
Original file line number Diff line number Diff line change 7
7
// You may not use this file except in accordance with one or both of these
8
8
// licenses.
9
9
10
- //! [`getrandom`] provides access to OS randomness, but will fail to compile on platforms which do
10
+ //! [`getrandom`] provides access to OS randomness, but will fail to compile on platforms that do
11
11
//! not support fetching OS randomness. This is exactly what you want when you're doing
12
12
//! cryptographic operations, but when you're just opportunistically randomizing, we're fine with
13
13
//! compiling and simply disabling randomization.
24
24
extern crate getrandom;
25
25
26
26
/// Possibly fills `dest` with random data. May fill it with zeros.
27
- #[ cfg( feature = "getrandom" ) ]
28
27
#[ inline]
29
28
pub fn getpossiblyrandom ( dest : & mut [ u8 ] ) {
29
+ #[ cfg( feature = "getrandom" ) ]
30
30
if getrandom:: getrandom ( dest) . is_err ( ) {
31
31
dest. fill ( 0 ) ;
32
32
}
33
- }
34
-
35
- /// Possibly fills `dest` with random data. May fill it with zeros.
36
- #[ cfg( not( feature = "getrandom" ) ) ]
37
- #[ inline]
38
- pub fn getpossiblyrandom ( dest : & mut [ u8 ] ) {
33
+ #[ cfg( not( feature = "getrandom" ) ) ]
39
34
dest. fill ( 0 ) ;
40
35
}
You can’t perform that action at this time.
0 commit comments