2543 Commits

Author SHA1 Message Date
Andrew Kelley
402f967ed5 move std.http to the standard library orphanage
I want to take the design of this in a different direction. I think this
abstraction is too high level. I want to start bottom-up.

std-lib-orphanage commit 179ae67d61455758d71037434704fd4a17a635a9
2020-09-29 17:40:37 -07:00
Andrew Kelley
af64fd2f42 Merge remote-tracking branch 'origin/master' into stage2-zig-cc
This merges in the revert that fixes the broken Windows build of master
branch.
2020-09-29 17:26:09 -07:00
Andrew Kelley
f69650a478 update wasm to use ".o.wasm" extension for objects
This is convenient for debugging purposes, as well as simplifying the
caching system since executable basenames will not conflict with their
corresponding object files.
2020-09-29 17:01:05 -07:00
Frank Denis
d75d6e7f77 Remove unused var, sort std.crypto.* 2020-09-30 01:39:55 +02:00
Frank Denis
6eaba61ef5 std/crypto: implement the HKDF construction 2020-09-30 01:39:55 +02:00
Andrew Kelley
d1cea16f5c move std.BloomFilter to the standard library orphanage 2020-09-29 16:39:05 -07:00
Jakub Konka
bb636cb3bf Revert "Fix for Windows: std.os.windows.DeleteFile()" 2020-09-29 19:35:44 -04:00
Andrew Kelley
63685190da move std.rb to the standard library orphanage
https://github.com/ziglang/std-lib-orphanage/

This code is not used by anything else in the standard library or by the
compiler or any of its tools and therefore it's a great candidate
to be maintained by a third party.
2020-09-29 16:01:51 -07:00
Andrew Kelley
b811a99af9 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 14:53:48 -07:00
Andrew Kelley
0da7c4b0c8 improve stage2 COFF LLD linking
* change some {} to be {s} to gain type safety
 * fix libraries being libfoo.lib instead of foo.lib for COFF
 * when linking mingw-w64, add the "always link" libs so that we
   generate DLL import .lib files for them as the linker code relies on.
 * COFF LLD linker does not support -r so we do a file copy as an
   alternative to the -r thing that ELF linking does.
   I will file an issue for the corresponding TODO upon merging this
   branch, to look into an optimization that possibly elides this copy
   when the source and destination are both cache directories.
 * add a CLI error message when trying to link multiple objects into one
   and using COFF object format.
2020-09-29 14:48:12 -07:00
Andrew Kelley
a1ae3f92c1
Merge pull request #6442 from jedisct1/aegis
std/crypto: add the AEGIS AEADs
2020-09-29 15:18:06 -04:00
Andrew Kelley
65b03092e3
Merge pull request #6450 from jedisct1/gimli-opt
std/crypto: make Gimli 60% faster
2020-09-29 15:16:52 -04:00
Andrew Kelley
d8fa8b5455 use Allocator.allocSentinel now that the stage1 bug is fixed
Thanks @LemonBoy!
2020-09-29 12:06:35 -07:00
Robin Voetter
4102ba37dd Fix std.ArrayListUnmanaged + improve test coverage 2020-09-29 19:49:13 +02:00
Frank Denis
8d67f15d36 aegis: add test vectors, and link to the latest version of the spec 2020-09-29 17:10:04 +02:00
Frank Denis
bb1c6bc376 Add AEGIS-256 as well 2020-09-29 17:10:04 +02:00
Frank Denis
9f274e1f7d std/crypto: add the AEGIS128L AEAD
Showcase that Zig can be a great option for high performance cryptography.

The AEGIS family of authenticated encryption algorithms was selected for
high-performance applications in the final portfolio of the CAESAR
competition.

They reuse the AES core function, but are substantially faster than the
CCM, GCM and OCB modes while offering a high level of security.

AEGIS algorithms are especially fast on CPUs with built-in AES support, and
the 128L variant fully takes advantage of the pipeline in modern Intel CPUs.

Performance of the Zig implementation is on par with libsodium.
2020-09-29 17:10:04 +02:00
Alexandros Naskos
d27a34f05c
Merge branch 'master' into args-tuple 2020-09-29 16:19:44 +03:00
Alexandros Naskos
3342e28784
Merge pull request #6416 from MasterQ32/meta-tuple
Implements std.meta.Tuple(), implements #4607 in userland.
2020-09-29 15:59:27 +03:00
Loris Cro
16f0419700 add runDetached to event loop
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-29 14:53:36 +02:00
Frank Denis
56d820087d gimli: make permute a constant, remove leading underscore 2020-09-29 14:01:08 +02:00
Frank Denis
4194714965 Don't unroll the gimli permutation on release-small 2020-09-29 13:23:04 +02:00
Loris Cro
a45a4230bc Fix std.event.Future
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-29 11:18:35 +02:00
Frank Denis
613f8fe83f Use mem.copy() instead of manual iterations 2020-09-29 10:23:00 +02:00
Andrew Kelley
750b00c642 Merge remote-tracking branch 'origin/master' into stage2-zig-cc 2020-09-29 00:27:48 -07:00
Andrew Kelley
ed06a78f35 stage2: WASM LLD linking 2020-09-28 23:20:14 -07:00
Andrew Kelley
ef9582a1ec zig test and zig run do not try to run foreign binaries 2020-09-28 22:19:00 -07:00
Andrew Kelley
29fd130093 std.ChildProcess: bypass libc exit() in fork child error case
Comment reproduced here:

