1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Helpers shared across [`FragmentStrategy`](super::FragmentStrategy)
//! implementations.
//!
//! These are all crate-private; they are not part of the public API.
use Vec;
use crateResult;
use crateError;
/// Inclusive uniform sample from `[min, max]` using the OS CSPRNG.
///
/// Used by all fragmenters to pick chunk sizes and shuffle indices.
///
/// # Errors
///
/// Returns [`Error::Internal`](crate::Error::Internal) if the OS CSPRNG
/// fails. `getrandom` failure is a hard system-level event that the vault
/// cannot meaningfully recover from on its own; the caller is informed and
/// the operation aborts.
pub
/// Single 64-bit draw from the OS CSPRNG.
pub
/// In-place Fisher-Yates shuffle backed by [`random_u64`].
///
/// Slices of length < 2 are left unchanged.
pub
/// Volatile-zero a byte slice and emit a `SeqCst` compiler fence. Used to
/// scrub intermediate plaintext buffers (layout encodings, decoy temp
/// buffers) before their `Vec` storage is dropped.
pub
/// Volatile-zero an owned `Vec<u8>` and drop it. Convenience wrapper used
/// when a decoy strategy hands back a fresh plaintext `Vec` that we
/// immediately copy into a [`LockedBytes`](crate::memory::LockedBytes).
pub