From f6c3a86f0f570a2feb721e443efea3319d19d098 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 18 Dec 2022 16:03:22 -0700 Subject: [PATCH] std.crypto.tls.Client: remove unnecessary coercion --- lib/std/crypto/tls/Client.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/crypto/tls/Client.zig b/lib/std/crypto/tls/Client.zig index 40bdf4d61a..4afc1b7e17 100644 --- a/lib/std/crypto/tls/Client.zig +++ b/lib/std/crypto/tls/Client.zig @@ -343,7 +343,7 @@ pub fn init(stream: net.Stream, host: []const u8) !Client { const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8); const operand: V = pad ++ @bitCast([8]u8, big(read_seq)); read_seq += 1; - const nonce: [P.AEAD.nonce_length]u8 = @as(V, p.server_handshake_iv) ^ operand; + const nonce = @as(V, p.server_handshake_iv) ^ operand; const ad = handshake_buf[end_hdr - 5 ..][0..5]; P.AEAD.decrypt(cleartext, ciphertext, auth_tag, ad, nonce, p.server_handshake_key) catch return error.TlsBadRecordMac; @@ -522,7 +522,7 @@ pub fn write(c: *Client, stream: net.Stream, bytes: []const u8) !usize { const pad = [1]u8{0} ** (P.AEAD.nonce_length - 8); const operand: V = pad ++ @bitCast([8]u8, big(c.write_seq)); c.write_seq += 1; - const nonce: [P.AEAD.nonce_length]u8 = @as(V, p.client_iv) ^ operand; + const nonce = @as(V, p.client_iv) ^ operand; P.AEAD.encrypt(ciphertext, auth_tag, cleartext, ad, nonce, p.client_key); //std.debug.print("seq: {d} nonce: {} client_key: {} client_iv: {} ad: {} auth_tag: {}\nserver_key: {} server_iv: {}\n", .{ // c.write_seq - 1,