r_efi/protocols/
rng.rs

1//! Random Number Generator Protocol
2//!
3//! This protocol is used to provide random numbers for use in applications, or
4//! entropy for seeding other random number generators.
5
6pub const PROTOCOL_GUID: crate::base::Guid = crate::base::Guid::from_fields(
7    0x3152bca5,
8    0xeade,
9    0x433d,
10    0x86,
11    0x2e,
12    &[0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44],
13);
14
15pub type Algorithm = crate::base::Guid;
16
17pub const ALGORITHM_SP800_90_HASH_256_GUID: Algorithm = crate::base::Guid::from_fields(
18    0xa7af67cb,
19    0x603b,
20    0x4d42,
21    0xba,
22    0x21,
23    &[0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96],
24);
25pub const ALGORITHM_SP800_90_HMAC_256_GUID: Algorithm = crate::base::Guid::from_fields(
26    0xc5149b43,
27    0xae85,
28    0x4f53,
29    0x99,
30    0x82,
31    &[0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7],
32);
33pub const ALGORITHM_SP800_90_CTR_256_GUID: Algorithm = crate::base::Guid::from_fields(
34    0x44f0de6e,
35    0x4d8c,
36    0x4045,
37    0xa8,
38    0xc7,
39    &[0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e],
40);
41pub const ALGORITHM_X9_31_3DES_GUID: Algorithm = crate::base::Guid::from_fields(
42    0x63c4785a,
43    0xca34,
44    0x4012,
45    0xa3,
46    0xc8,
47    &[0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46],
48);
49pub const ALGORITHM_X9_31_AES_GUID: Algorithm = crate::base::Guid::from_fields(
50    0xacd03321,
51    0x777e,
52    0x4d3d,
53    0xb1,
54    0xc8,
55    &[0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9],
56);
57pub const ALGORITHM_RAW: Algorithm = crate::base::Guid::from_fields(
58    0xe43176d7,
59    0xb6e8,
60    0x4827,
61    0xb7,
62    0x84,
63    &[0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61],
64);
65
66pub type ProtocolGetInfo = eficall! {fn(
67    *mut Protocol,
68    *mut usize,
69    *mut Algorithm,
70) -> crate::base::Status};
71
72pub type ProtocolGetRng = eficall! {fn(
73    *mut Protocol,
74    *mut Algorithm,
75    usize,
76    *mut u8,
77) -> crate::base::Status};
78
79#[repr(C)]
80pub struct Protocol {
81    pub get_info: ProtocolGetInfo,
82    pub get_rng: ProtocolGetRng,
83}