10713 Commits

Author SHA1 Message Date
Frank Denis
f01833e03e
crypto.ecdsa: add the ability to sign/verify prehashed messages (#23607) 2025-04-20 04:27:10 +02:00
Tobias Simetsreiter
5be3c7874c
std.tar: pass entry kind to rootDir to avoid setting root_dir to file (#23456) 2025-04-16 19:17:25 +00:00
Alex Rønne Petersen
1a2ceb36c8
Merge pull request #23573 from samy-00007/bigint-shift-fix
std.math.big.int: fix a bug in `llshl` and update test syntax
2025-04-16 18:28:25 +02:00
samy007
8ae9ac6df4 improve test syntax for better stack trace in case of failure 2025-04-16 11:10:22 +02:00
phatchman
ae38fc6a50
Return FileNotFound when CreateProcessW is called with a missing path (#23567) 2025-04-15 21:39:44 +00:00
Андрей Краевский
530228d953
Deprecate std.enums.nameCast. 2025-04-15 23:36:43 +02:00
Ryan King
6c598e8341 std: add os.linux.sysinfo(), use it for process.totalSystemMemory()
Co-authored-by: Alex Rønne Petersen <alex@alexrp.com>
2025-04-15 20:08:59 +02:00
Frank Denis
933beb4cbd
crypto.ecdsa: stricter DER decoding of signatures (#23554)
Reject DER-encoded signatures with the top bit set but no leading
0x00

Also add test vectors from Project Wycheproof with ECDSA-P384
2025-04-15 18:12:12 +02:00
samy007
c813b6a900 std.math.big: add and update tests 2025-04-14 22:54:10 +02:00
Chris Boesch
206bd1ced8
Merge pull request #23268 from chrboesch/i19875
std.posix: Added 'error.ProcessNotFound' where necessary
2025-04-14 22:20:44 +02:00
samy007
b08924e938 std.math.big.int: changed llshr and llshl implementation 2025-04-14 20:46:06 +02:00
Alex Rønne Petersen
667035fc78 std.Build.Step: Don't capture a stack trace if !std.debug.sys_can_stack_trace. 2025-04-14 06:06:07 +02:00
Andrew Kelley
2cb69e53b4
Merge pull request #23541 from alexrp/linux-5.10
`std.Target`: Bump minimum Linux kernel and glibc versions according to Debian LTS
2025-04-13 17:25:34 -04:00
samy007
b635b37249 std.math.big.int: remove setRuntimeSafety 2025-04-13 21:07:11 +02:00
Andrew Kelley
f32a5d349d std: eradicate u29 and embrace std.mem.Alignment 2025-04-13 02:20:32 -04:00
Frank Denis
a7122b7323
std.crypto: add constant-time codecs (#23420)
std.crypto: add constant-time codecs

Add constant-time hex/base64 codecs designed to process cryptographic
secrets, adapted from libsodium's implementations.

Introduce a `crypto.codecs` namespace for crypto-related encoders and
decoders. Move ASN.1 codecs to this namespace.

This will also naturally accommodate the proposed PEM codecs.
2025-04-12 20:13:45 +02:00
Alex Rønne Petersen
9352f379e8
Merge pull request #23529 from alexrp/2879-groundwork
Introduce libzigc for libc function implementations in Zig
2025-04-12 18:14:17 +02:00
Andrew Kelley
4e700fdf8e
Merge pull request #22516 from Jan200101/PR/build_id_option
std.Build: add build-id option
2025-04-11 16:37:46 -04:00
Andrew Kelley
08a6c4ca9b
Merge pull request #23272 from squeek502/getenvw-optim
Windows: Faster `getenvW` and a standalone environment variable test
2025-04-11 15:46:34 -04:00
g-logunov
326f254972
std.posix.getenv: early-return comparison (#23265)
Fixes std.posix.getenv() being slower than musl getenv() even when linking libc
2025-04-11 12:44:18 -07:00
Alex Rønne Petersen
2527c82482
std.os.linux: Use faccessat2 syscall in faccessat().
Only the former has a flags parameter. It's only available in Linux 5.8+.

Closes #16606.
2025-04-11 21:17:35 +02:00
Alex Rønne Petersen
46d03c5afa
std.Target: Bump minimum glibc version to 2.31.
This is the version in Debian LTS (bullseye).
2025-04-11 21:11:20 +02:00
Alex Rønne Petersen
731d6531bf
std.Target: Bump minimum Linux kernel version to 5.10.
This is the kernel in Debian LTS (bullseye).
2025-04-11 21:10:55 +02:00
Alex Rønne Petersen
ed9aa8f259 compiler: Move int size/alignment functions to std.Target and std.zig.target.
This allows using them in e.g. compiler-rt.
2025-04-11 05:22:00 -04:00
Alex Rønne Petersen
0132be7bf3 std.Target: Rename charSignedness() to cCharSignedness().
To be consistent with the other functions that answer C ABI questions.
2025-04-11 05:22:00 -04:00
Jacob Young
c82e1fe880
Merge pull request #23355 from jacobly0/x86_64-rewrite
x86_64: start rewriting overflow operations
2025-04-11 05:21:44 -04:00
Alex Rønne Petersen
01b5e8b296
std: Disable some vector-related tests for hexagon.
See:

* https://github.com/llvm/llvm-project/issues/118879
* https://github.com/llvm/llvm-project/issues/134659
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
0a5c088ecc
compiler: Add hexagon-linux-musl support.
Closes #21588.
2025-04-11 02:28:35 +02:00
Alex Rønne Petersen
71a237e764
std.zig.system: Force soft_float feature on for MIPS soft float targets.
Workaround for: https://github.com/llvm/llvm-project/issues/135283
2025-04-11 02:08:18 +02:00
Pat Tullmann
4b63f94b4e Fix sigaddset/sigdelset bit-fiddling math
The code was using u32 and usize interchangably, which doesn't work on
64-bit systems.  This:
  `pub const sigset_t = [1024 / 32]u32;`
is not consistent with this:
  `const shift = @as(u5, @intCast(s & (usize_bits - 1)));`

However, normal signal numbers are less than 31, so the bad math doesn't matter much.  Also, despite support for 1024 signals in the set, only setting signals between 1 and NSIG (which is mostly 65, but sometimes 128) is defined.  The existing tests only exercised signal numbers in the first 31 bits so they didn't trip over this:

The C library `sigaddset` will return `EINVAL` if given an out of bounds signal number.  I made the Zig code just silently ignore any out of bounds signal numbers.

Moved all the `sigset` related declarations next to each in the source, too.

The `filled_sigset` seems non-standard to me.  I think it is meant to be used like `empty_sigset`, but it only contains 31 set signals, which seems wrong (should be 64 or 128, aka `NSIG`).  It's also unused.  The oddly named but similar `all_mask` is used (by posix.zig) but sets all 1024 bits (which I understood to be undefined behavior but seems to work just fine).  For comparison the musl `sigfillset` fills in 65 bits or 128 bits.
2025-04-10 23:49:44 +02:00
Jacob Young
06eebafadd AstGen: redistribute inline asm limits 2025-04-10 06:04:09 -04:00
Pat Tullmann
991560fb49 linux.zig: epoll_wait: pass kernel sigset size
Linux kernel syscalls expect to be given the number of bits of sigset that
they're built for, not the full 1024-bit sigsets that glibc supports.

I audited the other syscalls in here that use `sigset_t` and they're all
using `NSIG / 8`.

Fixes #12715
2025-04-09 16:37:58 +02:00
Manlio Perillo
f4e3631655 std.zon.parse: Fix typo in test "std.zon parse bool"
Replace "Correct floats" with "Correct bools".
2025-04-09 14:43:12 +02:00
Meghan Denny
70437354c0 std: add nvidia as a known arm implementer 2025-04-09 10:14:42 +02:00
imreallybadatnames™️
7733b5dbe6
Merge pull request #23501 from imreallybadatnames/master
Step.Compile: use LtoMode enum for lto option
2025-04-09 05:16:36 +00:00
Alex Rønne Petersen
9bbac42886
Merge pull request #23478 from alexrp/bsd-versions
`std.Target`: Bump some minimum OS versions for BSDs
2025-04-08 18:27:39 +02:00
Alex Rønne Petersen
2d33cc2e42
Merge pull request #23376 from sweiglbosker/m68k-archbits 2025-04-08 06:04:16 +02:00
Alex Rønne Petersen
1cab57f361
std.os.linux: Add some missing arch bits for loongarch64. 2025-04-07 16:03:22 +02:00
Alex Rønne Petersen
9423712519
std: Disable usage of fstat() and friends on loongarch.
Like riscv32, loongarch exclusively uses statx().
2025-04-07 16:03:22 +02:00
Stefan Weigl-Bosker
bcb4ba9afd
std.os.linux: use heap.pageSize() instead of MMAP2_UNIT 2025-04-07 13:37:01 +02:00
Stefan Weigl-Bosker
6fd358d287
std.os.linux: add arch bits for m68k
fixup
2025-04-07 13:36:45 +02:00
Alex Rønne Petersen
4b5941c54b
start: Reduce stack alignment for hexagon.
The ABI requires 8-byte alignment, not 16.
2025-04-07 13:09:10 +02:00
Alex Rønne Petersen
d3bf6c518f
start: Align the stack on m68k. 2025-04-07 13:09:10 +02:00
Stefan Weigl-Bosker
8fea9f68e8
start: fix pc register syntax for m68k 2025-04-07 13:09:10 +02:00
Alex Rønne Petersen
c8631ec523
std.Target: Bump minimum Dragonfly BSD version to 6.0.0. 2025-04-06 08:05:07 +02:00
Alex Rønne Petersen
af19161817
std.Target: Bump minimum OpenBSD version to 7.5.
Per: https://www.openbsd.org/faq/faq5.html#Flavors
2025-04-06 08:05:07 +02:00
Alex Rønne Petersen
a88db11c2a
std.Target: Bump minimum NetBSD version to 9.4.
Per: https://www.netbsd.org/releases
2025-04-06 08:05:07 +02:00
Alex Rønne Petersen
88e8e9fb91
std: Remove some FreeBSD version checks and resulting dead code.
We now require FreeBSD 13.4+.
2025-04-06 08:05:04 +02:00
Alex Rønne Petersen
ae98d79c87
std.Target: Bump minimum FreeBSD version to 13.4.
Per: https://www.freebsd.org/releases
2025-04-06 07:44:38 +02:00
Dacheng Gao
596e0bd47b std.os.linux: add constants for ETH 2025-04-06 02:52:20 +02:00