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 {...@@ -109,7 +109,7 @@ pub const Options = struct {
109 read_buffer: []u8,109 read_buffer: []u8,
110 /// Cryptographically secure random bytes. The pointer is not captured; data is only110 /// Cryptographically secure random bytes. The pointer is not captured; data is only
111 /// read during `init`.111 /// read during `init`.
112 entropy: *const [240]u8,112 entropy: *const [entropy_len]u8,
113 /// Current time according to the wall clock / calendar, in seconds.113 /// Current time according to the wall clock / calendar, in seconds.
114 realtime_now_seconds: i64,114 realtime_now_seconds: i64,
115115
...@@ -130,6 +130,8 @@ pub const Options = struct {...@@ -130,6 +130,8 @@ pub const Options = struct {
130 allow_truncation_attacks: bool = false,130 allow_truncation_attacks: bool = false,
131 /// Populated when `error.TlsAlert` is returned from `init`.131 /// Populated when `error.TlsAlert` is returned from `init`.
132 alert: ?*tls.Alert = null,132 alert: ?*tls.Alert = null,
133
134 pub const entropy_len = 240;
133};135};
134136
135const InitError = error{137const InitError = error{
lib/std/http/Client.zig+1-1
...@@ -321,7 +321,7 @@ pub const Connection = struct {...@@ -321,7 +321,7 @@ pub const Connection = struct {
321 assert(base.ptr + alloc_len == socket_read_buffer.ptr + socket_read_buffer.len);321 assert(base.ptr + alloc_len == socket_read_buffer.ptr + socket_read_buffer.len);
322 @memcpy(host_buffer, remote_host.bytes);322 @memcpy(host_buffer, remote_host.bytes);
323 const tls: *Tls = @ptrCast(base);323 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;
325 io.random(&random_buffer);325 io.random(&random_buffer);
326 tls.* = .{326 tls.* = .{
327 .connection = .{327 .connection = .{