Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
11 changes: 11 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ jobs:
toolchain: 1.85.0
- run: cargo clippy --features=crypto_nossl,hw_tests,dangerous_hw_tests --all-targets -- -D clippy::all -D unused_imports -D warnings -D clippy::style

clippy-unsafe-parser:
name: cargo clippy unsafe-parser
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
toolchain: 1.85.0
- run: cargo clippy --features=unsafe_parser,hw_tests,dangerous_hw_tests --all-targets -- -D clippy::all -D unused_imports -D warnings -D clippy::style

readme:
name: cargo rdme
runs-on: ubuntu-latest
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,86 @@ jobs:
flag: --release
features:
- crypto_nossl

sw-unsafe-parser:
name: sw unsafe-parser ${{ matrix.runner }} ${{ matrix.toolchain }} ${{ matrix.profile.name }} ${{ matrix.features }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo test ${{ matrix.profile.flag }} --features=${{ matrix.features }}

strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-15-intel
- windows-latest
toolchain:
- 1.85.0
- stable
profile:
- name: debug
- name: release
flag: --release
features:
- unsafe_parser

sw-unsafe-parser-openssl:
name: sw unsafe-parser-openssl ${{ matrix.runner }} ${{ matrix.toolchain }} ${{ matrix.profile.name }} ${{ matrix.features }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo test ${{ matrix.profile.flag }} --features=${{ matrix.features }}

strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-15-intel
- windows-latest
toolchain:
- 1.85.0
- stable
profile:
- name: debug
- name: release
flag: --release
features:
- unsafe_parser
- openssl

sw-unsafe-parser-crypto_nossl:
name: sw unsafe-parser-crypto-nossl ${{ matrix.runner }} ${{ matrix.toolchain }} ${{ matrix.profile.name }} ${{ matrix.features }}
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.toolchain }}
- run: cargo test ${{ matrix.profile.flag }} --features=${{ matrix.features }}

strategy:
fail-fast: false
matrix:
runner:
- ubuntu-latest
- macos-15-intel
- windows-latest
toolchain:
- 1.85.0
- stable
profile:
- name: debug
- name: release
flag: --release
features:
- unsafe_parser
- crypto_nossl
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sev = ["dep:rdrand"]
snp = []
crypto_nossl = ["dep:p384", "dep:rsa", "dep:sha2", "dep:x509-cert"]
serde = ["dep:serde", "dep:serde-big-array", "dep:serde_bytes"]
unsafe_parser = []

[target.'cfg(target_os = "linux")'.dependencies]
iocuddle = "^0.1"
Expand Down
5 changes: 5 additions & 0 deletions src/certs/snp/ecdsa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ impl Encoder<()> for Signature {
writer.write_bytes(self.r, ())?;
writer.write_bytes(self.s, ())?;
// Reserved bytes
#[cfg(not(feature = "unsafe_parser"))]
writer.skip_bytes::<368>()?;

#[cfg(feature = "unsafe_parser")]
writer.write_bytes([0u8; 368], ())?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks like 368 "magic number" shows up at least twice --> use constant?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

use of constants is a good idea for all the reserved fields, That's one actionable item I can take.


Ok(())
}
}
Expand Down
Loading