Commit Graph

31785 Commits

Author SHA1 Message Date
Jacob Young
e5f5229fd6
Merge pull request #21872 from jacobly0/tlsv1.2
Some checks failed
ci / x86_64-linux-debug (push) Has been cancelled
ci / x86_64-linux-release (push) Has been cancelled
ci / aarch64-linux-debug (push) Has been cancelled
ci / aarch64-linux-release (push) Has been cancelled
ci / x86_64-macos-release (push) Has been cancelled
ci / aarch64-macos-debug (push) Has been cancelled
ci / aarch64-macos-release (push) Has been cancelled
ci / x86_64-windows-debug (push) Has been cancelled
ci / x86_64-windows-release (push) Has been cancelled
ci / aarch64-windows (push) Has been cancelled
std.crypto.tls: implement TLSv1.2
2024-11-08 02:01:52 -05:00
Jacob Young
9373abf7f7 std.http.Client: change ssl key log creation permission bits
This is the same mode used by openssh for private keys.  This does not
change the mode of an existing file, so users who need something
different can pre-create the file with their designed permissions or
change them after the fact, and running another process that writes to
the key log will not change it back.
2024-11-07 20:56:33 -05:00
Jacob Young
75adba7cb9 std.crypto.tls: add support for secp384r1 key share 2024-11-07 20:25:26 -05:00
Jacob Young
a4e88abf04 std.crypto.tls: advertise all supported signature algorithms 2024-11-07 20:25:26 -05:00
Jacob Young
fbaefcaa94 std.crypto.tls: support the same key sizes as certificate verification 2024-11-07 20:25:26 -05:00
Jacob Young
a6ede7ba86 std.crypto.tls: support handshake fragments 2024-11-07 20:25:26 -05:00
Jacob Young
de53e6e4f2 std.crypto.tls: improve debuggability of encrypted connections
By default, programs built in debug mode that open a https connection
will append secrets to the file specified in the SSLKEYLOGFILE
environment variable to allow protocol debugging by external programs.
2024-11-07 20:25:26 -05:00
Jacob Young
d86a8aedd5 std.crypto.tls: increase handshake buffer sizes 2024-11-07 20:25:26 -05:00
Jacob Young
485f20a10a std.crypto.tls: remove hardcoded initial loop
This was preventing TLSv1.2 from working in some cases, because servers
are allowed to send multiple handshake messages in the first handshake
record, whereas this inital loop was assuming that it only contained a
server hello.
2024-11-07 20:25:26 -05:00
Jacob Young
90a761c186 std.crypto.tls: make verify data checks timing safe 2024-11-07 20:25:26 -05:00
Jacob Young
7afb277725 std.crypto.tls: fix x25519_ml_kem768 key share
This is mostly nfc cleanup as I was bisecting the client hello to find
the problematic part, and the only bug fix ended up being

    key_share.x25519_kp.public_key ++
    key_share.ml_kem768_kp.public_key.toBytes()

to

    key_share.ml_kem768_kp.public_key.toBytes() ++
    key_share.x25519_kp.public_key)

and the same swap in `KeyShare.exchange` as per some random blog that
says "a hybrid keyshare, constructed by concatenating the public KEM key
with the public X25519 key".  I also note that based on the same blog
post, there was a draft version of this method that indeed had these
values swapped, and that used to be supported by this code, but it was
not properly fixed up when this code was updated from the draft spec.

