Skip to content

Make #![no_std] unconditional - #784

Merged
tarcieri merged 1 commit into
masterfrom
unconditional-no_std
Nov 7, 2026
Merged

tarcieri merged 1 commit into
masterfrom
unconditional-no_std

Conversation

@tarcieri

@tarcieri tarcieri commented Nov 7, 2026

Copy link
Copy Markdown
Member

Previously it was gated on not(test).

Only a tiny number of changes, mostly just imports, are needed to eliminate the conditional gating.

@codecov

codecov Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.29%. Comparing base (6ab482b) to head (cc45f7b).

Files with missing lines Patch % Lines
src/algorithms/rsa.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #784      +/-   ##
==========================================
- Coverage   90.29%   90.29%   -0.01%     
==========================================
  Files          29       29              
  Lines        4091     4090       -1     
==========================================
- Hits         3694     3693       -1     
  Misses        397      397              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tarcieri
tarcieri force-pushed the unconditional-no_std branch 2 times, most recently from 0176ace to a7ca7a5 Compare November 7, 2026 04:56
Previously it was gated on `not(test)`.

Only a tiny number of changes, mostly just imports, are needed to
eliminate the conditional gating.
@tarcieri
tarcieri force-pushed the unconditional-no_std branch from a7ca7a5 to cc45f7b Compare November 7, 2026 05:01
@tarcieri
tarcieri merged commit 58c89a6 into master Nov 7, 2026
15 checks passed
@tarcieri
tarcieri deleted the unconditional-no_std branch November 7, 2026 05:18
kaidokert added a commit to kaidokert/RSA that referenced this pull request Nov 8, 2026
#82)

* Add `PrivateKey`/`PublicKey` inherent methods for algorithms (RustCrypto#638)

Adds algorithm-specific inherent methods for encryption and signing
prefixed with the algorithm name, e.g. `pkcs1v15_decrypt`,
`pkcs1v15_sign`, as an alternative to the `PaddingScheme` and
`SignatureScheme` traits.

We already have an entirely separate trait-based API from
`PaddingScheme` and `SignatureScheme`, namely traits like
`RandomizedEncryptor`, `RandomizedDecryptor`, and `Decryptor`, along
with the traits from the `signature` crate. These traits are well-typed
and enforce usage of a particular algorithm's family of types, but also
seem to have overlapping responsibilities / use cases to the
`PaddingScheme` and `SignatureScheme` traits.

The current `PaddingScheme` and `SignatureScheme` traits do let you mix
encryption and signing operations with a single key type (along with
different algorithms), but they're a little awkward to use and I don't
think we're getting a whole lot out of the trait-based abstraction they
provide which isn't provided better by the aforementioned well-typed
traits.

The goal of being able to execute any operation of any algorithm you
want on a given key type can also be met by just having a bunch of
methods which do exactly what you want, which is what this PR proposes.

Fork adaptation: the inherent methods are on the alloc key types only and
are gated on `alloc`. The doc examples that call `Generate::generate` need
`keygen` as well as `getrandom`, since the fork gates `Generate` on
`keygen`. `pss_verify_prehash` and `pkcs1v15_verify_prehash` delegate to
the fork's `Pss` and `Pkcs1v15Sign` verify paths, which perform the same
checks; the fork has no byte-slice `verify` helpers. Upstream's README
hunk goes to UPSTREAM_README.md.

(cherry picked from commit 6ab482b)

* Make `#![no_std]` unconditional (RustCrypto#784)

Previously it was gated on `not(test)`.

Only a tiny number of changes, mostly just imports, are needed to
eliminate the conditional gating.

Fork adaptation: the one conflict is a test the fork had already moved to
`core::mem::swap`; it takes upstream's `mem::swap` with the new import.

(cherry picked from commit 58c89a6)

* Test the per-algorithm inherent key methods

Upstream covers the new PublicKey/PrivateKey methods only from doc
examples, which the coverage job does not run, so project coverage fell
below the codecov target. Round-trip each method, with and without an
explicit RNG, plus the hash-length and wrong-message rejections.

---------

Co-authored-by: Tony Arcieri <bascule@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant