Commit 24d6e1c
vext-email-gateway: migrate OsRng to rand 0.9 try_fill_bytes API
Closes the pre-existing rand_core 0.9 build break flagged in commit
0d11476's report (the .expect("TODO") sweep). 3 sites used the rand
0.8 fallible-via-RngCore pattern:
use rand::RngCore;
let mut rng = rand::rngs::OsRng;
rng.fill_bytes(&mut sk);
In rand 0.9 OsRng no longer implements `RngCore`; it implements
`TryRngCore` instead (the fallible variant) since OS-level RNG calls
can fail. Migrated to:
use rand::TryRngCore;
rng.try_fill_bytes(&mut sk)
.expect("OsRng must succeed for cryptographic key generation");
Sites:
* src/types.rs::tests::generate_signing_key (test scaffold)
* src/types.rs::verification::generate_signing_key (#[cfg(feature = "kani")])
* src/main.rs::get_or_create_identity (production; also marked
INSECURE - prototype only in the surrounding comment, so .expect
matches the existing risk acceptance)
Verified locally:
cargo build -> EXIT 0 (warnings unchanged)
cargo test -> 7 passed / 0 failed / 0 ignored
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5a70427 commit 24d6e1c
2 files changed
Lines changed: 9 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
| 307 | + | |
| 308 | + | |
308 | 309 | | |
309 | 310 | | |
310 | 311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
| 338 | + | |
338 | 339 | | |
339 | 340 | | |
340 | 341 | | |
| |||
401 | 402 | | |
402 | 403 | | |
403 | 404 | | |
404 | | - | |
| 405 | + | |
405 | 406 | | |
406 | 407 | | |
407 | | - | |
| 408 | + | |
| 409 | + | |
408 | 410 | | |
409 | 411 | | |
410 | 412 | | |
| |||
0 commit comments