mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-03-08 02:24:33 +01:00
std.crypto.tls.Client.Options: expose entropy_len
This commit is contained in:
parent
5d0929c40d
commit
006afece53
2 changed files with 4 additions and 2 deletions
|
|
@ -109,7 +109,7 @@ pub const Options = struct {
|
|||
read_buffer: []u8,
|
||||
/// Cryptographically secure random bytes. The pointer is not captured; data is only
|
||||
/// read during `init`.
|
||||
entropy: *const [240]u8,
|
||||
entropy: *const [entropy_len]u8,
|
||||
/// Current time according to the wall clock / calendar, in seconds.
|
||||
realtime_now_seconds: i64,
|
||||
|
||||
|
|
@ -130,6 +130,8 @@ pub const Options = struct {
|
|||
allow_truncation_attacks: bool = false,
|
||||
/// Populated when `error.TlsAlert` is returned from `init`.
|
||||
alert: ?*tls.Alert = null,
|
||||
|
||||
pub const entropy_len = 240;
|
||||
};
|
||||
|
||||
const InitError = error{
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ pub const Connection = struct {
|
|||
assert(base.ptr + alloc_len == socket_read_buffer.ptr + socket_read_buffer.len);
|
||||
@memcpy(host_buffer, remote_host.bytes);
|
||||
const tls: *Tls = @ptrCast(base);
|
||||
var random_buffer: [240]u8 = undefined;
|
||||
var random_buffer: [std.crypto.tls.Client.Options.entropy_len]u8 = undefined;
|
||||
io.random(&random_buffer);
|
||||
tls.* = .{
|
||||
.connection = .{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue