authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 03:56:17+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 06:15:17+02:00
log5938e94196afe7551b3741a2b7121420a162f2a1
tree77177eb9e695a89390235e8298825f7f0a1ee74f
parent57c0a8c9b4eb13b4633842f0cee499243ab2d0e0
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.crypto: disable secp256k1 tests affected by an llvm 23 powerpc regression

https://codeberg.org/ziglang/zig/issues/37121

2 files changed, 22 insertions(+), 0 deletions(-)

lib/std/crypto/ecdsa.zig+3
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const crypto = std.crypto;3const crypto = std.crypto;
3const fmt = std.fmt;4const fmt = std.fmt;
...@@ -439,6 +440,8 @@ test "Basic operations over EcdsaP384Sha384" {...@@ -439,6 +440,8 @@ test "Basic operations over EcdsaP384Sha384" {
439}440}
440441
441test "Basic operations over Secp256k1" {442test "Basic operations over Secp256k1" {
443 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
444
442 const io = testing.io;445 const io = testing.io;
443 const Scheme = EcdsaSecp256k1Sha256oSha256;446 const Scheme = EcdsaSecp256k1Sha256oSha256;
444 const kp = Scheme.KeyPair.generate(io);447 const kp = Scheme.KeyPair.generate(io);
lib/std/crypto/pcurves/tests/secp256k1.zig+19
...@@ -1,3 +1,4 @@...@@ -1,3 +1,4 @@
1const builtin = @import("builtin");
1const std = @import("std");2const std = @import("std");
2const fmt = std.fmt;3const fmt = std.fmt;
3const testing = std.testing;4const testing = std.testing;
...@@ -7,6 +8,8 @@ const Secp256k1 = @import("../secp256k1.zig").Secp256k1;...@@ -7,6 +8,8 @@ const Secp256k1 = @import("../secp256k1.zig").Secp256k1;
7const lambda: u256 = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72;8const lambda: u256 = 0x5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72;
89
9test "secp256k1 ECDH key exchange" {10test "secp256k1 ECDH key exchange" {
11 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
12
10 const io = testing.io;13 const io = testing.io;
11 const dha = Secp256k1.scalar.random(io, .little);14 const dha = Secp256k1.scalar.random(io, .little);
12 const dhb = Secp256k1.scalar.random(io, .little);15 const dhb = Secp256k1.scalar.random(io, .little);
...@@ -18,6 +21,8 @@ test "secp256k1 ECDH key exchange" {...@@ -18,6 +21,8 @@ test "secp256k1 ECDH key exchange" {
18}21}
1922
20test "secp256k1 ECDH key exchange including public multiplication" {23test "secp256k1 ECDH key exchange including public multiplication" {
24 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
25
21 const io = testing.io;26 const io = testing.io;
22 const dha = Secp256k1.scalar.random(io, .little);27 const dha = Secp256k1.scalar.random(io, .little);
23 const dhb = Secp256k1.scalar.random(io, .little);28 const dhb = Secp256k1.scalar.random(io, .little);
...@@ -29,6 +34,8 @@ test "secp256k1 ECDH key exchange including public multiplication" {...@@ -29,6 +34,8 @@ test "secp256k1 ECDH key exchange including public multiplication" {
29}34}
3035
31test "secp256k1 point from affine coordinates" {36test "secp256k1 point from affine coordinates" {
37 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
38
32 const xh = "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798";39 const xh = "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798";
33 const yh = "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8";40 const yh = "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8";
34 var xs: [32]u8 = undefined;41 var xs: [32]u8 = undefined;
...@@ -40,6 +47,8 @@ test "secp256k1 point from affine coordinates" {...@@ -40,6 +47,8 @@ test "secp256k1 point from affine coordinates" {
40}47}
4148
42test "secp256k1 test vectors" {49test "secp256k1 test vectors" {
50 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
51
43 const expected = [_][]const u8{52 const expected = [_][]const u8{
44 "0000000000000000000000000000000000000000000000000000000000000000",53 "0000000000000000000000000000000000000000000000000000000000000000",
45 "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",54 "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
...@@ -81,6 +90,8 @@ test "secp256k1 test vectors - doubling" {...@@ -81,6 +90,8 @@ test "secp256k1 test vectors - doubling" {
81}90}
8291
83test "secp256k1 compressed sec1 encoding/decoding" {92test "secp256k1 compressed sec1 encoding/decoding" {
93 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
94
84 const io = testing.io;95 const io = testing.io;
85 const p = Secp256k1.random(io);96 const p = Secp256k1.random(io);
86 const s = p.toCompressedSec1();97 const s = p.toCompressedSec1();
...@@ -89,6 +100,8 @@ test "secp256k1 compressed sec1 encoding/decoding" {...@@ -89,6 +100,8 @@ test "secp256k1 compressed sec1 encoding/decoding" {
89}100}
90101
91test "secp256k1 uncompressed sec1 encoding/decoding" {102test "secp256k1 uncompressed sec1 encoding/decoding" {
103 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
104
92 const io = testing.io;105 const io = testing.io;
93 const p = Secp256k1.random(io);106 const p = Secp256k1.random(io);
94 const s = p.toUncompressedSec1();107 const s = p.toUncompressedSec1();
...@@ -104,6 +117,8 @@ test "secp256k1 public key is the neutral element" {...@@ -104,6 +117,8 @@ test "secp256k1 public key is the neutral element" {
104}117}
105118
106test "secp256k1 public key is the neutral element (public verification)" {119test "secp256k1 public key is the neutral element (public verification)" {
120 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
121
107 const io = testing.io;122 const io = testing.io;
108 const n = Secp256k1.scalar.Scalar.zero.toBytes(.little);123 const n = Secp256k1.scalar.Scalar.zero.toBytes(.little);
109 const p = Secp256k1.random(io);124 const p = Secp256k1.random(io);
...@@ -131,6 +146,8 @@ test "secp256k1 uncompressed SEC1 must not accept infinity" {...@@ -131,6 +146,8 @@ test "secp256k1 uncompressed SEC1 must not accept infinity" {
131}146}
132147
133test "secp256k1 double base multiplication" {148test "secp256k1 double base multiplication" {
149 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
150
134 const p1 = Secp256k1.basePoint;151 const p1 = Secp256k1.basePoint;
135 const p2 = Secp256k1.basePoint.dbl();152 const p2 = Secp256k1.basePoint.dbl();
136 const s1: [32]u8 = @splat(0x01);153 const s1: [32]u8 = @splat(0x01);
...@@ -141,6 +158,8 @@ test "secp256k1 double base multiplication" {...@@ -141,6 +158,8 @@ test "secp256k1 double base multiplication" {
141}158}
142159
143test "secp256k1 public multiplication" {160test "secp256k1 public multiplication" {
161 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
162
144 const io = testing.io;163 const io = testing.io;
145 const n = Secp256k1.scalar.field_order;164 const n = Secp256k1.scalar.field_order;
146 const p = Secp256k1.random(io);165 const p = Secp256k1.random(io);