3385 Commits

Author SHA1 Message Date
Joran Dirk Greef
888af655e0 Add libc signature 2020-11-01 11:46:08 +02:00
Joran Dirk Greef
8fd88fdb31 linux: add fallocate() 2020-10-31 13:39:33 +02:00
J.C. Moyer
788900c35c Add test for null terminated slices with embedded null bytes 2020-10-30 23:58:23 -04:00
J.C. Moyer
b38dea37c7 Update doc comments to reflect current behavior 2020-10-30 23:58:23 -04:00
Travis
bb6e39e274 remove extra space in .** error message 2020-10-30 21:26:05 +02:00
Andrew Kelley
e59f44712d
Merge pull request #6875 from jorangreef/mips_syscalls
Add more mips syscall numbers
2020-10-30 13:31:12 -04:00
Veikka Tuominen
80dd432137
Merge pull request #6858 from travv0/no-star-after-dot-star
don't allow a token starting with an asterisk directly following .*
2020-10-30 16:08:04 +02:00
Joran Dirk Greef
ab1ed93ad9 Add close_range, faccessat2 and process_madvise 2020-10-30 12:39:01 +02:00
Joran Dirk Greef
9423ed1671 Add more mips syscall numbers
As per: lib/libc/musl/arch/mips/bits/syscall.h.in

...and as promised: https://github.com/ziglang/zig/pull/6356#issuecomment-696023349

Thanks @daurnimator again for the help with #6356.
2020-10-30 11:53:45 +02:00
Koakuma
891c6ddd5f Select stat struct type based on whether we are linking with libc 2020-10-30 11:46:33 +07:00
Andrew Kelley
aaff66b8ed
Merge pull request #6866 from LemonBoy/fix-zlib
Fix zlib EOB condition
2020-10-29 18:23:36 -04:00
Andrew Kelley
a41c0b63bb
Merge pull request #6356 from jorangreef/io_uring
std: add io_uring library
2020-10-29 18:20:38 -04:00
Travis
f51ccf0d1f panic when empty string passed as dest_rel_path to addInstallFileWithDir
causes the creation of a file instead of the directory that's meant to
be created
2020-10-29 15:22:39 -04:00
Frank Denis
26793453a7 std/crypto/blake2b: allow the initial output length to be set
BLAKE2 includes the expected output length in the initial state.

This length is actually distinct from the actual output length
used at finalization.

BLAKE2b-256/128 is thus not the same as BLAKE2b-128.

This behavior can be a little bit surprising, and has been "fixed"
in BLAKE3.

In order to support this, we may want to provide an option to set the
length used for domain separation.

In Zig, there is another reason to allow this: we assume that the
output length is defined at comptime.

But BLAKE2 doesn't have a fixed output length. For an output length that
is not known at comptime, we can't take the full block size and
truncate it due to the reason above.

What we can do now is set that length as an option to get the correct
initial state, and truncate the output if necessary.
2020-10-29 15:18:37 -04:00
wozeparrot
32e65c3f96
make addBuildOption append type (#6801)
* add addBuildOption test
2020-10-29 15:16:47 -04:00
Andrew Kelley
3a0e8c2b45
Merge pull request #6838 from LemonBoy/netstuff
std: Add basic smoke test for net functionality
2020-10-29 15:10:29 -04:00
Andrew Kelley
844eb932f4
Merge pull request #6841 from ifreund/fix-event-loop
std/event: fix poll error set handling
2020-10-29 14:41:18 -04:00
Frank Denis
e59dd7eecf std/crypto/x25519: return encoded points directly + ed->mont map
Leverage result location semantics for X25519 like we do everywhere
else in 25519/*

Also add the edwards25519->curve25519 map by the way since many
applications seem to use this to share the same key pair for encryption
and signature.
2020-10-29 14:39:58 -04:00
Frank Denis
5764c550ed std/crypto: vectorize Salsa20
20% faster on x86_64, slower on aarch64 as usual :/
2020-10-29 14:34:58 -04:00
Jakub Konka
17575019a0 Set page size to 16KB for aarch64 macos
With this tweak, `test-std` pass on Apple Silicon + BigSur.
2020-10-29 14:21:43 -04:00
Frank Denis
bb3dfd2708 std/math: add support for vectors to rotl()/rotr() 2020-10-29 14:17:46 -04:00
Vexu
a63fd34c50
return a valid node even if invalid deref was used 2020-10-29 19:20:15 +02:00
Travis
d7f9128b5d add error message to zig side of tokenizing/parsing 2020-10-29 12:03:45 -05:00
Travis
960b5b518f updated zig tokenizer to handle .*** and added tests 2020-10-29 12:03:45 -05:00
LemonBoy
20fba0933f std/deflate: Avoid reading past end of stream
Use a conservative (and slower) approach in the Huffman decoder fast
path.

Closes #6847
2020-10-29 17:16:03 +01:00
Koakuma
5125eb77bd Use the *_stat type as self 2020-10-29 21:37:45 +07:00
Veikka Tuominen
85dd5746bd
Merge pull request #6678 from s-ol/doc-type-aware
generated docs improvements: add vector, fntype, anytype type-printing; bool, function value-printing
2020-10-29 15:19:02 +02:00
LemonBoy
fe6cc0c3ba std: Better handling of type values in expectEqual 2020-10-29 15:13:44 +02:00
LemonBoy
88eb3ae8e5 std: Better handling of type values in expectEqual 2020-10-29 11:10:21 +01:00
s-ol
6e96352b90 docs: link to functions in getValueText and getCallHtml 2020-10-29 00:10:22 +01:00
Frank Denis
0adc144f88 std/crypto: adjust aesni parallelism to CPU models
Intel keeps changing the latency & throughput of the aes* and clmul
instructions every time they release a new model.

Adjust `optimal_parallel_blocks` accordingly, keeping 8 as a safe
default for unknown data.
2020-10-28 21:44:00 +02:00
Frank Denis
ea45897fcc PascalCase *box names, remove unneeded comptime & parenthesis
Also rename (salsa20|chacha20)Internal() to a better name.

And sort reexported crypto.* names
2020-10-28 21:43:15 +02:00
Jakub Konka
4f50958407 Clean up exporting of symbols on Darwin 2020-10-28 10:36:19 +01:00
LemonBoy
7f46672193 More fixups for Windows targets
* Use closeSocket on sockets instead of plain old close, the latter
  doesn't work on them.
* Use winsocket2 everywhere, mingw has no BSD sockets.
2020-10-28 10:03:23 +01:00
Jakub Konka
bda9a159aa Apple Silicon: no fstat$INODE64 symbol found
It seems that Apple has finally got rid of the 32bit versions of
`fstat` and `fstatat`, and instead, only 64bit versions are available
on BigSur and Apple Silicon.

The tweak in this commit is required to make Zig stage1 compile on
BigSur + aarch64.
2020-10-27 22:47:53 +01:00
johnLate
1ea0d40e5e std.os.c.accept/accept4: allow null for addr and len
See ziglang#6832.
2020-10-27 21:52:47 +01:00
johnLate
23c28c72b7 std.os.linux.accept/accept4: allow null for addr and len
std.os.accept already wants to allow null, which matches `man 3p accept`:

>  address     Either a null pointer, or a pointer to a sockaddr structure
>              where the address of the connecting  socket  shall  be  re‐
>              turned.
>
>  address_len Either  a  null pointer, if address is a null pointer, or a
>              pointer to a socklen_t object which on input specifies  the
>              length  of  the  supplied sockaddr structure, and on output
>              specifies the length of the stored address.

Fixes ziglang#6832.
2020-10-27 21:52:47 +01:00
LemonBoy
8044ed4c66 std: Add basic smoke test for net functionality 2020-10-27 21:52:47 +01:00
Isaac Freund
504f259c24
std/event: fix zig fmt regression 2020-10-27 21:40:22 +01:00
Isaac Freund
1b34365ca1
std/event: fix poll error set handling
This has been broken since 127fa80
2020-10-27 21:28:31 +01:00
Koakuma
2b87cc7ed3 starting_stack_ptr -> argc_argv_ptr to reflect actual use 2020-10-27 22:46:18 +07:00
Žiga Željko
7c2bde1f07 std/crypto: API cleanup 2020-10-26 19:19:34 -04:00
data-man
194e29adfc Format null type in std.fmt 2020-10-26 15:40:48 -04:00
Frank Denis
74a1175d9d std/*: add missing MIT license headers 2020-10-26 17:41:29 +01:00
johnLate
0a619c68a6 fix type mismatch in std.net.StreamServer
Parameter in std.os.listen is u31.

Fixes ziglang#6775
2020-10-25 21:18:24 -04:00
dec05eba
c0fa5963ee Make lastIndexOf use the same cut-off between BMH as indexOf
Also update test to use a string longer than 52 characters
to test both BMH and linear path.
2020-10-25 21:17:22 -04:00
Frank Denis
72064eba23 std/crypto: vectorize BLAKE3
Gives a ~40% speedup on x86_64.

However, the generic code remains faster on aarch64.

This is still processing only one block at a time for now.

I'm pretty confident that processing more blocks per round
will eventually give a substantial performance improvement on
all platforms with vector units.
2020-10-25 21:13:14 -04:00
Frank Denis
1b4ab749cf std/crypto: add the bcrypt password hashing function
The bcrypt function intentionally requires quite a lot of CPU cycles
to complete.

In addition to that, not having its full state constantly in the
CPU L1 cache causes a massive performance drop.

These properties slow down brute-force attacks against low-entropy
inputs (typically passwords), and GPU-based attacks get little
to no advantages over CPUs.
2020-10-25 21:11:40 -04:00
Sébastien Marie
2a0a11aa66 openbsd: make dl_phdr_info cross arches
introduce Addr and Half definition to std.elf, and use them for dl_phdr_info
2020-10-25 20:46:28 -04:00
Frank Denis
0c7a99b38d Move ed25519 key pairs to a KeyPair structure 2020-10-25 21:55:05 +01:00