If we're linking libc, some naughty applications may have
registered atexit handlers which we really do not want to
run in the fork child. I caught LLVM doing this and it
caused a deadlock instead of doing an exit syscall. In
the words of Avril Lavigne, "Why'd you have to go and
make things so complicated?"
2020-09-28 22:17:50 -07:00
Frank Denis
868a46eb43 std/crypto: make gimli slightly faster
Before:
       gimli-hash:        120 MiB/s
       gimli-aead:        130 MiB/s

After:
       gimli-hash:        195 MiB/s
       gimli-aead:        208 MiB/s

Also fixes in-place decryption by the way.

If the input & output buffers were the same, decryption used to fail.

Return on decryption error in the benchmark to detect similar issues
in future AEADs even in non release-fast mode.
2020-09-29 00:29:20 +02:00
Andrew Kelley
a0c0f9ead5
Merge pull request #6441 from kprotty/lock
New std.event.Lock implementation
2020-09-28 17:30:36 -04:00
LemonBoy
5c6cd5e2c9 stage{1,2}: Fix parsing of range literals
stage1 was unable to parse ranges whose starting point was written in
binary/octal as the first dot in '...' was incorrectly interpreted as
decimal point.

stage2 forgot to reset the literal type to IntegerLiteral when it
discovered the dot was not a decimal point.

I've only stumbled across this bug because zig fmt keeps formatting the
ranges without any space around the ...
2020-09-28 14:16:26 -04:00
kprotty
468a4bf0b4 address some review changes 2020-09-28 07:25:51 -05:00
Felix (xq) Queißner
c2d60bc5b5 Follows @tadeokondrak remark about taking []const type. 2020-09-28 12:24:22 +02:00
Felix (xq) Queißner
55dfe729b4 Changes comptime block to test. 2020-09-28 11:44:55 +02:00
Felix (xq) Queißner
9331466998 Changes comptime block to test. 2020-09-28 11:42:39 +02:00
Andrew Kelley
91a73a177b stage2: building mingw-w64 and COFF LDD linking
still TODO is the task of creating import .lib files for DLLs on the fly
both for -lfoo and for e.g. `extern "kernel32"`
2020-09-28 00:06:06 -07:00
Jakub Konka
e60939bfaa
Merge pull request #6397 from suirad/fix-5537
Fix for Windows: std.os.windows.DeleteFile()
2020-09-27 21:59:29 +02:00
kprotty
a31d9f92f2 new std.event.Lock implementation 2020-09-27 14:05:38 -05:00
Andrew Kelley
8794ce6f79
Merge pull request #6293 from LakeByTheWoods/fmt_fixes
zig fmt fixes
2020-09-27 05:49:38 -04:00
Ian Simonson
eab51b7785 Make LinearFifo not crash when discarding from empty buffer
Previously if a LinearFifo was empty and discard was called
an unsigned overflow would occur. However it is safe to perform
this overflow as a bitwise & operation with 0xFFFFFFFFFFFFFF is a noop
2020-09-27 05:46:39 -04:00
Woze Parrrot
ed357f9897 uefi system_table 2020-09-27 03:15:18 -04:00
Andrew Kelley
b6556c944b fix another round of regressions in this branch
* std.log: still print error messages in ReleaseSmall builds.
   - when start code gets an error code from main, it uses std.log.err
     to report the error. this resulted in a test failure because
     ReleaseSmall wasn't printing `error: TheErrorCode` when an error
     was returned from main. But that seems like it should keep working.
     So I changed the std.log defaults. I plan to follow this up with a
     proposal to change the names of and reduce the quantity of the
     log levels.
 * warning emitted when using -femit-h when using stage1 backend; fatal
   log message when using -femit-h with self-hosted backend (because the
   feature is not yet available)
 * fix double `test-cli` build steps in zig's build.zig
 * update docgen to use new CLI
 * translate-c uses `-x c` and generates a temporary basename with a
   `.h` extension. Otherwise clang reports an error.
 * --show-builtin implies -fno-emit-bin
 * restore the compile error for using an extern "c" function without
   putting -lc on the build line. we have to know about the libc
   dependency up front.
 * Fix ReleaseFast and ReleaseSmall getting swapped when passing the
   value to the stage1 backend.
 * correct the zig0 CLI usage text.
 * update test harness code to the new CLI.
2020-09-26 21:03:38 -07:00
Andrew Kelley
aded86e690 std.ArrayHashMap: count and iterator are not deprecated
These APIs allow one to write code that is agnostic of whether it is
using an ArrayHashMap or a HashMap, which can be valuable. Specify
intent precisely: if you only need the count of the items, it makes
sense to have a function for that.
2020-09-25 20:50:40 -07:00
Suirad
43cd9eb110 Add clarification comment 2020-09-25 18:11:31 -05:00
Suirad
f78652484a Stdlib fix for os.windows.deleteFile to fail with
a proper error when attempting to delete a directory that isnt empty
2020-09-25 18:09:05 -05:00
Andrew Kelley
a502604702
Merge pull request #6412 from kristoff-it/generalize-event-loop
Make os.zig not depend on the event loop
2020-09-25 17:26:44 -04:00
Loris Cro
dc01ef7388
Remove noop check
Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2020-09-25 23:21:20 +02:00
Tadeo Kondrak
236af776fd
std.fmt: add comptimePrint 2020-09-25 12:53:35 -06:00
Alexandros Naskos
288198e51d
Merge pull request #6413 from LemonBoy/fix-5116
Make ArenaAllocator try to resize first
2020-09-25 19:47:50 +03:00
Loris Cro
8d01133bd0 update doc comments
Signed-off-by: Loris Cro <kappaloris@gmail.com>
2020-09-25 18:42:24 +02:00