Commit ff6d87b
committed
Merge rust-bitcoin/rust-secp256k1#385: Randomize context on creation
8339ca57061d6ae664a50263a9564acc363aabae Add documentation guiding users towards randomization (Tobin Harding)
cf1496b64e09fce34e98fa28ea6382da3cd8f373 Add documentation about rand-std feature (Tobin Harding)
1693d51ce7b7acd96183ad4bc585489087ef3f6d Randomize context on creation (Tobin Harding)
a0465ea279a3f9a8f17bf1931d5ae0d720b0ffca Remove feature global-context-less-secure (Tobin Harding)
Pull request description:
Currently it is easy for users to mis-use our API because they may not know that `randomize()` should be called after context creation for maximum defence against side channel attacks.
This PR entails the first two parts of the plan outlined in #388. The commit messages are a bit light of information as to _why_ we are doing this so please see #388 for more context.
In light of @real-or-random's [comment](rust-bitcoin/rust-secp256k1#388 (comment)) about verification contexts the randomization is done in `gen_new` i.e., for _all_ contexts not just signing ones.
Also, I think we should add some docs about exactly _what_ randomization buys the user and what it costs. I do not know exactly what this is, can someone please write a sentence or two that we can include in the docs to `gen_new`?
@TheBlueMatt please review patch 4.
Resolves: #225
**Note**: This is a total re-write of the original PR, most of the discussion below is stale. Of note, the additional API that takes a seed during construction is not implemented here.
ACKs for top commit:
apoelstra:
ACK 8339ca57061d6ae664a50263a9564acc363aabae
Tree-SHA512: e74fe9a6eaf8ac40e4e06997602006eb8ca95216b5bc6dca3f5f96b5b4d3bf8610d851d8f1ef5c199ab7fbe85b34d162f2ee0073647f45105a486d20d8c0722a4 files changed
+73
-27
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
38 | | - | |
| 45 | + | |
39 | 46 | | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
44 | | - | |
| 51 | + | |
45 | 52 | | |
46 | 53 | | |
47 | 54 | | |
| |||
108 | 115 | | |
109 | 116 | | |
110 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
111 | 121 | | |
112 | 122 | | |
113 | 123 | | |
| |||
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
170 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
171 | 197 | | |
172 | 198 | | |
173 | 199 | | |
174 | 200 | | |
175 | 201 | | |
176 | 202 | | |
177 | 203 | | |
178 | | - | |
| 204 | + | |
179 | 205 | | |
180 | 206 | | |
181 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
182 | 213 | | |
| 214 | + | |
| 215 | + | |
183 | 216 | | |
184 | 217 | | |
185 | 218 | | |
186 | 219 | | |
187 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
188 | 225 | | |
189 | 226 | | |
190 | 227 | | |
191 | 228 | | |
192 | 229 | | |
193 | 230 | | |
194 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
195 | 236 | | |
196 | 237 | | |
197 | 238 | | |
198 | 239 | | |
199 | 240 | | |
200 | 241 | | |
201 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
202 | 247 | | |
203 | 248 | | |
204 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
641 | 641 | | |
642 | 642 | | |
643 | 643 | | |
644 | | - | |
| 644 | + | |
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
| |||
1320 | 1320 | | |
1321 | 1321 | | |
1322 | 1322 | | |
1323 | | - | |
| 1323 | + | |
1324 | 1324 | | |
1325 | 1325 | | |
1326 | 1326 | | |
| |||
1924 | 1924 | | |
1925 | 1925 | | |
1926 | 1926 | | |
1927 | | - | |
| 1927 | + | |
1928 | 1928 | | |
1929 | 1929 | | |
1930 | 1930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
125 | 129 | | |
126 | 130 | | |
127 | 131 | | |
128 | | - | |
129 | | - | |
130 | | - | |
| 132 | + | |
131 | 133 | | |
132 | 134 | | |
133 | 135 | | |
| |||
195 | 197 | | |
196 | 198 | | |
197 | 199 | | |
198 | | - | |
199 | | - | |
| 200 | + | |
| 201 | + | |
200 | 202 | | |
201 | 203 | | |
202 | 204 | | |
| |||
955 | 957 | | |
956 | 958 | | |
957 | 959 | | |
958 | | - | |
| 960 | + | |
959 | 961 | | |
960 | 962 | | |
961 | 963 | | |
| |||
0 commit comments