1const uefi = @import("std").os.uefi; 2const Guid = uefi.Guid; 3const Status = uefi.Status; 4 5/// Random Number Generator protocol 6pub const RNGProtocol = extern struct { 7 _get_info: fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status, 8 _get_rng: fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status, 9 10 /// Returns information about the random number generation implementation. 11 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status { 12 return self._get_info(self, list_size, list); 13 } 14 15 /// Produces and returns an RNG value using either the default or specified RNG algorithm. 16 pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) Status { 17 return self._get_rng(self, algo, value_length, value); 18 } 19 20 pub const guid align(8) = Guid{ 21 .time_low = 0x3152bca5, 22 .time_mid = 0xeade, 23 .time_high_and_version = 0x433d, 24 .clock_seq_high_and_reserved = 0x86, 25 .clock_seq_low = 0x2e, 26 .node = [_]u8{ 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 }, 27 }; 28 pub const algorithm_sp800_90_hash_256 align(8) = Guid{ 29 .time_low = 0xa7af67cb, 30 .time_mid = 0x603b, 31 .time_high_and_version = 0x4d42, 32 .clock_seq_high_and_reserved = 0xba, 33 .clock_seq_low = 0x21, 34 .node = [_]u8{ 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 }, 35 }; 36 pub const algorithm_sp800_90_hmac_256 align(8) = Guid{ 37 .time_low = 0xc5149b43, 38 .time_mid = 0xae85, 39 .time_high_and_version = 0x4f53, 40 .clock_seq_high_and_reserved = 0x99, 41 .clock_seq_low = 0x82, 42 .node = [_]u8{ 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 }, 43 }; 44 pub const algorithm_sp800_90_ctr_256 align(8) = Guid{ 45 .time_low = 0x44f0de6e, 46 .time_mid = 0x4d8c, 47 .time_high_and_version = 0x4045, 48 .clock_seq_high_and_reserved = 0xa8, 49 .clock_seq_low = 0xc7, 50 .node = [_]u8{ 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e }, 51 }; 52 pub const algorithm_x9_31_3des align(8) = Guid{ 53 .time_low = 0x63c4785a, 54 .time_mid = 0xca34, 55 .time_high_and_version = 0x4012, 56 .clock_seq_high_and_reserved = 0xa3, 57 .clock_seq_low = 0xc8, 58 .node = [_]u8{ 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 }, 59 }; 60 pub const algorithm_x9_31_aes align(8) = Guid{ 61 .time_low = 0xacd03321, 62 .time_mid = 0x777e, 63 .time_high_and_version = 0x4d3d, 64 .clock_seq_high_and_reserved = 0xb1, 65 .clock_seq_low = 0xc8, 66 .node = [_]u8{ 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 }, 67 }; 68 pub const algorithm_raw align(8) = Guid{ 69 .time_low = 0xe43176d7, 70 .time_mid = 0xb6e8, 71 .time_high_and_version = 0x4827, 72 .clock_seq_high_and_reserved = 0xb7, 73 .clock_seq_low = 0x84, 74 .node = [_]u8{ 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 }, 75 }; 76}; 77