10503 Commits

Author SHA1 Message Date
Felix (xq) Queißner
c2d60bc5b5 Follows @tadeokondrak remark about taking []const type. 2020-09-28 12:24:22 +02:00
Felix (xq) Queißner
9331466998 Changes comptime block to test. 2020-09-28 11:42:39 +02:00
Felix (xq) Queißner
7f68b14377 Implements std.meta.Tuple(), implements #4607 in userland. 2020-09-25 09:27:00 +02:00
Andrew Kelley
f8b3543cab I think this test is still flakey
re-opens #4922
2020-09-24 22:57:03 -07:00
Josh Wolfe
1a8669eada build.zig: addBuildOptionArtifact 2020-09-25 01:53:38 -04:00
Frank Denis
bd89bd6fdb Revamp crypto/aes
* Reorganize crypto/aes in order to separate parameters, implementations and
modes.
* Add a zero-cost abstraction over the internal representation of a block,
so that blocks can be kept in vector registers in optimized implementations.
* Add architecture-independent aesenc/aesdec/aesenclast/aesdeclast operations,
so that any AES-based primitive can be implemented, including these that don't
use the original key schedule (AES-PRF, AEGIS, MeowHash...)
* Add support for parallelization/wide blocks to take advantage of hardware
implementations.
* Align T-tables to cache lines in the software implementations to slightly
reduce side channels.
* Add an optimized implementation for modern Intel CPUs with AES-NI.
* Add new tests (AES256 key expansion).
* Reimplement the counter mode to work with any block cipher, any endianness
and to take advantage of wide blocks.
* Add benchmarks for AES.
2020-09-24 13:16:00 -04:00
Ogromny
bba4576281 Fix typo in documentation 2020-09-24 13:14:03 -04:00
Frank Denis
c8cd6145ac Move PBKDF2 to a pwhash category, clarify what that category is
Password hashing functions are not general-purpose KDFs, and KDFs
don't have to satisfy the same properties as a PHF.

This will allow fast KDFs such as the HKDF construction to be in a
category of their own, while clarifying what functions are suitable
for using passwords as inputs.
2020-09-24 00:02:31 -04:00
Isaac Freund
72f4cdb2b4 docs: update implementation status for @Type() 2020-09-24 00:01:57 -04:00
Andrew Kelley
0f3111379b
Merge pull request #6399 from FireFox317/async-fix
Eventloop: Fix deadlock in linux event loop implementation
2020-09-24 00:01:22 -04:00
Frank Denis
274c55b780 ZIG_WORKAROUND_4799 is not required with LLVM 10.0.1
That paragraph used to contradict the following one.
2020-09-23 22:05:43 -04:00
Jakub Konka
0fcee6e11c
Merge pull request #6373 from notCalle/workaround-6087
Workaround MacOS build failure due to #6087
2020-09-23 20:59:09 +02:00
Timon Kruiper
bbff6bd675 Eventloop: Enable basic event loop test, fixed by previous commit
Closes #4922
2020-09-23 18:38:28 +02:00
Calle Englund
94024a9fae
Update macOS build instructions with workaround 2020-09-23 16:26:35 +02:00
Timon Kruiper
0eed7ec9d5 Eventloop: Fix deadlock in linux event loop implementation
A simple empty main with evented-io would not quit, because some
threads were still waiting to be resumed (by the os). The os.write to
the eventfd only wakes up one thread and thus there are multiple writes
needed to wake up all the other threads.
2020-09-23 11:41:31 +02:00
LemonBoy
58ee5f4e61 std: Fix metadata corruption in HeapAllocator
HeapAllocator stores the pointer returned by HeapAlloc right after the
data block and, after the recent allocator refactoring, the space for
this pointer was not taken into account in the calculation of the final
block size.

Fixes #5830
2020-09-20 01:21:29 -04:00
LemonBoy
f92d01c8a8 stage1: Fix edge case in casting between optional types
Closes #6370
2020-09-18 22:12:22 -04:00
zenith391
4fbf9f7f79 Add "emit_docs" field to LibExeObjStep. 2020-09-19 00:39:43 +03:00
Calle Englund
d08842887f
Workaround MacOS build failure due to #6087 2020-09-18 17:03:50 +02:00
Ryan Liptak
fbde15fdf4 Fix compile error in os.renameatW
Introduced in 5e3fa0e94f947c632aa584b9e13bfa2fe241fae1

Whoops!
2020-09-17 18:49:06 -04:00
Andrew Kelley
f125288c9b
Merge pull request #6336 from Rocknest/pbkdf2
Some changes to #6326 (pbkdf2)
2020-09-17 17:31:58 -04:00
Ryan Liptak
5e3fa0e94f Add rename to std.fs API
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
  + Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
