4 Commits
Author SHA1 Message Date
f6b21a8b27 NIOSSL: enable CA trust roots for FreeBSD (#587)
## Summary

`platformDefaultConfiguration()` in `SSLContext.swift` has branches for
Linux and Android but not FreeBSD. On FreeBSD the function is a no-op:
no CA trust roots are loaded, so every HTTPS client connection fails
immediately with `CERTIFICATE_VERIFY_FAILED`.

`LinuxCABundle.swift` already compiles for FreeBSD (`#if os(Linux) ||
os(FreeBSD)`) and defines `rootCAFilePath`/`rootCADirectoryPath`, but
the search path arrays contained only Linux distro paths — no FreeBSD
path was ever matched, so `rootCAFilePath` and `rootCADirectoryPath`
were always `nil`.

## Changes

**`SSLContext.swift`** — one line:
```diff
-#if os(Linux)
+#if os(Linux) || os(FreeBSD)
```

**`LinuxCABundle.swift`** — add FreeBSD paths to both search arrays:
```swift
// rootCAFileSearchPaths additions:
"/usr/local/etc/ssl/cert.pem",          // security/openssl port
"/etc/ssl/cert.pem",                     // base system (FreeBSD 14+)
"/usr/local/share/certs/ca-root-nss.crt", // security/ca_root_nss port

// rootCADirectorySearchPaths addition:
"/usr/local/share/certs",               // security/ca_root_nss port
```

## Testing

Verified on FreeBSD 15.1 aarch64 (NXP DPAA2, Swift 6.3.2-RELEASE). With
this fix, all HTTPS requests to `swift.org` and `download.swift.org`
succeed. Without it, every connection fails at the TLS handshake
regardless of which CA bundle is installed.

Tested as part of the swiftly FreeBSD port (swiftlang/swiftly#565),
where `HTTPClientTests` makes live HTTPS requests:

```
✔ Test getSwiftOrgGPGKeys() passed after 0.700 seconds.
✔ Test getSwiftToolchain() passed after 109.816 seconds.
✔ Test getSwiftlyLinuxReleases(url:) with 6 test cases passed after 31.636 seconds.
✔ Suite HTTPClientTests passed after 183.785 seconds.
```

🤖 Generated with [Claude Code](https://claude.ai/claude-code)

---------

Co-authored-by: lushan.ai <kequeue@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
2026-06-29 08:58:12 +01:00
Rick Newton-Rogers 61cfaf9798 Migrate to GitHub Actions (#487)
Migrate CI to use GitHub Actions.

### Motivation:

To migrate to GitHub actions and centralised infrastructure.

### Modifications:

Changes of note:
* Disable warnings-as-errors until issues with recent NIO changes are
resolved
* Adopt swift-format using rules from SwiftNIO
* Remove scripts which are no longer needed

### Result:

Feature parity with old CI minus allocation tests which remain on the
old CI.
2024-10-25 09:32:23 +01:00
Cory Benfield c359ba56f7 Clean up imports and dependencies (#319)
Motivation:

With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.

Modifications:

- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded and NIOPosix imports where necessary in tests.
- Extended soundness script to detect NIO imports.
- Note that the main modules still depend on NIO, which is necessary
for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
2021-09-14 14:55:25 +01:00
Cory Benfield 45b1f82692 Rename everything. (#75)
Motivation:

Unfortunately, it turns out that the word "OpenSSL" just ended up everwhere
in our codebase, including in the names of our types. This was, in hindsight,
a bit of an unfortunate bit of naming.

We should take this breaking opportunity to give these types better names.
In particular, we should stop identifying them as belonging to any library
other than this one, "NIOSSL". That way we become somewhat independent of
the specific way that this library is implemented.

Modifications:

Renamed a bunch of stuff. Internal types mostly got their names changed
from OpenSSL->BoringSSL. External types generally got their names changed
to "NIOSSL", except where those types directly reflected a BoringSSL
implementation detail, specifically in the errors.

The main name changes are:

SSLContext -> NIOSSLContext
OpenSSLError -> BoringSSLError
NIOOpenSSLError -> NIOSSLError
OpenSSLInternalError -> BoringSSLInternalError
OpenSSLPKCS12Bundle -> NIOSSLPKCS12Bundle
OpenSSLPassphraseCallback -> NIOSSLPassphraseCallback
OpenSSLPassphraseSetter -> NIOSSLPassphraseSetter
OpenSSLPrivateKey -> NIOSSLPrivateKey
OpenSSLPublicKey -> NIOSSLPublicKey
OpenSSLCertificate -> NIOSSLCertificate
OpenSSLVerificationResult -> NIOSSLVerificationResult
OpenSSLVerificationCallback -> NIOSSLVerificationCallback
OpenSSLCertificateSource -> NIOSSLCertificateSource
OpenSSLPrivateKeySource -> NIOSSLPrivateKeySource
OpenSSLTrustRoots -> NIOSSLTrustRoots
OpenSSLSerializationFormats -> NIOSSLSerializationFormats
OpenSSLHandler -> NIOSSLHandler
OpenSSLClientHandler -> NIOSSLClientHandler
OpenSSLServerHandler -> NIOSSLServerHandler

Oh, and renamed the module too: it's now NIOSSL, instead of NIOOpenSSL.

Result:

Users have better names for things.
2019-03-01 17:25:33 +00:00