Commit Graph

6384 Commits

Author SHA1 Message Date
IntegratedQuantum
fbc4331f18 Implements std.math.sign for float vectors. 2022-11-12 15:41:55 +02:00
Jakub Konka
7733246d6e pdb: make SuperBlock def public 2022-11-12 09:40:40 +01:00
Frank Denis
df7223c7f2 crypto.AesGcm: provision ghash for the final block 2022-11-11 18:04:22 +01:00
Frank Denis
59af6417bb
crypto.ghash: define aggregate tresholds as blocks, not bytes (#13507)
These constants were read as a block count in initForBlockCount()
but at the same time, as a size in update().

The unit could be blocks or bytes, but we should use the same one
everywhere.

So, use blocks as intended.

Fixes #13506
2022-11-10 19:00:00 +01:00
Veikka Tuominen
41b7e40d75
Merge pull request #13418 from ryanschneider/signal-alignment-13216
std.os: fix alignment of Sigaction.handler_fn
2022-11-09 17:36:40 +02:00
IntegratedQuantum
d1e7be0bd1
Handle sentinel slices in std.mem.zeroes
Fixes #13256
2022-11-09 17:33:48 +02:00
bfredl
95f989a05b Fixes to linux/bpf/btf.zig
- the meaning of packed structs changed in zig 0.10. adjust accordingly.
  Use "extern struct" for the cases that directly map to C structs.

- Add new type info kinds, like enum64 and DeclTag

- change the Type enum to use the canonical names from libbpf.
  This is more predictable when comparing with external BPF
  documentation (than invented synonyms that need to be guessed)
2022-11-09 17:14:22 +02:00
Frank Denis
36e618aef1 crypto.ghash: compatibility with stage1
Defining the selector enum outside the function definition is
required for stage1.
2022-11-08 16:59:53 +01:00
Frank Denis
7d48cb1138
std.crypto: make ghash faster, esp. for small messages (#13464)
* std.crypto: make ghash faster, esp. for small messages

Aggregated reduction requires 5 additional multiplications (to
precompute the powers of H), in order to save 2 multiplications
per batch.

So, only use large batches when it's actually interesting to do so.

For the last blocks, reuse the precomputations in order to perform
a single reduction.

Also, even in .ReleaseSmall, allow 2-block aggregation.
The speedup is worth it, and the code increase is reasonable.

And in .ReleaseFast, bump the upper batch size up to 16.

Leverage comptime by the way instead of duplicating code.

std/crypto/benchmark.zig on Apple M1:

    Zig 0.10.0: 2769 MiB/s
        Before: 6014 MiB/s
         After: 7334 MiB/s

Normalize function names by the way.

* Change clmul() to accept the half to be processed

This avoids a bunch of truncate() calls.

* Add more ghash tests to check all code paths
2022-11-07 21:45:29 +01:00
Frank Denis
32563e6829
crypto.core.aes: process 6 block in parallel instead of 8 on aarch64 (#13473)
* crypto.core.aes: process 6 block in parallel instead of 8 on aarch64

At least on Apple Silicon, this is slightly faster than 8 blocks.

* AES: add parallel blocks for tigerlake, rocketlake, alderlake, zen3
2022-11-07 12:28:37 +01:00
Frank Denis
907f3ef887
crypto.salsa20: make the number of rounds a comptime parameter (#13442)
...instead of hard-coding it to 20.

- This is consistent with the ChaCha implementation
- NaCl and libsodium, that this API is designed to interop with,
also support 8 and 12 round variants. The 12 round variant, in
particular, provides the same security level as the 20 round variant,
but is obviously faster.
- scrypt currently uses its own non optimized version of Salsa, just
because it use 8 rounds instead of 20. This will help remove code
duplication.

No behavior nor public API changes. The Salsa20 and XSalsa20 still
represent the 20-round variant.
2022-11-06 23:52:41 +01:00
r00ster91
b83e4d9656 std.os.linux.T: translate more MIPS values
This fixes the broken terminal for me and thus fixes #13198.
2022-11-06 16:33:50 +02:00
Jay Petacat
694d8831c3 Revert "x86" CPU model (not arch) back to "i386"
PR #13101 recently renamed the "i386" architecture to "x86", and it
seems the specific CPU model got swept up in that. "x86" is an umbrella
term that describes a family of CPUs, and the "i386" is the oldest
supported model under that umbrella.
2022-11-06 13:39:03 +01:00
delitako
c8a5ad6d9d
Improve doc comments for two functions (#13456)
* std.heap: fix function name in doc comment

* std.mem: document return value of `replace`
2022-11-05 22:55:50 +01:00
Ali Chraghi
aea617c60b std.os: take advantage of the freebsd's copy_file_range 2022-11-05 15:43:39 -04:00
Jakub Konka
83d89a05b7 coff: compile and link simple exit program on arm64
* make image base target dependent
* fix relocs to imports
2022-11-05 10:15:01 +01:00
Andrew Kelley
1d68045919
Merge pull request #13101 from alichraghi/o4 2022-11-05 02:34:24 -04:00
Ryan Schneider
a68b27c252 std.os: improve sigaction test coverage. 2022-11-04 08:07:44 -07:00
Ryan Schneider
7f1f2e653d std.os: fix alignment of Sigaction.handler_fn
Fixes #13216
2022-11-04 08:00:50 -07:00
Ryan Schneider
64b3ffd8ff std.os: Add IGN coverage to sigaction tests
* Should start failing on aarch64 and other word-aligned CPUs.
2022-11-04 08:00:50 -07:00
Veikka Tuominen
986b7ce5b2 rename i386-linux-gnu to x86-linux-gnu 2022-11-04 16:41:23 +02:00
Veikka Tuominen
8c4faa5f3f
Merge pull request #13338 from Vexu/stage2-compile-errors
Improve some error messages
2022-11-04 16:04:31 +02:00
Andrew Kelley
42755a1944
Merge pull request #13430 from ziglang/stack-probe-msvc
Miscellaneous arm64 windows fixes
2022-11-03 19:49:10 -04:00
Ali Chraghi
f5f1f8c666 all: rename i386 to x86 2022-11-04 00:09:27 +03:30
Yujiri
b19161ba9c Add docstrings to some functions in std.meta 2022-11-03 17:37:38 +02:00
Veikka Tuominen
678f3f6e65
Merge pull request #13276 from r00ster91/stem
std.fs.path: add stem()
2022-11-03 16:45:37 +02:00
Jakub Konka
480c3c4d0a compiler_rt: fix duplicate symbol error when linking libc on arm64 Windows 2022-11-03 14:41:28 +01:00
Frank Denis
96793530cd
std.crypto.pwhash.bcrypt: inline the Feistel network function (#13416)
std/crypto/benchmark.zig results:

* Intel i5

before: 3.144 s/ops
 after: 1.922 s/ops

* Apple M1

before: 2.067 s/ops
 after: 1.373 s/ops
2022-11-03 13:10:08 +01:00
Nathan Bourgeois
e64eef366c
Translate-C Remainder Macro Fix 2022-11-03 14:07:00 +02:00
Jacob Young
085f6fd8f7 cbe: use wrapping for left shifts 2022-11-02 23:00:10 -04:00
Jacob Young
fa46f9a3d7 cbe: fix extern 2022-11-02 21:42:40 -04:00
Eric Milliken
b40fc70188
std.time: add microTimestamp() (#13327) 2022-11-02 23:20:19 +01:00
Andrew Kelley
e50789f1cb
Merge pull request #13389 from jacobly0/fix-only-c
cbe: enough fixes for `-Donly-c` to be able to produce an executable
2022-11-02 15:53:59 -04:00
Jacob Young
771dadc5e0 x86: cleanup inline asm
Multiple outputs work now, so use that instead of deleting clobbers.
2022-11-01 20:39:06 -04:00
Jacob Young
9b2db56d0f x86: remove inline asm clobbers that conflict with inputs or outputs 2022-11-01 20:39:06 -04:00
Jacob Young
91fe0b80a2 cbe: fix threadlocal 2022-11-01 20:38:51 -04:00
Jacob Young
757db665a7 build: remove ofmt from LibExeObjStep which is redundant with target.ofmt 2022-11-01 20:38:37 -04:00
Jacob Young
93d60d0de7 std: avoid vector usage with the C backend
Vectors are not yet implemented in the C backend, so no reason to
prevent code using the standard library from compiling in the meantime.
2022-11-01 20:38:37 -04:00
joachimschmidt557
3051fab97c
stage2 AArch64: misc fixes, enable printing in test runner
- Fixed missing airRetPtr implementation
- Fixed wrong pop_regs order
- Fixed wrong source and destination register in store
2022-11-01 20:44:18 +01:00
Frank Denis
0d192ee9ef
std.crypto.onetimeauth.Ghash: make GHASH 2 - 2.5x faster (#13374)
Rewrite GHASH to use 128-bit multiplication over non-reversed
integers, and up to 8 blocks aggregated reduction.

lib/std/crypto/benchmark.zig results:

Xeon E5:
  Before: 1604 MiB/s
   After: 4005 MiB/s

Apple M1:
  Before: 2769 MiB/s
   After: 6014 MiB/s

This also makes AES-GCM faster by the way.
2022-11-01 13:49:13 -04:00
Andrew Kelley
1780d7a348
Merge pull request #13368 from jacobly0/fix-aarch64-c 2022-11-01 13:28:40 -04:00
mnordine
2943df016e
Fix variable name in documentation sample (#13391) 2022-11-01 12:49:13 +01:00
Frank Denis
ddb9eac05c ed25519: recommend using the seed to recover a key pair 2022-11-01 07:26:32 +01:00
Frank Denis
9e44710fc4
Ed25519.KeyPair.fromSecretKey() didn't compile after the API changes (#13386)
Fixes #13378
2022-11-01 07:10:40 +01:00
Jacob Young
b945d3eb90 cbe: improve support for non-native float types
* Fix _start on aarch64.
 * Add fallbacks when a float type is unsupported.

Fixes #13357
2022-10-31 20:18:15 -04:00
Andrew Kelley
d02242661e std.heap: make wasm32 PageAllocator handle large allocation
When a number of bytes to be allocated is so great that alignForward()
is not possible, return `error.OutOfMemory`.

Companion commit to 3f3003097c.
2022-10-30 19:28:26 -07:00
Andrew Kelley
6d999abba0 mingw-w64: add gdiplus def files
closes #13192
2022-10-30 19:04:00 -07:00
Andrew Kelley
3e126102b7 compiler_rt: fix gnu_f16_abi for i386-windows
closes #13333
2022-10-30 18:42:59 -07:00
Andrew Kelley
3f3003097c std.heap.PageAllocator: add check for large allocation
Instead of making the memory alignment functions more complicated, I
added more API documentation for their existing semantics.

closes #12118
closes #12135
2022-10-30 16:10:20 -07:00
Nameless
40e84a27d6
change uefi packed structs to new integer backed syntax (#13173)
* std.os.uefi: integer backed structs, add tests to catch regressions

device_path_protocol now uses extern structs with align(1) fields because
the transition to integer backed packed struct broke alignment

added comptime asserts that device_path_protocol structs do not violate
alignment and size specifications
2022-10-30 15:08:32 -04:00