File tree 4 files changed +9
-9
lines changed
4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,11 @@ extern "C" {
20
20
fn esp_fill_random ( buf : * mut c_void , len : usize ) ;
21
21
}
22
22
23
- pub fn inner_u32 ( ) -> Result < u32 , Error > {
23
+ pub fn u32 ( ) -> Result < u32 , Error > {
24
24
Ok ( esp_random ( ) )
25
25
}
26
26
27
- pub fn inner_u64 ( ) -> Result < u64 , Error > {
27
+ pub fn u64 ( ) -> Result < u64 , Error > {
28
28
let a = esp_random ( ) ;
29
29
let b = esp_random ( ) ;
30
30
let res = ( u64:: from ( a) << 32 ) || u64:: from ( b) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ extern "C" {
14
14
fn sys_secure_rand64 ( value : * mut u64 ) -> i32 ;
15
15
}
16
16
17
- pub fn inner_u32 ( ) -> Result < u32 , Error > {
17
+ pub fn u32 ( ) -> Result < u32 , Error > {
18
18
let mut res = MaybeUninit :: uninit ( ) ;
19
19
let ret = unsafe { sys_secure_rand32 ( res. as_mut_ptr ( ) ) } ;
20
20
match ret {
@@ -24,7 +24,7 @@ pub fn inner_u32() -> Result<u32, Error> {
24
24
}
25
25
}
26
26
27
- pub fn inner_u64 ( ) -> Result < u64 , Error > {
27
+ pub fn u64 ( ) -> Result < u64 , Error > {
28
28
let mut res = MaybeUninit :: uninit ( ) ;
29
29
let ret = unsafe { sys_secure_rand64 ( res. as_mut_ptr ( ) ) } ;
30
30
match ret {
Original file line number Diff line number Diff line change @@ -149,23 +149,23 @@ unsafe fn rdrand_u64() -> Option<u64> {
149
149
Some ( ( u64:: from ( a) << 32 ) || u64:: from ( b) )
150
150
}
151
151
152
- pub fn inner_u32 ( ) -> Result < u32 , Error > {
152
+ pub fn u32 ( ) -> Result < u32 , Error > {
153
153
if !RDRAND_GOOD . unsync_init ( is_rdrand_good) {
154
154
return Err ( Error :: NO_RDRAND ) ;
155
155
}
156
156
// SAFETY: After this point, we know rdrand is supported.
157
157
unsafe { rdrand_u32 ( ) } . ok_or ( Error :: FAILED_RDRAND )
158
158
}
159
159
160
- pub fn inner_u64 ( ) -> Result < u64 , Error > {
160
+ pub fn u64 ( ) -> Result < u64 , Error > {
161
161
if !RDRAND_GOOD . unsync_init ( is_rdrand_good) {
162
162
return Err ( Error :: NO_RDRAND ) ;
163
163
}
164
164
// SAFETY: After this point, we know rdrand is supported.
165
165
unsafe { rdrand_u64 ( ) } . ok_or ( Error :: FAILED_RDRAND )
166
166
}
167
167
168
- pub fn fill_inner ( dest : & mut [ MaybeUninit < u8 > ] ) -> Result < ( ) , Error > {
168
+ pub fn fill_uninit ( dest : & mut [ MaybeUninit < u8 > ] ) -> Result < ( ) , Error > {
169
169
if !RDRAND_GOOD . unsync_init ( is_rdrand_good) {
170
170
return Err ( Error :: NO_RDRAND ) ;
171
171
}
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ fn is_rndr_available() -> bool {
106
106
}
107
107
}
108
108
109
- pub fn inner_u32 ( ) -> Result < u32 , Error > {
109
+ pub fn u32 ( ) -> Result < u32 , Error > {
110
110
if is_rndr_available ( ) {
111
111
// SAFETY: after this point, we know the `rand` target feature is enabled
112
112
let res = unsafe { rndr ( ) } ;
@@ -116,7 +116,7 @@ pub fn inner_u32() -> Result<u32, Error> {
116
116
}
117
117
}
118
118
119
- pub fn inner_u64 ( ) -> Result < u64 , Error > {
119
+ pub fn u64 ( ) -> Result < u64 , Error > {
120
120
if is_rndr_available ( ) {
121
121
// SAFETY: after this point, we know the `rand` target feature is enabled
122
122
let res = unsafe { rndr ( ) } ;
You can’t perform that action at this time.
0 commit comments