authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-18 16:03:22-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-01-02 16:57:15-07:00
logf6c3a86f0f570a2feb721e443efea3319d19d098
treea68274fd1506fc92eed83a1802ed4c1acbe0624c
parent8ef4dcd39f08a543f067a9820d82840dbf9d2ce5

std.crypto.tls.Client: remove unnecessary coercion


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

lib/std/crypto/tls/Client.zig+2-2
...@@ -343,7 +343,7 @@ pub fn init(stream: net.Stream, host: []const u8) !Client {...@@ -343,7 +343,7 @@ pub fn init(stream: net.Stream, host: []const u8) !Client {
343 const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8);343 const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8);
344 const operand: V = pad ++ @bitCast([8]u8, big(read_seq));344 const operand: V = pad ++ @bitCast([8]u8, big(read_seq));
345 read_seq += 1;345 read_seq += 1;
346 const nonce: [P.AEAD.nonce_length]u8 = @as(V, p.server_handshake_iv) ^ operand;346 const nonce = @as(V, p.server_handshake_iv) ^ operand;
347 const ad = handshake_buf[end_hdr - 5 ..][0..5];347 const ad = handshake_buf[end_hdr - 5 ..][0..5];
348 P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, p.server_handshake_key) catch348 P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, p.server_handshake_key) catch
349 return error.TlsBadRecordMac;349 return error.TlsBadRecordMac;
...@@ -522,7 +522,7 @@ pub fn write(c: *Client, stream: net.Stream, bytes: []const u8) !usize {...@@ -522,7 +522,7 @@ pub fn write(c: *Client, stream: net.Stream, bytes: []const u8) !usize {
522 const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8);522 const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8);
523 const operand: V = pad ++ @bitCast([8]u8, big(c.write_seq));523 const operand: V = pad ++ @bitCast([8]u8, big(c.write_seq));
524 c.write_seq += 1;524 c.write_seq += 1;
525 const nonce: [P.AEAD.nonce_length]u8 = @as(V, p.client_iv) ^ operand;525 const nonce = @as(V, p.client_iv) ^ operand;
526 P.AEAD.encrypt(ciphertext, auth_tag, cleartext, ad, nonce, p.client_key);526 P.AEAD.encrypt(ciphertext, auth_tag, cleartext, ad, nonce, p.client_key);
527 //std.debug.print("seq: {d} nonce: {} client_key: {} client_iv: {} ad: {} auth_tag: {}\nserver_key: {} server_iv: {}\n", .{527 //std.debug.print("seq: {d} nonce: {} client_key: {} client_iv: {} ad: {} auth_tag: {}\nserver_key: {} server_iv: {}\n", .{
528 // c.write_seq - 1,528 // c.write_seq - 1,