Closes #21747
2024-11-07 20:25:26 -05:00
Jacob Young
7f20c78c95 std.crypto: delete new functions that are only used once 2024-11-07 20:25:26 -05:00
Jacob Young
4466f145d6 std.crypto.tls: support more key share params
This condition is already checked less restrictively in
`KeyShare.exchange`.
2024-11-07 20:25:26 -05:00
Jacob Young
e184b15a66 std.crypto.tls: fix fetching https://nginx.org
Note that the removed `error.TlsIllegalParameter` case is still caught
below when it is compared to a fixed-length string, but after checking
the proper protocol version requirement first.
2024-11-07 20:25:26 -05:00
Jacob Young
c2a779ae79 std.crypto.tls: implement TLSv1.2 2024-11-07 20:25:26 -05:00
Daniel Hooper
ee9f00d673
Add missing Darwin declarations (#21929)
Some checks failed
ci / x86_64-linux-debug (push) Has been cancelled
ci / x86_64-linux-release (push) Has been cancelled
ci / aarch64-linux-debug (push) Has been cancelled
ci / aarch64-linux-release (push) Has been cancelled
ci / x86_64-macos-release (push) Has been cancelled
ci / aarch64-macos-debug (push) Has been cancelled
ci / aarch64-macos-release (push) Has been cancelled
ci / x86_64-windows-debug (push) Has been cancelled
ci / x86_64-windows-release (push) Has been cancelled
ci / aarch64-windows (push) Has been cancelled
2024-11-07 00:09:39 +00:00
José M Rico
54d0ba4183
std: fix Random.enumValueWithIndex of single-variant enum
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
2024-11-06 09:15:56 +00:00
Daniel Hooper
ed04acf90d
Provide a detailed message for invalid arch in target triple (#21921)
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
2024-11-06 03:38:01 +00:00
Jonathan Hallstrom
7ebfc72186 fix type of std_options 2024-11-05 23:46:10 +01:00
Alex Rønne Petersen
89a506a7ef
musl: Don't explicitly pass -fno-unwind-tables -fno-asynchronous-unwind-tables.
These are already handled by build_crt_file().
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
5685a10ded
libunwind: Pass -fPIC -funwind-tables via module options instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
eb14fd8806
libcxx: Pass -fPIC via module options instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
796d4845ff
musl: Pass -fomit-frame-pointer via CrtFileOptions. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
7fef0b4a23
musl: Pass -f(function,data)-sections via CrtFileOptions instead of CFLAGS. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
f973d3e93e
glibc, musl, wasi-libc: Don't explicitly pass -fno-stack-protector.
This is already handled by build_crt_file().
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
2a65b84572
tsan: Handle more Apple targets when picking library name. 2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
0563525b21
tsan: Synchronize CFLAGS with upstream.
In particular:

* -fms-extensions for MinGW
* -fno-builtin
* -fno-emulated-tls for Android 29+
* -fno-exceptions
* -fomit-frame-pointer
* -fvisibility=hidden
2024-11-05 22:41:09 +01:00
Alex Rønne Petersen
bdca2d0f48
llvm: Also apply the nobuiltin attribute for the no_builtin module option.
From `zig build-exe --help`:

  -fno-builtin              Disable implicit builtin knowledge of functions

It seems entirely reasonable and even expected that this option should imply
both no-builtins on functions (which disables transformation of recognized code
patterns to libcalls) and nobuiltin on call sites (which disables transformation
of libcalls to intrinsics). We now match Clang's behavior for -fno-builtin.

In both cases, we're painting with a fairly broad brush by applying this to an
entire module, but it's better than nothing. #21833 proposes a more fine-grained
way to apply nobuiltin.
2024-11-05 22:41:06 +01:00
Alex Rønne Petersen
e88501a090
Compilation: Fix unwind table logic for compiler-rt.
This looks to be a refactoring leftover.
2024-11-05 20:10:12 +01:00
kcbanner
f2b81f57f4 build: increase max_rss to 7.8G
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
2024-11-05 10:03:04 -08:00
Alex Rønne Petersen
7b1d2fa004
Compilation: Also set essential module options when including compiler-rt.o.
Closes #21831.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
b57819118d
Compilation: Move no_builtin to Package.Module.
This option, by its very nature, needs to be attached to a module. If it isn't,
the code in a module could break at random when compiled into an application
that doesn't have this option set.

After this change, skip_linker_dependencies no longer implies no_builtin in the
LLVM backend.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
56b416662a
compiler: Update clangMightShellOutForAssembly() for Clang 19.
Clang only uses the system assembler for nvptx and xcore nowadays.
2024-11-05 14:43:02 +01:00
Alex Rønne Petersen
bd7dda0c55
Merge pull request #21907 from alexrp/valgrind-stuff
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
Add client request support for all architectures supported by Valgrind
2024-11-05 10:03:44 +01:00
Alex Rønne Petersen
f25ea264b7 Revert "test: Add aarch64_be-linux-(none,gnu,musl) to module tests."
This reverts commit 4049be90de.

See: https://github.com/ziglang/zig/issues/21911
2024-11-05 07:15:53 +01:00
Alex Rønne Petersen
bd8ef0036d llvm: Use no-builtins attribute instead of nobuiltin.
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
The former prevents recognizing code patterns and turning them into libcalls,
which is what we want for compiler-rt. The latter is meant to be used on call
sites to prevent them from being turned into intrinsics.

Context: https://github.com/ziglang/zig/issues/21833
2024-11-04 14:17:57 +01:00
Alex Rønne Petersen
4a3611f7d6
Merge pull request #21894 from alexrp/aarch64-big-endian
Disable some failing tests and add `aarch64_be-linux-(none,gnu,musl)` to CI
2024-11-04 13:54:56 +01:00
Alex Rønne Petersen
8a73a965d3
llvm: Add client request support for all archs supported by Valgrind. 2024-11-04 13:53:20 +01:00
Alex Rønne Petersen
2307cf73b0
std.valgrind: Port doClientRequest() to all archs supported by Valgrind. 2024-11-04 12:39:48 +01:00
Alex Rønne Petersen
6b2c8fc688 zig.h: Improve portability of zig_*_windows_teb() helpers.
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
* Make it work for thumb and aarch64.
* Clean up std.os.windows.teb() a bit.

I also updated stage1/zig.h since the changes are backwards-compatible and are
necessary due to the std.os.windows changes that call the newly-added functions.
2024-11-04 11:59:38 +01:00
Alex Rønne Petersen
4050d9bbf9
std.valgrind: Fix some compile errors. 2024-11-04 10:56:32 +01:00
Alex Rønne Petersen
af71694dd9
std.debug: Add handling for armeb, thumb, thumbeb, and aarch64_be. 2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
4049be90de
test: Add aarch64_be-linux-(none,gnu,musl) to module tests. 2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
9d0bb7ada8
test: Disable 128-bit atomics behavior tests on aarch64_be.
See: https://github.com/ziglang/zig/issues/21892
2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
2958a90515
test: Disable some vector behavior tests on aarch64_be.
See: https://github.com/ziglang/zig/issues/21893
2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
2f65c39715
std.simd: Disable vector prefix scan test on aarch64_be.
See: https://github.com/ziglang/zig/issues/21893
2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
b72b81292f
test: Remove some unsupported ohos triples from llvm_targets. 2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
96ea7d3e1c
test: Disable reinterpret packed union on all big endian targets.
See: https://github.com/ziglang/zig/issues/21050
2024-11-04 08:29:42 +01:00
Alex Rønne Petersen
814a41b48f link.Coff: Pass -lldmingw to LLD earlier and regardless of -lc.
The -lldmingw option affects a lot of logic throughout LLD. We need to pass it
for *-windows-gnu even when we're not actually linking MinGW since we're still
using the MinGW ABI with all that that entails. (One particular problem we would
run into is missing handling of stdcall-decorated symbols for 32-bit x86.) Also,
various other LLD options are sensitive to this option, so it's best to pass it
as early as possible.

Closes #11817.
2024-11-04 07:19:11 +01:00
Alex Rønne Petersen
3054486d1d
Merge pull request #21843 from alexrp/callconv-followup
Some checks are pending
ci / x86_64-linux-debug (push) Waiting to run
ci / x86_64-linux-release (push) Waiting to run
ci / aarch64-linux-debug (push) Waiting to run
ci / aarch64-linux-release (push) Waiting to run
ci / x86_64-macos-release (push) Waiting to run
ci / aarch64-macos-debug (push) Waiting to run
ci / aarch64-macos-release (push) Waiting to run
ci / x86_64-windows-debug (push) Waiting to run
ci / x86_64-windows-release (push) Waiting to run
ci / aarch64-windows (push) Waiting to run
Some follow-up work for #21697
2024-11-03 14:27:09 +01:00