aboutsummaryrefslogtreecommitdiff
path: root/lib/std/crypto/Certificate
AgeCommit message (Collapse)Author
2025-10-29std.Io.Threaded: fix compilation failures on WindowsAndrew Kelley
2025-10-29std: fix macos compilation errorsAndrew Kelley
2025-10-29std.crypto.Certificate.Bundle: remove use of File.readAllAndrew Kelley
2025-10-27remove all Oracle Solaris supportAlex Rønne Petersen
There is no straightforward way for the Zig team to access the Solaris system headers; to do this, one has to create an Oracle account, accept their EULA to download the installer ISO, and finally install it on a machine or VM. We do not have to jump through hoops like this for any other OS that we support, and no one on the team has expressed willingness to do it. As a result, we cannot audit any Solaris contributions to std.c or other similarly sensitive parts of the standard library. The best we would be able to do is assume that Solaris and illumos are 100% compatible with no way to verify that assumption. But at that point, the solaris and illumos OS tags would be functionally identical anyway. For Solaris especially, any contributions that involve APIs introduced after the OS was made closed-source would also be inherently more risky than equivalent contributions for other proprietary OSs due to the case of Google LLC v. Oracle America, Inc., wherein Oracle clearly demonstrated its willingness to pursue legal action against entities that merely copy API declarations. Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in maintenance mode since, presumably to be retired completely sometime in the 2030s. For these reasons, this commit removes all Oracle Solaris support. Anyone who still wishes to use Zig on Solaris can try their luck by simply using illumos instead of solaris in target triples - chances are it'll work. But there will be no effort from the Zig team to support this use case; we recommend that people move to illumos instead.
2025-08-30compiler: fix macos buildAndrew Kelley
2025-08-29std.Io: delete GenericReaderAndrew Kelley
and delete deprecated alias std.io
2025-06-05std.crypto.Certificate.Bundle: haiku supportElaine Gibson
2025-03-11std: Add support for SerenityOS in various placesLinus Groh
Not nearly the entire downstream patchset but these are completely uncontroversial and known to work.
2025-02-20rescanMac: Avoid overallocating/overreading by millions of bytesRyan Liptak
readAtLeast is greedy and will read the entire length of the buffer if it can. However, reading past the end of the cert in this case is useless, so reading the full length of the buffer just puts an increasingly large (due to the growth algorithm of ArrayList) collection of wasted bytes after each cert in cb.bytes. In practical terms, this ends up saving potentially millions of bytes of wasted reads/allocations. In my testing, after reading the keychain files on my machine, cb.bytes ends up with these capacities: - Before: cb.bytes.capacity = 32720747 - After: cb.bytes.capacity = 251937 That's a decrease of 99.2% Additionally, swaps to readNoEof since it should be an error to hit EOF without reading the full cert size.
2025-02-18Skip empty/invalid records/certs in MacOS keychain filesRyan Liptak
In the original PR that implemented this (https://github.com/ziglang/zig/pull/14325), it included a list of references for the keychain format. Multiple of those references include the checks that are added in this commit, and empirically this fixes the loading of a real keychain file that was previously failing (it had both a record with offset 0 and a record with cert_size 0). Fixes #22870
2025-02-09Read System.keychain as well as SystemRootCertificates.keychain for MacOS CA ↵Don
Bundle
2024-09-12Replace deprecated default initializations with decl literalsLinus Groh
2024-07-19std.c reorganizationAndrew Kelley
It is now composed of these main sections: * Declarations that are shared among all operating systems. * Declarations that have the same name, but different type signatures depending on the operating system. Often multiple operating systems share the same type signatures however. * Declarations that are specific to a single operating system. - These are imported one per line so you can see where they come from, protected by a comptime block to prevent accessing the wrong one. Closes #19352 by changing the convention to making types `void` and functions `{}`, so that it becomes possible to update `@hasDecl` sites to use `@TypeOf(f) != void` or `T != void`. Happily, this ended up removing some duplicate logic and update some bitrotted feature detection checks. A handful of types have been modified to gain namespacing and type safety. This is a breaking change. Oh, and the last usage of `usingnamespace` site is eliminated.
2024-07-15Better implementation of GetLastError. (#20623)Lucas Santos
Instead of calling the dynamically loaded kernel32.GetLastError, we can extract it from the TEB. As shown by [Wine](https://github.com/wine-mirror/wine/blob/34b1606019982b71818780bc84b76460f650af31/include/winternl.h#L439), the last error lives at offset 0x34 of the TEB in 32-bit Windows and at offset 0x68 in 64-bit Windows.
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-02-04x86_64: fix errors compiling the compilerJacob Young
This fixes issues targetting both `x86_64-linux` and `x86_64-macos` with the self-hosted backend.
2024-01-22std.io: replace readStructBig with readStructEndianTristan Ross
2023-11-22update for the std.fs.Dir changesAndrew Kelley
2023-11-03x86_64: fix std test failuresJacob Young
2023-10-31std.builtin.Endian: make the tags lower caseAndrew Kelley
Let's take this breaking change opportunity to fix the style of this enum.
2023-10-31mem: fix ub in writeIntJacob Young
Use inline to vastly simplify the exposed API. This allows a comptime-known endian parameter to be propogated, making extra functions for a specific endianness completely unnecessary.
2023-10-22Revert "Revert "Merge pull request #17637 from jacobly0/x86_64-test-std""Jacob Young
This reverts commit 6f0198cadbe29294f2bf3153a27beebd64377566.
2023-10-22Revert "Merge pull request #17637 from jacobly0/x86_64-test-std"Andrew Kelley
This reverts commit 0c99ba1eab63865592bb084feb271cd4e4b0357e, reversing changes made to 5f92b070bf284f1493b1b5d433dd3adde2f46727. This caused a CI failure when it landed in master branch due to a 128-bit `@byteSwap` in std.mem.
2023-10-21x86_64: fix bugs and disable erroring testsJacob Young
2023-10-18std certs: solaris can use the BSD pathAndrew Kelley
2023-10-02Add illumos OS tagStephen Gregoratto
- Adds `illumos` to the `Target.Os.Tag` enum. A new function, `isSolarish` has been added that returns true if the tag is either Solaris or Illumos. This matches the naming convention found in Rust's `libc` crate[1]. - Add the tag wherever `.solaris` is being checked against. - Check for the C pre-processor macro `__illumos__` in CMake to set the proper target tuple. Illumos distros patch their compilers to have this in the "built-in" set (verified with `echo | cc -dM -E -`). Alternatively you could check the output of `uname -o`. Right now, both Solaris and Illumos import from `c/solaris.zig`. In the future it may be worth putting the shared ABI bits in a base file, and mixing that in with specific `c/solaris.zig`/`c/illumos.zig` files. [1]: https://github.com/rust-lang/libc/tree/6e02a329a2a27f6887ea86952f389ca11e06448c/src/unix/solarish
2023-09-30solaris: load CA certs fileRyan Zezeski
2023-07-02tls certificates: support more BSDsMichael Dusan
- add support for freebsd, netbsd, dragonfly - refactor rescanOpenBSD -> rescanBSD - make os-specific rescan*() non-public closes #16279
2023-06-29openbsd: add root certificate scanningMichael Dusan
patch by @bilaliscarioth, thank you! closes #16168
2023-06-24all: migrate code to new cast builtin syntaxmlugg
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-05-25std.fs.file: Rename File.Kind enum values to snake caseLinus Groh
2023-05-22Ignore certificates with unknown OID (#15539)DraagrenKirneh
* Ignore certificates with unknown OID * switch directly after catch
2023-04-17add explicit error union for Bundle.rescan and associated functionsNameless
2023-01-17Add std.os.darwin.cssmfn ⌃ ⌥
2023-01-17std.crypto.Certificate.Bundle: use parseCert in rescanWindowsfn ⌃ ⌥
2023-01-17std.crypto.Certificate.Bundle: clear bundle before macOS rescanfn ⌃ ⌥
2023-01-17clean up windows cert scanningAndrew Kelley
* keep helper functions out of the DLL bindings APIs * unify the logic for linux and windows certificate scanning with regards to error handling
2023-01-17windows root certificate scanningstar-tek-mb
2023-01-16Find system-installed root SSL certificates on macOS (#14325)fn ⌃ ⌥
2023-01-15std.crypto.Certificate.Bundle: add more Linux directoriesAndrew Kelley
Thanks to the Go project for finding all these paths.
2023-01-02std.crypto.tls.Certificate: make the current time a parameterAndrew Kelley
2023-01-02std.crypto.Certificate.Bundle: fix 32-bit buildAndrew Kelley
2023-01-02add url parsing to the std libAndrew Kelley
2023-01-02remove std.crypto.derAndrew Kelley
Only a little bit of generalized logic for DER encoding is needed and so it can live inside the Certificate namespace. This commit removes the generic "parse object id" function which is no longer used in favor of more specific, smaller sets of object ids used with ComptimeStringMap.
2023-01-02std.crypto.tls.Certificate: explicit error set for verifyAndrew Kelley
2023-01-02std.crypto.tls.Certificate: verify time validityAndrew Kelley
When scanning the file system for root certificates, expired certificates are skipped and therefore not used for verification in TLS sessions. There is only this one check, however, so a long-running server will need to periodically rescan for a new Certificate.Bundle and strategically start using it for new sessions. In this commit I made the judgement call that applications would like to opt-in to root certificate rescanning at a point in time that makes sense for that application, as opposed to having the system clock potentially start causing connections to fail. Certificate verification checks the subject only, as opposed to both the subject and the issuer. The idea is that the trust chain analysis will always check the subject, leading to every certificate in the chain's validity being checked exactly once, with the root certificate's validity checked upon scanning. Furthermore, this commit adjusts the scanning logic to fully parse certificates, even though only the subject is technically needed. This allows relying on parsing to succeed later on.
2023-01-02std.crypto.tls: validate previous certificateAndrew Kelley