From 037b9dda75de6e37d15b8fdf2c615418b848b36e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 30 Oct 2023 09:45:18 +0100 Subject: [PATCH 1/5] Update to ring 0.17 --- Cargo.toml | 2 +- src/lib.rs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1c79e4d..a2d4483 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ default = ["hyper-rustls"] base64 = "0.21.0" hyper = { version = "0.14.18", features = ["client", "http1", "http2"] } hyper-rustls = { version = "0.24", default-features = false, features = ["http1", "http2", "native-tokio", "tls12"], optional = true } -ring = { version = "0.16.20", features = ["std"] } +ring = { version = "0.17", features = ["std"] } serde = { version = "1.0.104", features = ["derive"] } serde_json = "1.0.78" thiserror = "1.0.30" diff --git a/src/lib.rs b/src/lib.rs index 7e33683..a5bf8d6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -508,7 +508,7 @@ impl Key { fn generate() -> Result<(Self, pkcs8::Document), Error> { let rng = SystemRandom::new(); let pkcs8 = EcdsaKeyPair::generate_pkcs8(&ECDSA_P256_SHA256_FIXED_SIGNING, &rng)?; - let key = EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_FIXED_SIGNING, pkcs8.as_ref())?; + let key = EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_FIXED_SIGNING, pkcs8.as_ref(), &rng)?; let thumb = BASE64_URL_SAFE_NO_PAD.encode(Jwk::thumb_sha256(&key)?); Ok(( @@ -523,11 +523,12 @@ impl Key { } fn from_pkcs8_der(pkcs8_der: &[u8]) -> Result { - let key = EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_FIXED_SIGNING, pkcs8_der)?; + let rng = SystemRandom::new(); + let key = EcdsaKeyPair::from_pkcs8(&ECDSA_P256_SHA256_FIXED_SIGNING, pkcs8_der, &rng)?; let thumb = BASE64_URL_SAFE_NO_PAD.encode(Jwk::thumb_sha256(&key)?); Ok(Self { - rng: SystemRandom::new(), + rng, signing_algorithm: SigningAlgorithm::Es256, inner: key, thumb, From 83aac18b08dd489f0dd2ce3bab1b5e3f06a09860 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 30 Oct 2023 09:45:30 +0100 Subject: [PATCH 2/5] Bump version to 0.4.1 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a2d4483..865be14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "instant-acme" -version = "0.4.0" +version = "0.4.1" edition = "2021" rust-version = "1.63" license = "Apache-2.0" From d5384bb63e2557fac8154f728f959d442120fb52 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 30 Oct 2023 09:46:56 +0100 Subject: [PATCH 3/5] Replace use of actions-rs/toolchain with dtolnay/rust-toolchain --- .github/workflows/rust.yml | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1466b77..e24862c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,11 +23,9 @@ jobs: steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: ${{ matrix.rust }} - override: true - uses: actions-rs/cargo@v1 with: command: build @@ -37,11 +35,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@master with: - profile: minimal toolchain: 1.63.0 - override: true - uses: actions-rs/cargo@v1 with: command: check @@ -51,11 +47,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@stable with: - profile: minimal - toolchain: stable - override: true components: rustfmt, clippy - uses: actions-rs/cargo@v1 with: From 2a08c693e6bd5c3852ee940ea817967e7098e51c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 30 Oct 2023 09:48:05 +0100 Subject: [PATCH 4/5] Remove usage of actions-rs/cargo --- .github/workflows/rust.yml | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e24862c..62989e8 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,10 +26,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} - - uses: actions-rs/cargo@v1 - with: - command: build - args: --all-features --all-targets + - run: cargo test --all-features --all-targets msrv: runs-on: ubuntu-latest @@ -38,10 +35,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: toolchain: 1.63.0 - - uses: actions-rs/cargo@v1 - with: - command: check - args: --lib --all-features + - run: cargo check --lib --all-features lint: runs-on: ubuntu-latest @@ -50,15 +44,8 @@ jobs: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - uses: actions-rs/cargo@v1 - if: always() - with: - command: clippy - args: --workspace --all-targets --all-features -- -D warnings + - run: cargo fmt --all -- --check + - run: cargo clippy --all-targets --all-features -- -D warnings audit: runs-on: ubuntu-latest From e39f755d86ed34dbcbfaf9a1fcb695b66bc8793d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 30 Oct 2023 09:48:30 +0100 Subject: [PATCH 5/5] Bump version of actions/checkout to v4 --- .github/workflows/rust.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 62989e8..de46941 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -22,7 +22,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: ${{ matrix.rust }} @@ -31,7 +31,7 @@ jobs: msrv: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: toolchain: 1.63.0 @@ -40,7 +40,7 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable with: components: rustfmt, clippy @@ -50,5 +50,5 @@ jobs: audit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1