also looking at this
Track latest Zig 0.17-dev OptimizeMode API
#8
11 files
+51
-51
| @@ -13,13 +13,13 @@ jobs: | ||
| 13 | 13 | strategy: |
| 14 | 14 | matrix: |
| 15 | 15 | os: [ubuntu-latest, macos-latest] |
| 16 | zig-version: ['0.17.0-dev.1441+d5181a9c9'] | |
| 16 | zig-version: ['0.17.0-dev.1476+91a29d707'] | |
| 17 | 17 | fail-fast: false |
| 18 | 18 | steps: |
| 19 | 19 | - uses: actions/checkout@v6 |
| 20 | 20 | - uses: mlugg/setup-zig@v2 |
| 21 | 21 | with: |
| 22 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 22 | version: '0.17.0-dev.1476+91a29d707' | |
| 23 | 23 | - run: zig build |
| 24 | 24 | - run: zig build test |
| 25 | 25 | |
| @@ -30,5 +30,5 @@ jobs: | ||
| 30 | 30 | - uses: actions/checkout@v6 |
| 31 | 31 | - uses: mlugg/setup-zig@v2 |
| 32 | 32 | with: |
| 33 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 33 | version: '0.17.0-dev.1476+91a29d707' | |
| 34 | 34 | - run: zig fmt --check . |
| @@ -15,7 +15,7 @@ jobs: | ||
| 15 | 15 | - uses: actions/checkout@v6 |
| 16 | 16 | - uses: mlugg/setup-zig@v2 |
| 17 | 17 | with: |
| 18 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 18 | version: '0.17.0-dev.1476+91a29d707' | |
| 19 | 19 | - run: zig build bench -Doptimize=ReleaseFast -Dcpu=native |
| 20 | 20 | - run: zig build test |
| 21 | 21 | - name: Interop tests (in-process) |
| @@ -28,7 +28,7 @@ jobs: | ||
| 28 | 28 | - uses: actions/checkout@v6 |
| 29 | 29 | - uses: mlugg/setup-zig@v2 |
| 30 | 30 | with: |
| 31 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 31 | version: '0.17.0-dev.1476+91a29d707' | |
| 32 | 32 | - run: zig build bench -Doptimize=ReleaseFast -Dcpu=native |
| 33 | 33 | - run: zig build test |
| 34 | 34 | |
| @@ -39,7 +39,7 @@ jobs: | ||
| 39 | 39 | - uses: actions/checkout@v6 |
| 40 | 40 | - uses: mlugg/setup-zig@v2 |
| 41 | 41 | with: |
| 42 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 42 | version: '0.17.0-dev.1476+91a29d707' | |
| 43 | 43 | - run: zig build -Dfuzz=true fuzz |
| 44 | 44 | |
| 45 | 45 | testssl: |
| @@ -50,7 +50,7 @@ jobs: | ||
| 50 | 50 | - uses: actions/checkout@v6 |
| 51 | 51 | - uses: mlugg/setup-zig@v2 |
| 52 | 52 | with: |
| 53 | version: '0.17.0-dev.1441+d5181a9c9' | |
| 53 | version: '0.17.0-dev.1476+91a29d707' | |
| 54 | 54 | - name: Install testssl.sh |
| 55 | 55 | run: | |
| 56 | 56 | git clone --depth 1 https://github.com/drwetter/testssl.sh.git /tmp/testssl.sh |
| @@ -5,7 +5,7 @@ const crypto = std.crypto; | ||
| 5 | 5 | const tls = ; |
| 6 | 6 | const ecdsa = tls.ecdsa_p256; |
| 7 | 7 | |
| 8 | const crypto_iterations: u32 = if (.mode == .Debug) 1_000 else 100_000; | |
| 8 | const crypto_iterations: u32 = if (.mode == .debug) 1_000 else 100_000; | |
| 9 | 9 | const handshake_record_len: usize = 2048; |
| 10 | 10 | |
| 11 | 11 | pub fn run( |
| @@ -6,12 +6,12 @@ const certs = ; | ||
| 6 | 6 | const crypto_bench = ; |
| 7 | 7 | |
| 8 | 8 | pub const std_options: std.Options = .{ |
| 9 | .log_level = if (builtin.mode == .Debug) .warn else .err, | |
| 9 | .log_level = if (builtin.mode == .debug) .warn else .err, | |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | const iterations: u32 = if (builtin.mode == .Debug) 100 else 10_000; | |
| 12 | const iterations: u32 = if (builtin.mode == .debug) 100 else 10_000; | |
| 13 | 13 | const transfer_bytes: usize = 16 * 1024; |
| 14 | const transfer_iterations: u32 = if (builtin.mode == .Debug) 50 else 5_000; | |
| 14 | const transfer_iterations: u32 = if (builtin.mode == .debug) 50 else 5_000; | |
| 15 | 15 | |
| 16 | 16 | const bench_groups = &[_]tls.config.NamedGroup{.x25519}; |
| 17 | 17 | |
| @@ -90,7 +90,7 @@ pub fn build(b: *std.Build) void { | ||
| 90 | 90 | const record_fuzz_mod = b.createModule(.{ |
| 91 | 91 | .root_source_file = b.path("fuzz/record_fuzz.zig"), |
| 92 | 92 | .target = target, |
| 93 | .optimize = .ReleaseFast, | |
| 93 | .optimize = .fast, | |
| 94 | 94 | }); |
| 95 | 95 | record_fuzz_mod.addImport("tls", tls_module); |
| 96 | 96 | const record_fuzz = b.addExecutable(.{ |
| @@ -103,7 +103,7 @@ pub fn build(b: *std.Build) void { | ||
| 103 | 103 | const handshake_fuzz_mod = b.createModule(.{ |
| 104 | 104 | .root_source_file = b.path("fuzz/handshake_fuzz.zig"), |
| 105 | 105 | .target = target, |
| 106 | .optimize = .ReleaseFast, | |
| 106 | .optimize = .fast, | |
| 107 | 107 | }); |
| 108 | 108 | handshake_fuzz_mod.addImport("tls", tls_module); |
| 109 | 109 | const handshake_fuzz = b.addExecutable(.{ |
| @@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { | ||
| 110 | 110 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 111 | 111 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 112 | 112 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 113 | @setRuntimeSafety(mode == .Debug); | |
| 113 | @setRuntimeSafety(mode == .debug); | |
| 114 | 114 | |
| 115 | 115 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 116 | 116 | out1.* = @as(u64, @truncate(x)); |
| @@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { | ||
| 129 | 129 | /// Output Bounds: |
| 130 | 130 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 131 | 131 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 132 | @setRuntimeSafety(mode == .Debug); | |
| 132 | @setRuntimeSafety(mode == .debug); | |
| 133 | 133 | |
| 134 | 134 | const mask = 0 -% @as(u64, arg1); |
| 135 | 135 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| @@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { | ||
| 145 | 145 | /// 0 ≤ eval out1 < m |
| 146 | 146 | /// |
| 147 | 147 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 148 | @setRuntimeSafety(mode == .Debug); | |
| 148 | @setRuntimeSafety(mode == .debug); | |
| 149 | 149 | |
| 150 | 150 | const x1 = (arg1[1]); |
| 151 | 151 | const x2 = (arg1[2]); |
| @@ -437,7 +437,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 437 | 437 | /// 0 ≤ eval out1 < m |
| 438 | 438 | /// |
| 439 | 439 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 440 | @setRuntimeSafety(mode == .Debug); | |
| 440 | @setRuntimeSafety(mode == .debug); | |
| 441 | 441 | |
| 442 | 442 | const x1 = (arg1[1]); |
| 443 | 443 | const x2 = (arg1[2]); |
| @@ -730,7 +730,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl | ||
| 730 | 730 | /// 0 ≤ eval out1 < m |
| 731 | 731 | /// |
| 732 | 732 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 733 | @setRuntimeSafety(mode == .Debug); | |
| 733 | @setRuntimeSafety(mode == .debug); | |
| 734 | 734 | |
| 735 | 735 | var x1: u64 = undefined; |
| 736 | 736 | var x2: u1 = undefined; |
| @@ -783,7 +783,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 783 | 783 | /// 0 ≤ eval out1 < m |
| 784 | 784 | /// |
| 785 | 785 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 786 | @setRuntimeSafety(mode == .Debug); | |
| 786 | @setRuntimeSafety(mode == .debug); | |
| 787 | 787 | |
| 788 | 788 | var x1: u64 = undefined; |
| 789 | 789 | var x2: u1 = undefined; |
| @@ -826,7 +826,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 826 | 826 | /// 0 ≤ eval out1 < m |
| 827 | 827 | /// |
| 828 | 828 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 829 | @setRuntimeSafety(mode == .Debug); | |
| 829 | @setRuntimeSafety(mode == .debug); | |
| 830 | 830 | |
| 831 | 831 | var x1: u64 = undefined; |
| 832 | 832 | var x2: u1 = undefined; |
| @@ -869,7 +869,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 869 | 869 | /// 0 ≤ eval out1 < m |
| 870 | 870 | /// |
| 871 | 871 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 872 | @setRuntimeSafety(mode == .Debug); | |
| 872 | @setRuntimeSafety(mode == .debug); | |
| 873 | 873 | |
| 874 | 874 | const x1 = (arg1[0]); |
| 875 | 875 | var x2: u64 = undefined; |
| @@ -1022,7 +1022,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo | ||
| 1022 | 1022 | /// 0 ≤ eval out1 < m |
| 1023 | 1023 | /// |
| 1024 | 1024 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1025 | @setRuntimeSafety(mode == .Debug); | |
| 1025 | @setRuntimeSafety(mode == .debug); | |
| 1026 | 1026 | |
| 1027 | 1027 | const x1 = (arg1[1]); |
| 1028 | 1028 | const x2 = (arg1[2]); |
| @@ -1297,7 +1297,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma | ||
| 1297 | 1297 | /// Output Bounds: |
| 1298 | 1298 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1299 | 1299 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1300 | @setRuntimeSafety(mode == .Debug); | |
| 1300 | @setRuntimeSafety(mode == .debug); | |
| 1301 | 1301 | |
| 1302 | 1302 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1303 | 1303 | out1.* = x1; |
| @@ -1315,7 +1315,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { | ||
| 1315 | 1315 | /// Output Bounds: |
| 1316 | 1316 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1317 | 1317 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1318 | @setRuntimeSafety(mode == .Debug); | |
| 1318 | @setRuntimeSafety(mode == .debug); | |
| 1319 | 1319 | |
| 1320 | 1320 | var x1: u64 = undefined; |
| 1321 | 1321 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| @@ -1343,7 +1343,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { | ||
| 1343 | 1343 | /// Output Bounds: |
| 1344 | 1344 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1345 | 1345 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1346 | @setRuntimeSafety(mode == .Debug); | |
| 1346 | @setRuntimeSafety(mode == .debug); | |
| 1347 | 1347 | |
| 1348 | 1348 | const x1 = (arg1[3]); |
| 1349 | 1349 | const x2 = (arg1[2]); |
| @@ -1452,7 +1452,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { | ||
| 1452 | 1452 | /// Output Bounds: |
| 1453 | 1453 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1454 | 1454 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1455 | @setRuntimeSafety(mode == .Debug); | |
| 1455 | @setRuntimeSafety(mode == .debug); | |
| 1456 | 1456 | |
| 1457 | 1457 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1458 | 1458 | const x2 = (@as(u64, (arg1[30])) << 48); |
| @@ -1527,7 +1527,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { | ||
| 1527 | 1527 | /// 0 ≤ eval out1 < m |
| 1528 | 1528 | /// |
| 1529 | 1529 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1530 | @setRuntimeSafety(mode == .Debug); | |
| 1530 | @setRuntimeSafety(mode == .debug); | |
| 1531 | 1531 | |
| 1532 | 1532 | out1[0] = @as(u64, 0x1); |
| 1533 | 1533 | out1[1] = 0xffffffff00000000; |
| @@ -1544,7 +1544,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { | ||
| 1544 | 1544 | /// Output Bounds: |
| 1545 | 1545 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1546 | 1546 | pub fn msat(out1: *[5]u64) void { |
| 1547 | @setRuntimeSafety(mode == .Debug); | |
| 1547 | @setRuntimeSafety(mode == .debug); | |
| 1548 | 1548 | |
| 1549 | 1549 | out1[0] = 0xffffffffffffffff; |
| 1550 | 1550 | out1[1] = 0xffffffff; |
| @@ -1582,7 +1582,7 @@ pub fn msat(out1: *[5]u64) void { | ||
| 1582 | 1582 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1583 | 1583 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1584 | 1584 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1585 | @setRuntimeSafety(mode == .Debug); | |
| 1585 | @setRuntimeSafety(mode == .debug); | |
| 1586 | 1586 | |
| 1587 | 1587 | var x1: u64 = undefined; |
| 1588 | 1588 | var x2: u1 = undefined; |
| @@ -1816,7 +1816,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ | ||
| 1816 | 1816 | /// Output Bounds: |
| 1817 | 1817 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1818 | 1818 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 1819 | @setRuntimeSafety(mode == .Debug); | |
| 1819 | @setRuntimeSafety(mode == .debug); | |
| 1820 | 1820 | |
| 1821 | 1821 | out1[0] = 0x67ffffffb8000000; |
| 1822 | 1822 | out1[1] = 0xc000000038000000; |
| @@ -110,7 +110,7 @@ fn subborrowxU64(out1: *u64, out2: *u1, arg1: u1, arg2: u64, arg3: u64) void { | ||
| 110 | 110 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 111 | 111 | /// out2: [0x0 ~> 0xffffffffffffffff] |
| 112 | 112 | fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { |
| 113 | @setRuntimeSafety(mode == .Debug); | |
| 113 | @setRuntimeSafety(mode == .debug); | |
| 114 | 114 | |
| 115 | 115 | const x = @as(u128, arg1) * @as(u128, arg2); |
| 116 | 116 | out1.* = @as(u64, @truncate(x)); |
| @@ -129,7 +129,7 @@ fn mulxU64(out1: *u64, out2: *u64, arg1: u64, arg2: u64) void { | ||
| 129 | 129 | /// Output Bounds: |
| 130 | 130 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 131 | 131 | fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { |
| 132 | @setRuntimeSafety(mode == .Debug); | |
| 132 | @setRuntimeSafety(mode == .debug); | |
| 133 | 133 | |
| 134 | 134 | const mask = 0 -% @as(u64, arg1); |
| 135 | 135 | out1.* = (mask & arg3) | ((~mask) & arg2); |
| @@ -145,7 +145,7 @@ fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void { | ||
| 145 | 145 | /// 0 ≤ eval out1 < m |
| 146 | 146 | /// |
| 147 | 147 | pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 148 | @setRuntimeSafety(mode == .Debug); | |
| 148 | @setRuntimeSafety(mode == .debug); | |
| 149 | 149 | |
| 150 | 150 | const x1 = (arg1[1]); |
| 151 | 151 | const x2 = (arg1[2]); |
| @@ -485,7 +485,7 @@ pub fn mul(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 485 | 485 | /// 0 ≤ eval out1 < m |
| 486 | 486 | /// |
| 487 | 487 | pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 488 | @setRuntimeSafety(mode == .Debug); | |
| 488 | @setRuntimeSafety(mode == .debug); | |
| 489 | 489 | |
| 490 | 490 | const x1 = (arg1[1]); |
| 491 | 491 | const x2 = (arg1[2]); |
| @@ -826,7 +826,7 @@ pub fn square(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEl | ||
| 826 | 826 | /// 0 ≤ eval out1 < m |
| 827 | 827 | /// |
| 828 | 828 | pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 829 | @setRuntimeSafety(mode == .Debug); | |
| 829 | @setRuntimeSafety(mode == .debug); | |
| 830 | 830 | |
| 831 | 831 | var x1: u64 = undefined; |
| 832 | 832 | var x2: u1 = undefined; |
| @@ -879,7 +879,7 @@ pub fn add(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 879 | 879 | /// 0 ≤ eval out1 < m |
| 880 | 880 | /// |
| 881 | 881 | pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement, arg2: MontgomeryDomainFieldElement) void { |
| 882 | @setRuntimeSafety(mode == .Debug); | |
| 882 | @setRuntimeSafety(mode == .debug); | |
| 883 | 883 | |
| 884 | 884 | var x1: u64 = undefined; |
| 885 | 885 | var x2: u1 = undefined; |
| @@ -922,7 +922,7 @@ pub fn sub(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 922 | 922 | /// 0 ≤ eval out1 < m |
| 923 | 923 | /// |
| 924 | 924 | pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 925 | @setRuntimeSafety(mode == .Debug); | |
| 925 | @setRuntimeSafety(mode == .debug); | |
| 926 | 926 | |
| 927 | 927 | var x1: u64 = undefined; |
| 928 | 928 | var x2: u1 = undefined; |
| @@ -965,7 +965,7 @@ pub fn opp(out1: *MontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldEleme | ||
| 965 | 965 | /// 0 ≤ eval out1 < m |
| 966 | 966 | /// |
| 967 | 967 | pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDomainFieldElement) void { |
| 968 | @setRuntimeSafety(mode == .Debug); | |
| 968 | @setRuntimeSafety(mode == .debug); | |
| 969 | 969 | |
| 970 | 970 | const x1 = (arg1[0]); |
| 971 | 971 | var x2: u64 = undefined; |
| @@ -1178,7 +1178,7 @@ pub fn fromMontgomery(out1: *NonMontgomeryDomainFieldElement, arg1: MontgomeryDo | ||
| 1178 | 1178 | /// 0 ≤ eval out1 < m |
| 1179 | 1179 | /// |
| 1180 | 1180 | pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDomainFieldElement) void { |
| 1181 | @setRuntimeSafety(mode == .Debug); | |
| 1181 | @setRuntimeSafety(mode == .debug); | |
| 1182 | 1182 | |
| 1183 | 1183 | const x1 = (arg1[1]); |
| 1184 | 1184 | const x2 = (arg1[2]); |
| @@ -1501,7 +1501,7 @@ pub fn toMontgomery(out1: *MontgomeryDomainFieldElement, arg1: NonMontgomeryDoma | ||
| 1501 | 1501 | /// Output Bounds: |
| 1502 | 1502 | /// out1: [0x0 ~> 0xffffffffffffffff] |
| 1503 | 1503 | pub fn nonzero(out1: *u64, arg1: [4]u64) void { |
| 1504 | @setRuntimeSafety(mode == .Debug); | |
| 1504 | @setRuntimeSafety(mode == .debug); | |
| 1505 | 1505 | |
| 1506 | 1506 | const x1 = ((arg1[0]) | ((arg1[1]) | ((arg1[2]) | (arg1[3])))); |
| 1507 | 1507 | out1.* = x1; |
| @@ -1519,7 +1519,7 @@ pub fn nonzero(out1: *u64, arg1: [4]u64) void { | ||
| 1519 | 1519 | /// Output Bounds: |
| 1520 | 1520 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1521 | 1521 | pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { |
| 1522 | @setRuntimeSafety(mode == .Debug); | |
| 1522 | @setRuntimeSafety(mode == .debug); | |
| 1523 | 1523 | |
| 1524 | 1524 | var x1: u64 = undefined; |
| 1525 | 1525 | cmovznzU64(&x1, arg1, (arg2[0]), (arg3[0])); |
| @@ -1547,7 +1547,7 @@ pub fn selectznz(out1: *[4]u64, arg1: u1, arg2: [4]u64, arg3: [4]u64) void { | ||
| 1547 | 1547 | /// Output Bounds: |
| 1548 | 1548 | /// out1: [[0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff], [0x0 ~> 0xff]] |
| 1549 | 1549 | pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { |
| 1550 | @setRuntimeSafety(mode == .Debug); | |
| 1550 | @setRuntimeSafety(mode == .debug); | |
| 1551 | 1551 | |
| 1552 | 1552 | const x1 = (arg1[3]); |
| 1553 | 1553 | const x2 = (arg1[2]); |
| @@ -1656,7 +1656,7 @@ pub fn toBytes(out1: *[32]u8, arg1: [4]u64) void { | ||
| 1656 | 1656 | /// Output Bounds: |
| 1657 | 1657 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1658 | 1658 | pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { |
| 1659 | @setRuntimeSafety(mode == .Debug); | |
| 1659 | @setRuntimeSafety(mode == .debug); | |
| 1660 | 1660 | |
| 1661 | 1661 | const x1 = (@as(u64, (arg1[31])) << 56); |
| 1662 | 1662 | const x2 = (@as(u64, (arg1[30])) << 48); |
| @@ -1731,7 +1731,7 @@ pub fn fromBytes(out1: *[4]u64, arg1: [32]u8) void { | ||
| 1731 | 1731 | /// 0 ≤ eval out1 < m |
| 1732 | 1732 | /// |
| 1733 | 1733 | pub fn setOne(out1: *MontgomeryDomainFieldElement) void { |
| 1734 | @setRuntimeSafety(mode == .Debug); | |
| 1734 | @setRuntimeSafety(mode == .debug); | |
| 1735 | 1735 | |
| 1736 | 1736 | out1[0] = 0xc46353d039cdaaf; |
| 1737 | 1737 | out1[1] = 0x4319055258e8617b; |
| @@ -1748,7 +1748,7 @@ pub fn setOne(out1: *MontgomeryDomainFieldElement) void { | ||
| 1748 | 1748 | /// Output Bounds: |
| 1749 | 1749 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1750 | 1750 | pub fn msat(out1: *[5]u64) void { |
| 1751 | @setRuntimeSafety(mode == .Debug); | |
| 1751 | @setRuntimeSafety(mode == .debug); | |
| 1752 | 1752 | |
| 1753 | 1753 | out1[0] = 0xf3b9cac2fc632551; |
| 1754 | 1754 | out1[1] = 0xbce6faada7179e84; |
| @@ -1786,7 +1786,7 @@ pub fn msat(out1: *[5]u64) void { | ||
| 1786 | 1786 | /// out4: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1787 | 1787 | /// out5: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 1788 | 1788 | pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[4]u64, arg1: u64, arg2: [5]u64, arg3: [5]u64, arg4: [4]u64, arg5: [4]u64) void { |
| 1789 | @setRuntimeSafety(mode == .Debug); | |
| 1789 | @setRuntimeSafety(mode == .debug); | |
| 1790 | 1790 | |
| 1791 | 1791 | var x1: u64 = undefined; |
| 1792 | 1792 | var x2: u1 = undefined; |
| @@ -2020,7 +2020,7 @@ pub fn divstep(out1: *u64, out2: *[5]u64, out3: *[5]u64, out4: *[4]u64, out5: *[ | ||
| 2020 | 2020 | /// Output Bounds: |
| 2021 | 2021 | /// out1: [[0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff], [0x0 ~> 0xffffffffffffffff]] |
| 2022 | 2022 | pub fn divstepPrecomp(out1: *[4]u64) void { |
| 2023 | @setRuntimeSafety(mode == .Debug); | |
| 2023 | @setRuntimeSafety(mode == .debug); | |
| 2024 | 2024 | |
| 2025 | 2025 | out1[0] = 0xd739262fb7fcfbb5; |
| 2026 | 2026 | out1[1] = 0x8ac6f75d20074414; |
| @@ -38,7 +38,7 @@ const CertKeyPair = common.CertKeyPair; | ||
| 38 | 38 | const cert = common.cert; |
| 39 | 39 | |
| 40 | 40 | const alpn = ; |
| 41 | const log = if (builtin.mode == .Debug) std.log.scoped(.tls) else struct { | |
| 41 | const log = if (builtin.mode == .debug) std.log.scoped(.tls) else struct { | |
| 42 | 42 | pub fn info(comptime _: []const u8, _: anytype) void {} |
| 43 | 43 | pub fn err(comptime _: []const u8, _: anytype) void {} |
| 44 | 44 | pub fn warn(comptime _: []const u8, _: anytype) void {} |
| @@ -28,7 +28,7 @@ const cert = common.cert; | ||
| 28 | 28 | const rng = ; |
| 29 | 29 | const alpn = ; |
| 30 | 30 | const session_ticket = ; |
| 31 | const log = if (builtin.mode == .Debug) std.log.scoped(.tls) else struct { | |
| 31 | const log = if (builtin.mode == .debug) std.log.scoped(.tls) else struct { | |
| 32 | 32 | pub fn info(comptime _: []const u8, _: anytype) void {} |
| 33 | 33 | pub fn err(comptime _: []const u8, _: anytype) void {} |
| 34 | 34 | pub fn warn(comptime _: []const u8, _: anytype) void {} |
| @@ -102,7 +102,7 @@ pub const Parser = struct { | ||
| 102 | 102 | pub fn expectEnum(self: *Parser, comptime Enum: type) Error!Enum { |
| 103 | 103 | const oid = try self.expectOid(); |
| 104 | 104 | return Enum.oids.get(oid) orelse { |
| 105 | if (builtin.mode == .Debug) { | |
| 105 | if (builtin.mode == .debug) { | |
| 106 | 106 | var buf: [256]u8 = undefined; |
| 107 | 107 | var stream = std.io.fixedBufferStream(&buf); |
| 108 | 108 | try .decode(oid, stream.writer()); |