2020-09-17 17:22:26 -04:00
Andrew Kelley
3672a18799
Merge pull request #6360 from LemonBoy/some-fmt-fixes
Two std.fmt fixes
2020-09-17 16:17:15 -04:00
LemonBoy
b7f9f779af translate-c: Fix formatting of non-printable chars
The two octets in hex notation must be aligned to the right and padded
on the left, not the other way around.
2020-09-17 09:27:24 +02:00
LemonBoy
27adb82fda std: Respect user-specified alignment when formatting ints
This implementation tries to do the right thing (TM) by treating the
sign as part of the number itself, therefore the alignment parameter
applies to both the sign and the digits.

In other words the format string `{:>4}` with -1 as input will not
output `-  1` but `  -1`.

And let's default to right alignment for everything as that's what users
want, especially when printing numbers. Many implementations use
different defaults for numeric vs non-numeric types, let's strive for a
consistent behaviour here.
2020-09-17 00:53:08 +02:00
Tadeo Kondrak
2962be8135 stage1: fix @Type(.Union) not resolving its tag type
Fixes https://github.com/ziglang/zig/issues/6339
2020-09-16 20:34:01 +03:00
LemonBoy
bb9a4ad6e9 std: Fix {*} printing of non-pointer types
Fixes a regression introduced in #6246.
Adds a test to make sure this won't happen again.
2020-09-16 13:45:54 +02:00
Andrew Kelley
281fc10ec5 std.crypto siphash: fix assertion on the size of output buffer
the logic was backwards
2020-09-16 02:24:36 -07:00
Nathan Michaels
7801a6d17f Fix a typo. 2020-09-15 22:49:53 -04:00
Rocknest
c35703825f Add an error set 2020-09-16 01:58:48 +03:00
Andrew Kelley
7ccfb08a93 ci: update the on_master_success secret to lavatech 2020-09-15 15:08:35 -07:00
Samrat Man Singh
ca85e367f4 Use std.log in LibcInstallation parse instead of taking stderr 2020-09-15 18:03:55 -04:00
Andrew Kelley
b3cc36857e
Merge pull request #6340 from Vexu/fix
Fixes
2020-09-15 14:28:16 -04:00
LemonBoy
c1c3212500 std: Fix typo in ELF section header iterator
The code accidentally used the phdr offset instead of the shdr one while
iterating over the section headers.

Fixes #6338
2020-09-15 18:14:06 +03:00
Andrew Kelley
5e39ab4600 ci: disable some freebsd tests to save time 2020-09-14 21:11:34 -07:00
Andrew Kelley
a8ae324130 Merge branch 'ci-freebsd'
Thanks to Ave & Luna for providing this service that lets us have enough
ram to properly test FreeBSD.
2020-09-14 19:38:36 -07:00
Andrew Kelley
44ef270de1 ci: use hut.lavatech.top for updating the download page 2020-09-14 19:37:59 -07:00
Andrew Kelley
558e22b2d0 ci: update freebsd to use hut.lavatech.top instead of sr.ht 2020-09-14 18:45:30 -07:00
Andrew Kelley
01c24c4509 ci: enable std lib tests for freebsd 2020-09-14 18:22:16 -07:00
Vexu
a3624e94f8
translate-c: determine sizeof using std.meta.sizeof 2020-09-14 23:53:38 +03:00
Vexu
29fd0c6d61
fix meta.cast behavior; add exhaustive tests 2020-09-14 23:21:26 +03:00
Veikka Tuominen
d073836894
Merge pull request #6172 from tadeokondrak/@Type(.Union)
Implement @Type for Union
2020-09-14 16:43:49 +03:00
Andrew Kelley
c49435f76b
Merge pull request #6331 from mattnite/bpf-helper-defs
BPF: helper definitions
2020-09-14 04:00:00 -04:00
Rocknest
988fc6f9d1 flip condition 2020-09-14 02:27:09 +03:00
Rocknest
73863cf72b fix build 2020-09-13 23:59:36 +03:00
LemonBoy
61e9e82bdc std: Make the CRC32 calculation slightly faster
Speed up a little the slicing-by-8 code path by replacing the
(load+shift+xor)*4 sequence with a single u32 load plus a xor.

Before:

```
iterative:  1018 MiB/s [000000006c3b110d]
small keys:  1075 MiB/s [0035bf3dcac00000]
```

After:

```
iterative:  1114 MiB/s [000000006c3b110d]
small keys:  1324 MiB/s [0035bf3dcac00000]
```
2020-09-13 16:32:21 -04:00
Rocknest
f6195be997 fix ref 2020-09-13 23:31:59 +03:00
LemonBoy
5e50d145d9 std: Limit the read/write size on Darwin
It turns out that the kernel won't read or write more than 0x7fffffff
bytes in a single call, failing with EINVAL when trying to do so.

Adjust the limit and curse whoever is responsible for this.

Closes #6332
2020-09-13 16:31:21 -04:00
Rocknest
d75cbb01db Reference all crypto declarations 2020-09-13 23:00:33 +03:00
Rocknest
b6385870d0 Convert asserts to errors, make sure nothing overflows 2020-09-13 22:39:54 +03:00