Commit 55c0173
committed
std: Update randomness implementation on Windows
This commit updates the OS random number generator on Windows to match the
upstream implementation in the `rand` crate. First proposed in
rust-random/rand#111 this implementation uses a "private" API of
`RtlGenRandom`. Despite the [documentation][dox] indicating this is a private
function its widespread use in Chromium and Firefox as well as [comments] from
Microsoft internally indicates that it's highly unlikely to break.
Another motivation for switching this is to also attempt to make progress
on #44911. It may be the case that this function succeeds while the previous
implementation may fail in "weird" scenarios.
[dox]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx
[comments]: rust-random/rand#111 (comment)1 parent 7a4f394 commit 55c0173
2 files changed
+10
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
46 | 45 | | |
47 | 46 | | |
48 | 47 | | |
49 | | - | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
288 | 286 | | |
289 | 287 | | |
290 | 288 | | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | 289 | | |
296 | 290 | | |
297 | 291 | | |
| |||
1136 | 1130 | | |
1137 | 1131 | | |
1138 | 1132 | | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | 1133 | | |
1149 | 1134 | | |
1150 | 1135 | | |
| |||
1175 | 1160 | | |
1176 | 1161 | | |
1177 | 1162 | | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1178 | 1166 | | |
1179 | 1167 | | |
1180 | 1168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
| 17 | + | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | 21 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 22 | + | |
36 | 23 | | |
37 | 24 | | |
38 | 25 | | |
| |||
42 | 29 | | |
43 | 30 | | |
44 | 31 | | |
| 32 | + | |
45 | 33 | | |
46 | 34 | | |
47 | 35 | | |
48 | 36 | | |
49 | 37 | | |
| 38 | + | |
50 | 39 | | |
51 | | - | |
| 40 | + | |
52 | 41 | | |
53 | | - | |
| 42 | + | |
54 | 43 | | |
55 | | - | |
56 | | - | |
| 44 | + | |
57 | 45 | | |
58 | 46 | | |
59 | 47 | | |
| |||
62 | 50 | | |
63 | 51 | | |
64 | 52 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
0 commit comments