authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 13:50:11+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-07 13:50:11+02:00
log26fd35ff902cb0f68ada18706e7f670b4aac3d4a
tree875b467374a2c4d223751ebd9a39ed2c20aff3b2
parent9fe22a29b34e274af4f1d67a08c7757d2d0bc1fa
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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

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

1 files changed, 16 insertions(+), 0 deletions(-)

lib/std/crypto/pcurves/tests/secp256k1.zig+16
...@@ -72,6 +72,8 @@ test "secp256k1 test vectors" {...@@ -72,6 +72,8 @@ test "secp256k1 test vectors" {
72}72}
7373
74test "secp256k1 test vectors - doubling" {74test "secp256k1 test vectors - doubling" {
75 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
76
75 const expected = [_][]const u8{77 const expected = [_][]const u8{
76 "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",78 "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
77 "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5",79 "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5",
...@@ -110,6 +112,8 @@ test "secp256k1 uncompressed sec1 encoding/decoding" {...@@ -110,6 +112,8 @@ test "secp256k1 uncompressed sec1 encoding/decoding" {
110}112}
111113
112test "secp256k1 public key is the neutral element" {114test "secp256k1 public key is the neutral element" {
115 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
116
113 const io = testing.io;117 const io = testing.io;
114 const n = Secp256k1.scalar.Scalar.zero.toBytes(.little);118 const n = Secp256k1.scalar.Scalar.zero.toBytes(.little);
115 const p = Secp256k1.random(io);119 const p = Secp256k1.random(io);
...@@ -126,17 +130,23 @@ test "secp256k1 public key is the neutral element (public verification)" {...@@ -126,17 +130,23 @@ test "secp256k1 public key is the neutral element (public verification)" {
126}130}
127131
128test "secp256k1 field element non-canonical encoding" {132test "secp256k1 field element non-canonical encoding" {
133 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
134
129 const s: [32]u8 = @splat(0xff);135 const s: [32]u8 = @splat(0xff);
130 try testing.expectError(error.NonCanonical, Secp256k1.Fe.fromBytes(s, .little));136 try testing.expectError(error.NonCanonical, Secp256k1.Fe.fromBytes(s, .little));
131}137}
132138
133test "secp256k1 neutral element decoding" {139test "secp256k1 neutral element decoding" {
140 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
141
134 try testing.expectError(error.InvalidEncoding, Secp256k1.fromAffineCoordinates(.{ .x = Secp256k1.Fe.zero, .y = Secp256k1.Fe.zero }));142 try testing.expectError(error.InvalidEncoding, Secp256k1.fromAffineCoordinates(.{ .x = Secp256k1.Fe.zero, .y = Secp256k1.Fe.zero }));
135 try testing.expectError(error.InvalidEncoding, Secp256k1.fromAffineCoordinates(.{ .x = Secp256k1.Fe.zero, .y = Secp256k1.Fe.one }));143 try testing.expectError(error.InvalidEncoding, Secp256k1.fromAffineCoordinates(.{ .x = Secp256k1.Fe.zero, .y = Secp256k1.Fe.one }));
136 try testing.expectError(error.IdentityElement, Secp256k1.identityElement.rejectIdentity());144 try testing.expectError(error.IdentityElement, Secp256k1.identityElement.rejectIdentity());
137}145}
138146
139test "secp256k1 uncompressed SEC1 must not accept infinity" {147test "secp256k1 uncompressed SEC1 must not accept infinity" {
148 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
149
140 var buf: [65]u8 = @splat(0);150 var buf: [65]u8 = @splat(0);
141 buf[0] = 0x04;151 buf[0] = 0x04;
142 buf[64] = 0x01;152 buf[64] = 0x01;
...@@ -177,6 +187,8 @@ test "secp256k1 public multiplication" {...@@ -177,6 +187,8 @@ test "secp256k1 public multiplication" {
177}187}
178188
179test "secp256k1 scalar split" {189test "secp256k1 scalar split" {
190 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
191
180 const io = testing.io;192 const io = testing.io;
181 const n = Secp256k1.scalar.field_order;193 const n = Secp256k1.scalar.field_order;
182 inline for (.{ .little, .big }) |endian| {194 inline for (.{ .little, .big }) |endian| {
...@@ -193,6 +205,8 @@ test "secp256k1 scalar split" {...@@ -193,6 +205,8 @@ test "secp256k1 scalar split" {
193}205}
194206
195test "secp256k1 scalar inverse" {207test "secp256k1 scalar inverse" {
208 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
209
196 const expected = "08d0684a0fe8ea978b68a29e4b4ffdbd19eeb59db25301cf23ecbe568e1f9822";210 const expected = "08d0684a0fe8ea978b68a29e4b4ffdbd19eeb59db25301cf23ecbe568e1f9822";
197 var out: [32]u8 = undefined;211 var out: [32]u8 = undefined;
198 _ = try std.fmt.hexToBytes(&out, expected);212 _ = try std.fmt.hexToBytes(&out, expected);
...@@ -206,6 +220,8 @@ test "secp256k1 scalar inverse" {...@@ -206,6 +220,8 @@ test "secp256k1 scalar inverse" {
206}220}
207221
208test "secp256k1 scalar parity" {222test "secp256k1 scalar parity" {
223 if (builtin.zig_backend == .stage2_llvm and builtin.target.cpu.arch.isPowerpc64()) return error.SkipZigTest; // https://codeberg.org/ziglang/zig/issues/37121
224
209 try std.testing.expect(Secp256k1.scalar.Scalar.zero.isOdd() == false);225 try std.testing.expect(Secp256k1.scalar.Scalar.zero.isOdd() == false);
210 try std.testing.expect(Secp256k1.scalar.Scalar.one.isOdd());226 try std.testing.expect(Secp256k1.scalar.Scalar.one.isOdd());
211 try std.testing.expect(Secp256k1.scalar.Scalar.one.dbl().isOdd() == false);227 try std.testing.expect(Secp256k1.scalar.Scalar.one.dbl().isOdd() == false);