authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-07 11:01:53-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-07 11:03:37-08:00
log006afece53af66401b941e25eba03efab6e9251f
tree6f9e22b97a6cfee83aecf3fcc3bc5cd5f2a76806
parent5d0929c40dcb0456cbef88fe10197af81e984142

std.crypto.tls.Client.Options: expose entropy_len


2 files changed, 4 insertions(+), 2 deletions(-)

lib/std/crypto/tls/Client.zig+3-1
......@@ -109,7 +109,7 @@ pub const Options = struct {
109109 read_buffer: []u8,
110110 /// Cryptographically secure random bytes. The pointer is not captured; data is only
111111 /// read during `init`.
112 entropy: *const [240]u8,
112 entropy: *const [entropy_len]u8,
113113 /// Current time according to the wall clock / calendar, in seconds.
114114 realtime_now_seconds: i64,
115115
......@@ -130,6 +130,8 @@ pub const Options = struct {
130130 allow_truncation_attacks: bool = false,
131131 /// Populated when `error.TlsAlert` is returned from `init`.
132132 alert: ?*tls.Alert = null,
133
134 pub const entropy_len = 240;
133135};
134136
135137const InitError = error{
lib/std/http/Client.zig+1-1
......@@ -321,7 +321,7 @@ pub const Connection = struct {
321321 assert(base.ptr + alloc_len == socket_read_buffer.ptr + socket_read_buffer.len);
322322 @memcpy(host_buffer, remote_host.bytes);
323323 const tls: *Tls = @ptrCast(base);
324 var random_buffer: [240]u8 = undefined;
324 var random_buffer: [std.crypto.tls.Client.Options.entropy_len]u8 = undefined;
325325 io.random(&random_buffer);
326326 tls.* = .{
327327 .connection = .{