@zigc/lib 0.17.0-dev.228 → 0.17.0-dev.248
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/build_runner.zig +1 -1
- package/compiler/reduce/Walk.zig +1 -6
- package/compiler/resinator/cvtres.zig +4 -4
- package/compiler/resinator/ico.zig +4 -4
- package/compiler/resinator/parse.zig +2 -2
- package/compiler/resinator/res.zig +1 -1
- package/compiler/std-docs.zig +1 -1
- package/compiler/translate-c/ast.zig +11 -21
- package/compiler_rt/atomics.zig +1 -1
- package/compiler_rt/ssp.zig +2 -2
- package/docs/wasm/Walk.zig +1 -3
- package/docs/wasm/html_render.zig +1 -2
- package/package.json +1 -1
- package/std/Io/Reader.zig +0 -5
- package/std/Io/Threaded.zig +4 -4
- package/std/Io/Writer.zig +1 -2
- package/std/Io/net/HostName.zig +11 -6
- package/std/Random/ChaCha.zig +2 -2
- package/std/Random/benchmark.zig +2 -2
- package/std/Thread.zig +2 -2
- package/std/base64.zig +5 -5
- package/std/bit_set.zig +7 -7
- package/std/c.zig +17 -17
- package/std/compress/flate/Decompress.zig +1 -1
- package/std/crypto/25519/curve25519.zig +2 -2
- package/std/crypto/25519/edwards25519.zig +3 -3
- package/std/crypto/25519/ristretto255.zig +2 -2
- package/std/crypto/25519/scalar.zig +6 -6
- package/std/crypto/25519/x25519.zig +1 -1
- package/std/crypto/Certificate.zig +1 -1
- package/std/crypto/Sha1.zig +1 -1
- package/std/crypto/aegis.zig +45 -39
- package/std/crypto/aes_ccm.zig +20 -20
- package/std/crypto/aes_gcm.zig +10 -12
- package/std/crypto/aes_ocb.zig +9 -9
- package/std/crypto/argon2.zig +15 -15
- package/std/crypto/bcrypt.zig +20 -10
- package/std/crypto/benchmark.zig +7 -7
- package/std/crypto/blake2.zig +100 -64
- package/std/crypto/cbc_mac.zig +1 -1
- package/std/crypto/chacha20.zig +10 -10
- package/std/crypto/cmac.zig +2 -2
- package/std/crypto/codecs/asn1.zig +1 -1
- package/std/crypto/ecdsa.zig +9 -9
- package/std/crypto/ff.zig +2 -2
- package/std/crypto/ghash_polyval.zig +4 -4
- package/std/crypto/hkdf.zig +1 -1
- package/std/crypto/isap.zig +3 -3
- package/std/crypto/kangarootwelve.zig +1 -1
- package/std/crypto/keccak_p.zig +7 -7
- package/std/crypto/md5.zig +1 -1
- package/std/crypto/ml_dsa.zig +33 -33
- package/std/crypto/ml_kem.zig +4 -4
- package/std/crypto/modes.zig +1 -1
- package/std/crypto/pbkdf2.zig +1 -1
- package/std/crypto/pcurves/p256/scalar.zig +3 -3
- package/std/crypto/pcurves/p384/scalar.zig +2 -2
- package/std/crypto/pcurves/secp256k1/scalar.zig +3 -3
- package/std/crypto/pcurves/tests/p256.zig +5 -5
- package/std/crypto/pcurves/tests/p384.zig +5 -5
- package/std/crypto/pcurves/tests/secp256k1.zig +3 -3
- package/std/crypto/salsa20.zig +8 -8
- package/std/crypto/sha2.zig +2 -2
- package/std/crypto/sha3.zig +2 -2
- package/std/crypto/siphash.zig +1 -1
- package/std/crypto/timing_safe.zig +5 -4
- package/std/crypto/tls/Client.zig +10 -9
- package/std/crypto.zig +3 -3
- package/std/debug/Dwarf.zig +1 -1
- package/std/debug.zig +6 -4
- package/std/elf.zig +1 -1
- package/std/enums.zig +1 -1
- package/std/fmt/parse_float/decimal.zig +1 -1
- package/std/fmt.zig +5 -1
- package/std/hash/Adler32.zig +3 -3
- package/std/hash/benchmark.zig +2 -2
- package/std/hash/wyhash.zig +1 -1
- package/std/heap/debug_allocator.zig +1 -1
- package/std/heap/memory_pool.zig +34 -197
- package/std/heap.zig +0 -7
- package/std/http.zig +1 -1
- package/std/json/static.zig +2 -2
- package/std/math/big/int.zig +3 -3
- package/std/math/nextafter.zig +1 -2
- package/std/math/powi.zig +2 -3
- package/std/math/signbit.zig +0 -1
- package/std/math.zig +12 -18
- package/std/mem.zig +9 -8
- package/std/meta.zig +1 -1
- package/std/multi_array_list.zig +24 -0
- package/std/os/emscripten.zig +2 -2
- package/std/os/linux.zig +4 -4
- package/std/os/uefi/hii.zig +1 -1
- package/std/tar/Writer.zig +39 -33
- package/std/tar.zig +8 -4
- package/std/unicode.zig +13 -8
- package/std/zig/Ast/Render.zig +1 -25
- package/std/zig/Ast.zig +5 -28
- package/std/zig/AstGen.zig +75 -184
- package/std/zig/AstRlAnnotate.zig +1 -11
- package/std/zig/AstSmith.zig +5 -11
- package/std/zig/LibCInstallation.zig +1 -1
- package/std/zig/Parse.zig +4 -69
- package/std/zig/TokenSmith.zig +0 -6
- package/std/zig/WindowsSdk.zig +1 -1
- package/std/zig/Zir.zig +0 -54
- package/std/zig/ZonGen.zig +0 -1
- package/std/zig/llvm/Builder.zig +5 -9
- package/std/zig/tokenizer.zig +4 -43
- package/std/zig.zig +0 -2
|
@@ -100,7 +100,7 @@ test "p384 public key is the neutral element (public verification)" {
|
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
test "p384 field element non-canonical encoding" {
|
|
103
|
-
const s
|
|
103
|
+
const s: [48]u8 = @splat(0xff);
|
|
104
104
|
try testing.expectError(error.NonCanonical, P384.Fe.fromBytes(s, .little));
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -113,8 +113,8 @@ test "p384 neutral element decoding" {
|
|
|
113
113
|
test "p384 double base multiplication" {
|
|
114
114
|
const p1 = P384.basePoint;
|
|
115
115
|
const p2 = P384.basePoint.dbl();
|
|
116
|
-
const s1
|
|
117
|
-
const s2
|
|
116
|
+
const s1: [48]u8 = @splat(0x01);
|
|
117
|
+
const s2: [48]u8 = @splat(0x02);
|
|
118
118
|
const pr1 = try P384.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
119
119
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
120
120
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -123,8 +123,8 @@ test "p384 double base multiplication" {
|
|
|
123
123
|
test "p384 double base multiplication with large scalars" {
|
|
124
124
|
const p1 = P384.basePoint;
|
|
125
125
|
const p2 = P384.basePoint.dbl();
|
|
126
|
-
const s1
|
|
127
|
-
const s2
|
|
126
|
+
const s1: [48]u8 = @splat(0xee);
|
|
127
|
+
const s2: [48]u8 = @splat(0xdd);
|
|
128
128
|
const pr1 = try P384.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
129
129
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
130
130
|
try testing.expect(pr1.equivalent(pr2));
|
|
@@ -109,7 +109,7 @@ test "secp256k1 public key is the neutral element (public verification)" {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
test "secp256k1 field element non-canonical encoding" {
|
|
112
|
-
const s
|
|
112
|
+
const s: [32]u8 = @splat(0xff);
|
|
113
113
|
try testing.expectError(error.NonCanonical, Secp256k1.Fe.fromBytes(s, .little));
|
|
114
114
|
}
|
|
115
115
|
|
|
@@ -122,8 +122,8 @@ test "secp256k1 neutral element decoding" {
|
|
|
122
122
|
test "secp256k1 double base multiplication" {
|
|
123
123
|
const p1 = Secp256k1.basePoint;
|
|
124
124
|
const p2 = Secp256k1.basePoint.dbl();
|
|
125
|
-
const s1
|
|
126
|
-
const s2
|
|
125
|
+
const s1: [32]u8 = @splat(0x01);
|
|
126
|
+
const s2: [32]u8 = @splat(0x02);
|
|
127
127
|
const pr1 = try Secp256k1.mulDoubleBasePublic(p1, s1, p2, s2, .little);
|
|
128
128
|
const pr2 = (try p1.mul(s1, .little)).add(try p2.mul(s2, .little));
|
|
129
129
|
try testing.expect(pr1.equivalent(pr2));
|
package/std/crypto/salsa20.zig
CHANGED
|
@@ -384,7 +384,7 @@ pub const XSalsa20Poly1305 = struct {
|
|
|
384
384
|
pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, k: [key_length]u8) void {
|
|
385
385
|
debug.assert(c.len == m.len);
|
|
386
386
|
const extended = extend(rounds, k, npub);
|
|
387
|
-
var block0
|
|
387
|
+
var block0: [64]u8 = @splat(0);
|
|
388
388
|
const mlen0 = @min(32, m.len);
|
|
389
389
|
@memcpy(block0[32..][0..mlen0], m[0..mlen0]);
|
|
390
390
|
Salsa20.xor(block0[0..], block0[0..], 0, extended.key, extended.nonce);
|
|
@@ -408,7 +408,7 @@ pub const XSalsa20Poly1305 = struct {
|
|
|
408
408
|
pub fn decrypt(m: []u8, c: []const u8, tag: [tag_length]u8, ad: []const u8, npub: [nonce_length]u8, k: [key_length]u8) AuthenticationError!void {
|
|
409
409
|
debug.assert(c.len == m.len);
|
|
410
410
|
const extended = extend(rounds, k, npub);
|
|
411
|
-
var block0
|
|
411
|
+
var block0: [64]u8 = @splat(0);
|
|
412
412
|
const mlen0 = @min(32, c.len);
|
|
413
413
|
@memcpy(block0[32..][0..mlen0], c[0..mlen0]);
|
|
414
414
|
Salsa20.xor(block0[0..], block0[0..], 0, extended.key, extended.nonce);
|
|
@@ -489,7 +489,7 @@ pub const Box = struct {
|
|
|
489
489
|
/// Compute a secret suitable for `secretbox` given a recipient's public key and a sender's secret key.
|
|
490
490
|
pub fn createSharedSecret(public_key: [public_length]u8, secret_key: [secret_length]u8) (IdentityElementError || WeakPublicKeyError)![shared_length]u8 {
|
|
491
491
|
const p = try X25519.scalarmult(secret_key, public_key);
|
|
492
|
-
const zero
|
|
492
|
+
const zero: [16]u8 = @splat(0);
|
|
493
493
|
return SalsaImpl(20).hsalsa(zero, p);
|
|
494
494
|
}
|
|
495
495
|
|
|
@@ -559,15 +559,15 @@ const htest = @import("test.zig");
|
|
|
559
559
|
test "(x)salsa20" {
|
|
560
560
|
if (builtin.cpu.has(.riscv, .v) and builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/24299
|
|
561
561
|
|
|
562
|
-
const key
|
|
563
|
-
const nonce
|
|
564
|
-
const msg
|
|
562
|
+
const key: [32]u8 = @splat(0x69);
|
|
563
|
+
const nonce: [8]u8 = @splat(0x42);
|
|
564
|
+
const msg: [20]u8 = @splat(0);
|
|
565
565
|
var c: [msg.len]u8 = undefined;
|
|
566
566
|
|
|
567
567
|
Salsa20.xor(&c, msg[0..], 0, key, nonce);
|
|
568
568
|
try htest.assertEqual("30ff9933aa6534ff5207142593cd1fca4b23bdd8", c[0..]);
|
|
569
569
|
|
|
570
|
-
const extended_nonce
|
|
570
|
+
const extended_nonce: [24]u8 = @splat(0x42);
|
|
571
571
|
XSalsa20.xor(&c, msg[0..], 0, key, extended_nonce);
|
|
572
572
|
try htest.assertEqual("b4ab7d82e750ec07644fa3281bce6cd91d4243f9", c[0..]);
|
|
573
573
|
}
|
|
@@ -637,7 +637,7 @@ test "xsalsa20poly1305 sealedbox" {
|
|
|
637
637
|
test "secretbox twoblocks" {
|
|
638
638
|
const key = [_]u8{ 0xc9, 0xc9, 0x4d, 0xcf, 0x68, 0xbe, 0x00, 0xe4, 0x7f, 0xe6, 0x13, 0x26, 0xfc, 0xc4, 0x2f, 0xd0, 0xdb, 0x93, 0x91, 0x1c, 0x09, 0x94, 0x89, 0xe1, 0x1b, 0x88, 0x63, 0x18, 0x86, 0x64, 0x8b, 0x7b };
|
|
639
639
|
const nonce = [_]u8{ 0xa4, 0x33, 0xe9, 0x0a, 0x07, 0x68, 0x6e, 0x9a, 0x2b, 0x6d, 0xd4, 0x59, 0x04, 0x72, 0x3e, 0xd3, 0x8a, 0x67, 0x55, 0xc7, 0x9e, 0x3e, 0x77, 0xdc };
|
|
640
|
-
const msg
|
|
640
|
+
const msg: [97]u8 = @splat('a');
|
|
641
641
|
var ciphertext: [msg.len + SecretBox.tag_length]u8 = undefined;
|
|
642
642
|
SecretBox.seal(&ciphertext, &msg, nonce, key);
|
|
643
643
|
try htest.assertEqual("b05760e217288ba079caa2fd57fd3701784974ffcfda20fe523b89211ad8af065a6eb37cdb29d51aca5bd75dafdd21d18b044c54bb7c526cf576c94ee8900f911ceab0147e82b667a28c52d58ceb29554ff45471224d37b03256b01c119b89ff6d36855de8138d103386dbc9d971f52261", &ciphertext);
|
package/std/crypto/sha2.zig
CHANGED
|
@@ -461,7 +461,7 @@ test "sha256 streaming" {
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
test "sha256 aligned final" {
|
|
464
|
-
var block
|
|
464
|
+
var block: [Sha256.block_length]u8 = @splat(0);
|
|
465
465
|
var out: [Sha256.digest_length]u8 = undefined;
|
|
466
466
|
|
|
467
467
|
var h = Sha256.init(.{});
|
|
@@ -833,7 +833,7 @@ test "sha512 streaming" {
|
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
test "sha512 aligned final" {
|
|
836
|
-
var block
|
|
836
|
+
var block: [Sha512.block_length]u8 = @splat(0);
|
|
837
837
|
var out: [Sha512.digest_length]u8 = undefined;
|
|
838
838
|
|
|
839
839
|
var h = Sha512.init(.{});
|
package/std/crypto/sha3.zig
CHANGED
|
@@ -543,7 +543,7 @@ test "sha3-256 streaming" {
|
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
test "sha3-256 aligned final" {
|
|
546
|
-
var block
|
|
546
|
+
var block: [Sha3_256.block_length]u8 = @splat(0);
|
|
547
547
|
var out: [Sha3_256.digest_length]u8 = undefined;
|
|
548
548
|
|
|
549
549
|
var h = Sha3_256.init(.{});
|
|
@@ -616,7 +616,7 @@ test "sha3-512 streaming" {
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
test "sha3-512 aligned final" {
|
|
619
|
-
var block
|
|
619
|
+
var block: [Sha3_512.block_length]u8 = @splat(0);
|
|
620
620
|
var out: [Sha3_512.digest_length]u8 = undefined;
|
|
621
621
|
|
|
622
622
|
var h = Sha3_512.init(.{});
|
package/std/crypto/siphash.zig
CHANGED
|
@@ -91,7 +91,7 @@ fn SipHashStateless(comptime T: type, comptime c_rounds: usize, comptime d_round
|
|
|
91
91
|
|
|
92
92
|
self.msg_len +%= @as(u8, @truncate(b.len));
|
|
93
93
|
|
|
94
|
-
var buf
|
|
94
|
+
var buf: [8]u8 = @splat(0);
|
|
95
95
|
@memcpy(buf[0..b.len], b);
|
|
96
96
|
buf[7] = self.msg_len;
|
|
97
97
|
self.round(buf);
|
|
@@ -207,8 +207,8 @@ test "eql (vectors)" {
|
|
|
207
207
|
|
|
208
208
|
test compare {
|
|
209
209
|
const expectEqual = std.testing.expectEqual;
|
|
210
|
-
var a
|
|
211
|
-
var b
|
|
210
|
+
var a: [32]u8 = @splat(10);
|
|
211
|
+
var b: [32]u8 = @splat(10);
|
|
212
212
|
try expectEqual(compare(u8, &a, &b, .big), .eq);
|
|
213
213
|
try expectEqual(compare(u8, &a, &b, .little), .eq);
|
|
214
214
|
a[31] = 1;
|
|
@@ -228,7 +228,7 @@ test "add and sub" {
|
|
|
228
228
|
var a: [len]u8 = undefined;
|
|
229
229
|
var b: [len]u8 = undefined;
|
|
230
230
|
var c: [len]u8 = undefined;
|
|
231
|
-
const zero
|
|
231
|
+
const zero: [len]u8 = @splat(0);
|
|
232
232
|
var iterations: usize = 100;
|
|
233
233
|
while (iterations != 0) : (iterations -= 1) {
|
|
234
234
|
io.random(&a);
|
|
@@ -262,7 +262,8 @@ test classify {
|
|
|
262
262
|
declassify(&out);
|
|
263
263
|
|
|
264
264
|
// Comparing public data in non-constant time is acceptable.
|
|
265
|
-
|
|
265
|
+
const zeroes: [out.len]u8 = @splat(0);
|
|
266
|
+
try expect(!std.mem.eql(u8, &out, &zeroes));
|
|
266
267
|
|
|
267
268
|
// Comparing secret data must be done in constant time. The result
|
|
268
269
|
// is going to be considered as secret as well.
|
|
@@ -375,7 +375,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client
|
|
|
375
375
|
const auth_tag = record_decoder.array(P.AEAD.tag_length).*;
|
|
376
376
|
const nonce = nonce: {
|
|
377
377
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
378
|
-
const pad
|
|
378
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
379
379
|
const operand: V = pad ++ @as([8]u8, @bitCast(big(read_seq)));
|
|
380
380
|
break :nonce @as(V, pv.server_handshake_iv) ^ operand;
|
|
381
381
|
};
|
|
@@ -415,7 +415,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client
|
|
|
415
415
|
comptime std.math.shl(u64, std.math.maxInt(u64), 8 * P.record_iv_length);
|
|
416
416
|
const nonce: [P.AEAD.nonce_length]u8 = nonce: {
|
|
417
417
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
418
|
-
const pad
|
|
418
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
419
419
|
const operand: V = pad ++ @as([8]u8, @bitCast(big(masked_read_seq)));
|
|
420
420
|
break :nonce @as(V, pv.app_cipher.server_write_IV ++ record_iv) ^ operand;
|
|
421
421
|
};
|
|
@@ -539,7 +539,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client
|
|
|
539
539
|
const p = &@field(handshake_cipher, @tagName(tag.with()));
|
|
540
540
|
const P = @TypeOf(p.*).A;
|
|
541
541
|
const hello_hash = p.transcript_hash.peek();
|
|
542
|
-
const zeroes
|
|
542
|
+
const zeroes: [P.Hash.digest_length]u8 = @splat(0);
|
|
543
543
|
const early_secret = P.Hkdf.extract(&[1]u8{0}, &zeroes);
|
|
544
544
|
const empty_hash = tls.emptyHash(P.Hash);
|
|
545
545
|
p.version = .{ .tls_1_3 = undefined };
|
|
@@ -791,7 +791,7 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client
|
|
|
791
791
|
const pv = &p.version.tls_1_2;
|
|
792
792
|
const nonce: [P.AEAD.nonce_length]u8 = nonce: {
|
|
793
793
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
794
|
-
const pad
|
|
794
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
795
795
|
const operand: V = pad ++ @as([8]u8, @bitCast(big(write_seq)));
|
|
796
796
|
break :nonce @as(V, pv.app_cipher.client_write_IV ++ pv.app_cipher.client_salt) ^ operand;
|
|
797
797
|
};
|
|
@@ -832,8 +832,9 @@ pub fn init(input: *Reader, output: *Writer, options: Options) InitError!Client
|
|
|
832
832
|
}
|
|
833
833
|
switch (handshake_cipher) {
|
|
834
834
|
inline else => |*p| {
|
|
835
|
+
const pad: [64]u8 = @splat(' ');
|
|
835
836
|
try main_cert_pub_key.verifySignature(&hsd, &.{
|
|
836
|
-
|
|
837
|
+
pad ++ "TLS 1.3, server CertificateVerify\x00",
|
|
837
838
|
&p.transcript_hash.peek(),
|
|
838
839
|
});
|
|
839
840
|
p.transcript_hash.update(wrapped_handshake);
|
|
@@ -1066,7 +1067,7 @@ fn prepareCiphertextRecord(
|
|
|
1066
1067
|
ciphertext_end += auth_tag.len;
|
|
1067
1068
|
const nonce = nonce: {
|
|
1068
1069
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
1069
|
-
const pad
|
|
1070
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
1070
1071
|
const operand: V = pad ++ mem.toBytes(big(c.write_seq));
|
|
1071
1072
|
break :nonce @as(V, pv.client_iv) ^ operand;
|
|
1072
1073
|
};
|
|
@@ -1103,7 +1104,7 @@ fn prepareCiphertextRecord(
|
|
|
1103
1104
|
ciphertext_end += P.record_iv_length;
|
|
1104
1105
|
const nonce: [P.AEAD.nonce_length]u8 = nonce: {
|
|
1105
1106
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
1106
|
-
const pad
|
|
1107
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
1107
1108
|
const operand: V = pad ++ @as([8]u8, @bitCast(big(c.write_seq)));
|
|
1108
1109
|
break :nonce @as(V, pv.client_write_IV ++ pv.client_salt) ^ operand;
|
|
1109
1110
|
};
|
|
@@ -1185,7 +1186,7 @@ fn readIndirect(c: *Client) Reader.Error!usize {
|
|
|
1185
1186
|
const auth_tag = (input.takeArray(P.AEAD.tag_length) catch unreachable).*; // already peeked
|
|
1186
1187
|
const nonce = nonce: {
|
|
1187
1188
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
1188
|
-
const pad
|
|
1189
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
1189
1190
|
const operand: V = pad ++ mem.toBytes(big(c.read_seq));
|
|
1190
1191
|
break :nonce @as(V, pv.server_iv) ^ operand;
|
|
1191
1192
|
};
|
|
@@ -1211,7 +1212,7 @@ fn readIndirect(c: *Client) Reader.Error!usize {
|
|
|
1211
1212
|
comptime std.math.shl(u64, std.math.maxInt(u64), 8 * P.record_iv_length);
|
|
1212
1213
|
const nonce: [P.AEAD.nonce_length]u8 = nonce: {
|
|
1213
1214
|
const V = @Vector(P.AEAD.nonce_length, u8);
|
|
1214
|
-
const pad
|
|
1215
|
+
const pad: [P.AEAD.nonce_length - 8]u8 = @splat(0);
|
|
1215
1216
|
const operand: V = pad ++ @as([8]u8, @bitCast(big(masked_read_seq)));
|
|
1216
1217
|
break :nonce @as(V, pv.server_write_IV ++ record_iv) ^ operand;
|
|
1217
1218
|
};
|
package/std/crypto.zig
CHANGED
|
@@ -394,7 +394,7 @@ test "issue #4532: no index out of bounds" {
|
|
|
394
394
|
};
|
|
395
395
|
|
|
396
396
|
inline for (types) |Hasher| {
|
|
397
|
-
var block
|
|
397
|
+
var block: [Hasher.block_length]u8 = @splat('#');
|
|
398
398
|
var out1: [Hasher.digest_length]u8 = undefined;
|
|
399
399
|
var out2: [Hasher.digest_length]u8 = undefined;
|
|
400
400
|
const h0 = Hasher.init(.{});
|
|
@@ -417,8 +417,8 @@ pub fn secureZero(comptime T: type, s: []volatile T) void {
|
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
test secureZero {
|
|
420
|
-
var a
|
|
421
|
-
var b
|
|
420
|
+
var a: [8]u8 = @splat(0xFE);
|
|
421
|
+
var b: [8]u8 = @splat(0xFE);
|
|
422
422
|
|
|
423
423
|
@memset(&a, 0);
|
|
424
424
|
secureZero(u8, &b);
|
package/std/debug/Dwarf.zig
CHANGED
package/std/debug.zig
CHANGED
|
@@ -1381,7 +1381,7 @@ test printLineFromFile {
|
|
|
1381
1381
|
try writer.flush();
|
|
1382
1382
|
|
|
1383
1383
|
try printLineFromFile(io, output_stream, .{ .file_name = path, .line = 2, .column = 0 });
|
|
1384
|
-
try expectEqualStrings((
|
|
1384
|
+
try expectEqualStrings(&@as([overlap]u8, @splat('a')) ++ "\n", aw.written());
|
|
1385
1385
|
aw.clearRetainingCapacity();
|
|
1386
1386
|
}
|
|
1387
1387
|
{
|
|
@@ -1395,7 +1395,7 @@ test printLineFromFile {
|
|
|
1395
1395
|
try writer.splatByteAll('a', std.heap.page_size_max);
|
|
1396
1396
|
|
|
1397
1397
|
try printLineFromFile(io, output_stream, .{ .file_name = path, .line = 1, .column = 0 });
|
|
1398
|
-
try expectEqualStrings((
|
|
1398
|
+
try expectEqualStrings(&@as([std.heap.page_size_max]u8, @splat('a')) ++ "\n", aw.written());
|
|
1399
1399
|
aw.clearRetainingCapacity();
|
|
1400
1400
|
}
|
|
1401
1401
|
{
|
|
@@ -1410,14 +1410,16 @@ test printLineFromFile {
|
|
|
1410
1410
|
|
|
1411
1411
|
try expectError(error.EndOfStream, printLineFromFile(io, output_stream, .{ .file_name = path, .line = 2, .column = 0 }));
|
|
1412
1412
|
|
|
1413
|
+
const many_a: [3 * std.heap.page_size_max]u8 = @splat('a');
|
|
1414
|
+
|
|
1413
1415
|
try printLineFromFile(io, output_stream, .{ .file_name = path, .line = 1, .column = 0 });
|
|
1414
|
-
try expectEqualStrings(
|
|
1416
|
+
try expectEqualStrings(&many_a ++ "\n", aw.written());
|
|
1415
1417
|
aw.clearRetainingCapacity();
|
|
1416
1418
|
|
|
1417
1419
|
try writer.writeAll("a\na");
|
|
1418
1420
|
|
|
1419
1421
|
try printLineFromFile(io, output_stream, .{ .file_name = path, .line = 1, .column = 0 });
|
|
1420
|
-
try expectEqualStrings(
|
|
1422
|
+
try expectEqualStrings(&many_a ++ "a\n", aw.written());
|
|
1421
1423
|
aw.clearRetainingCapacity();
|
|
1422
1424
|
|
|
1423
1425
|
try printLineFromFile(io, output_stream, .{ .file_name = path, .line = 2, .column = 0 });
|
package/std/elf.zig
CHANGED
|
@@ -3054,7 +3054,7 @@ pub const ar_hdr = extern struct {
|
|
|
3054
3054
|
fn genSpecialMemberName(comptime name: []const u8) *const [16]u8 {
|
|
3055
3055
|
assert(name.len <= 16);
|
|
3056
3056
|
const padding = 16 - name.len;
|
|
3057
|
-
return name ++
|
|
3057
|
+
return name ++ @as([padding]u8, @splat(0x20));
|
|
3058
3058
|
}
|
|
3059
3059
|
|
|
3060
3060
|
// Archive files start with the ARMAG identifying string. Then follows a
|
package/std/enums.zig
CHANGED
|
@@ -166,7 +166,7 @@ pub fn directEnumArrayDefault(
|
|
|
166
166
|
init_values: EnumFieldStruct(E, Data, default),
|
|
167
167
|
) [directEnumArrayLen(E, max_unused_slots)]Data {
|
|
168
168
|
const len = comptime directEnumArrayLen(E, max_unused_slots);
|
|
169
|
-
var result: [len]Data =
|
|
169
|
+
var result: [len]Data = @splat(default orelse undefined);
|
|
170
170
|
inline for (@typeInfo(@TypeOf(init_values)).@"struct".fields) |f| {
|
|
171
171
|
const enum_value = @field(E, f.name);
|
|
172
172
|
const index = @as(usize, @intCast(@intFromEnum(enum_value)));
|
package/std/fmt.zig
CHANGED
|
@@ -1194,8 +1194,12 @@ test bytesToHex {
|
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
1196
|
test hexToBytes {
|
|
1197
|
+
const repeated: []const u8 = repeated: {
|
|
1198
|
+
const buf: [32][2]u8 = @splat("90".*);
|
|
1199
|
+
break :repeated @ptrCast(&buf);
|
|
1200
|
+
};
|
|
1197
1201
|
var buf: [32]u8 = undefined;
|
|
1198
|
-
try expectFmt(
|
|
1202
|
+
try expectFmt(repeated, "{X}", .{try hexToBytes(&buf, repeated)});
|
|
1199
1203
|
try expectFmt("ABCD", "{X}", .{try hexToBytes(&buf, "ABCD")});
|
|
1200
1204
|
try expectFmt("", "{X}", .{try hexToBytes(&buf, "")});
|
|
1201
1205
|
try std.testing.expectError(error.InvalidCharacter, hexToBytes(&buf, "012Z"));
|
package/std/hash/Adler32.zig
CHANGED
|
@@ -88,15 +88,15 @@ test "sanity" {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
test "long" {
|
|
91
|
-
const long1
|
|
91
|
+
const long1: [1024]u8 = @splat(1);
|
|
92
92
|
try testing.expectEqual(@as(u32, 0x06780401), hash(long1[0..]));
|
|
93
93
|
|
|
94
|
-
const long2
|
|
94
|
+
const long2: [1025]u8 = @splat(1);
|
|
95
95
|
try testing.expectEqual(@as(u32, 0x0a7a0402), hash(long2[0..]));
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
test "very long" {
|
|
99
|
-
const long
|
|
99
|
+
const long: [5553]u8 = @splat(1);
|
|
100
100
|
try testing.expectEqual(@as(u32, 0x707f15b2), hash(long[0..]));
|
|
101
101
|
}
|
|
102
102
|
|
package/std/hash/benchmark.zig
CHANGED
|
@@ -93,13 +93,13 @@ const hashes = [_]Hash{
|
|
|
93
93
|
.ty = hash.SipHash64(1, 3),
|
|
94
94
|
.name = "siphash64",
|
|
95
95
|
.has_crypto_api = true,
|
|
96
|
-
.init_u8s =
|
|
96
|
+
.init_u8s = &@as([16]u8, @splat(0)),
|
|
97
97
|
},
|
|
98
98
|
Hash{
|
|
99
99
|
.ty = hash.SipHash128(1, 3),
|
|
100
100
|
.name = "siphash128",
|
|
101
101
|
.has_crypto_api = true,
|
|
102
|
-
.init_u8s =
|
|
102
|
+
.init_u8s = &@as([16]u8, @splat(0)),
|
|
103
103
|
},
|
|
104
104
|
};
|
|
105
105
|
|
package/std/hash/wyhash.zig
CHANGED
|
@@ -164,7 +164,7 @@ pub fn DebugAllocator(comptime config: Config) type {
|
|
|
164
164
|
return struct {
|
|
165
165
|
backing_allocator: Allocator = std.heap.page_allocator,
|
|
166
166
|
/// Tracks the active bucket, which is the one that has free slots in it.
|
|
167
|
-
buckets: [small_bucket_count]?*BucketHeader =
|
|
167
|
+
buckets: [small_bucket_count]?*BucketHeader = @splat(null),
|
|
168
168
|
large_allocations: LargeAllocTable = .empty,
|
|
169
169
|
total_requested_bytes: @TypeOf(total_requested_bytes_init) = total_requested_bytes_init,
|
|
170
170
|
requested_memory_limit: @TypeOf(requested_memory_limit_init) = requested_memory_limit_init,
|