3657 Commits

Author SHA1 Message Date
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
Frank Denis
28fb97f188 Add (X)Salsa20 and NaCl boxes
The NaCl constructions are available in pretty much all programming
languages, making them a solid choice for applications that require
interoperability.

Go includes them in the standard library, JavaScript has the popular
tweetnacl.js module, and reimplementations and ports of TweetNaCl
have been made everywhere.

Zig has almost everything that NaCl has at this point, the main
missing component being the Salsa20 cipher, on top on which NaCl's
secretboxes, boxes, and sealedboxes can be implemented.

So, here they are!

And clean the X25519 API up a little bit by the way.
2020-10-25 18:04:12 +01:00
Koakuma
cbc8750502 Separate libc stat and kernel stat definitions 2020-10-25 23:52:08 +07:00
Koakuma
3ce9428e3d Various formatting fixes 2020-10-25 21:53:16 +07:00
Koakuma
5474d43389 Zero %i6 to terminate backchain 2020-10-25 21:51:01 +07:00
Koakuma
1a362ea5b0 Fix sparc64 bits definitions 2020-10-25 21:38:39 +07:00
Koakuma
785153d756 Fix SA_* constants for sparc64 2020-10-25 20:39:32 +07:00
Koakuma
f018201009 Predict error-less path on syscalls 2020-10-25 20:07:18 +07:00
Vincent Rischmann
59af275680 test runner: use the correct number in leak report 2020-10-25 11:28:36 +02:00
Sébastien Marie
3115d2f2cd readd original code from #6638. realpathZ() is expected to take a [*:0]const u8 2020-10-25 10:02:10 +01:00
Koakuma
2e7a4758b3 Add back ppc input/output/clobber definitions
Accidentally removed when rebasing, this adds it back.
2020-10-25 13:39:22 +07:00
Koakuma
1d3abb761d "zig fmt" on lib/std/os/linux.zig 2020-10-25 13:38:08 +07:00
Koakuma
e7369ada93 Fix boolean operator in if clause 2020-10-24 21:33:40 +07:00
Koakuma
73e62f22ec Fix sigaction(2) call on sparc64 2020-10-24 20:05:37 +07:00
Koakuma
792526c0bd Fix sparc64 argument loading 2020-10-24 20:05:36 +07:00
Koakuma
cdbf66e36e Add sparc64-specific values for the various SA_ and SIG_ constants 2020-10-24 20:05:34 +07:00
Koakuma
268516d5d9 Fix constants 2020-10-24 20:04:18 +07:00
Koakuma
238f253de9 Move comptime out 2020-10-24 20:03:41 +07:00
Koakuma
cefbe4e7be Use correct names for generic SPARC targets
LLVM calls generic sparc32 CPUs "v8" and generic sparc64 CPUs "v9".
2020-10-24 20:03:41 +07:00
Koakuma
341eec71fd Add clone(2) implementation
This implementation kindly provided by @LemonBoy at GitHub
https://github.com/ziglang/zig/pull/6187#issuecomment-682635168
2020-10-24 20:03:41 +07:00
Koakuma
300cfbf252 Add TLS implementation for sparc64 2020-10-24 20:03:40 +07:00
Koakuma
6146f81c6e Add pipe(2) support 2020-10-24 20:03:37 +07:00
Koakuma
dba009fd21 Account for the delay slot 2020-10-24 20:01:32 +07:00
Koakuma
c29da84c0e Add sp loading 2020-10-24 20:01:29 +07:00
Koakuma
23433fb317 Fix register naming 2020-10-24 19:59:05 +07:00
Koakuma
de06b0a635 Add sparc64 linux bits 2020-10-24 19:59:04 +07:00
Koakuma
e5a11020cc Add sparc64 syscall interface 2020-10-24 19:59:04 +07:00
Frank Denis
91a1c20e74 Fix a typo (s/multple/multiple/) 2020-10-24 07:57:34 +02:00
s-ol
300b617140 generated docs: add FnFrame type support
See #3404
2020-10-23 15:44:32 +02:00