| ... | @@ -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) catch | 348 | 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, |