Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use aws-lc-rs instead of ring for TLS #4734

Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
name: "cargo clippy | windows"
steps:
- uses: actions/checkout@v4
- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Comment on lines +85 to +86
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zanieb I'm not very familiar with maturin, do you think installing NASM is needed for the build-binaries Windows job too?

windows:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-build') }}
runs-on: windows-latest
strategy:
matrix:
platform:
- target: x86_64-pc-windows-msvc
arch: x64
- target: i686-pc-windows-msvc
arch: x86

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maturin calls cargo build, so they same rules should apply whether it's maturin or not.

- name: "Install Rust toolchain"
run: rustup target add x86_64-pc-windows-msvc
- name: Load xwin cache
Expand Down Expand Up @@ -216,6 +218,9 @@ jobs:
run: |
Copy-Item -Path "${{ github.workspace }}" -Destination "${{ env.DEV_DRIVE }}/uv" -Recurse

- name: "Install nasm"
uses: ilammy/setup-nasm@v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self we should audit this action and consider just implementing it ourself if the install is straightforward

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


- name: "Install Rust toolchain"
working-directory: ${{ env.DEV_DRIVE }}/uv
env:
Expand Down Expand Up @@ -412,7 +417,7 @@ jobs:
steps:
- name: Create Dev Drive using ReFS
run: |
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 10GB |
$Volume = New-VHD -Path C:/uv_dev_drive.vhdx -SizeBytes 12GB |
kcon-stackav marked this conversation as resolved.
Show resolved Hide resolved
Mount-VHD -Passthru |
Initialize-Disk -Passthru |
New-Partition -AssignDriveLetter -UseMaximumSize |
Expand All @@ -429,6 +434,9 @@ jobs:

- uses: rui314/setup-mold@v1

- name: "Install nasm"
uses: ilammy/setup-nasm@v1

- uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.DEV_DRIVE }}/uv
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ See the [Python](#python) section for instructions on installing the Python vers

You can install CMake from the [installers](https://cmake.org/download/) or with `pipx install cmake`.

Only on Windows, you also need to install the [Netwide Assembler (NASM)](https://nasm.us/) and add its installation directory to your PATH:

```
set PATH="C:\Program Files\NASM;%PATH%"
```

## Testing

For running tests, we recommend [nextest](https://nexte.st/).
Expand Down
164 changes: 162 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,13 @@ quote = { version = "1.0.36" }
rayon = { version = "1.8.0" }
reflink-copy = { version = "0.1.15" }
regex = { version = "1.10.2" }
reqwest = { version = "0.12.3", default-features = false, features = ["json", "gzip", "brotli", "stream", "rustls-tls", "rustls-tls-native-roots"] }
reqwest = { version = "0.12.5", default-features = false, features = ["json", "gzip", "brotli", "stream", "rustls-tls", "rustls-tls-native-roots"] }
reqwest-middleware = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "21ceec9a5fd2e8d6f71c3ea2999078fecbd13cbe" }
reqwest-retry = { git = "https://github.com/astral-sh/reqwest-middleware", rev = "21ceec9a5fd2e8d6f71c3ea2999078fecbd13cbe" }
rkyv = { version = "0.7.43", features = ["strict", "validation"] }
rmp-serde = { version = "1.1.2" }
rust-netrc = { version = "0.1.1" }
rustls = { version = "0.23.10", features = ["aws_lc_rs"] }
rustc-hash = { version = "2.0.0" }
same-file = { version = "1.0.6" }
schemars = { version = "0.8.16", features = ["url"] }
Expand Down
1 change: 1 addition & 0 deletions crates/uv-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ itertools = { workspace = true }
reqwest = { workspace = true }
reqwest-middleware = { workspace = true }
reqwest-retry = { workspace = true }
rustls = { workspace = true }
rkyv = { workspace = true }
rmp-serde = { workspace = true }
serde = { workspace = true }
Expand Down
8 changes: 8 additions & 0 deletions crates/uv-client/src/base_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use reqwest_retry::policies::ExponentialBackoff;
use reqwest_retry::{
DefaultRetryableStrategy, RetryTransientMiddleware, Retryable, RetryableStrategy,
};
use rustls::crypto::{aws_lc_rs, CryptoProvider};
use tracing::debug;

use pep508_rs::MarkerEnvironment;
Expand Down Expand Up @@ -136,6 +137,13 @@ impl<'a> BaseClientBuilder<'a> {

// Initialize the base client.
let client = self.client.clone().unwrap_or_else(|| {
if CryptoProvider::get_default().is_none() {
// Use aws_lc_rs as the default TLS provider to support more SSL cert algorithms
aws_lc_rs::default_provider()
.install_default()
.expect("failed to install aws_lc_rs as default TLS provider");
kcon-stackav marked this conversation as resolved.
Show resolved Hide resolved
};

// Check for the presence of an `SSL_CERT_FILE`.
let ssl_cert_file_exists = env::var_os("SSL_CERT_FILE").is_some_and(|path| {
let path_exists = Path::new(&path).exists();
Expand Down
Loading