PrecomputedValues::zeroize skips qinv (and BoxedMontyForm::zeroize skips its prime p params)
Maintainer thường phản hồi trong vòng 1 ngày
@aviralgarg05 đang làm issue này rồi.
Từ ngày 28/11/2026.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 65/100
Hướng nghiên cứu
Start in src/private_key.rs:114-120 at PrecomputedValues and its Zeroize impl, then trace every use of qinv to see what a type change would affect. Read BoxedMontyForm::zeroize and BoxedMontyParams in crypto-bigint 0.7.11 to understand why the parameters survive; compare storing qinv as a BoxedUint. Done means dropping a PrivateKey wipes the inverse and any owned p parameters, with RSA tests still passing.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In rsa 0.10.0, PrecomputedValues::zeroize (src/private_key.rs:114-120) wipes p, q, dp, and dq, but omits qinv:
pub(crate) struct PrecomputedValues {
pub(crate) p: SecretPrime,
pub(crate) q: SecretPrime,
pub(crate) dp: BoxedUint,
pub(crate) dq: BoxedUint,
pub(crate) qinv: BoxedMontyForm,
}
impl Zeroize for PrecomputedValues {
fn zeroize(&mut self) {
self.p.zeroize();
self.q.zeroize();
self.dp.zeroize();
self.dq.zeroize();
}
}
When a PrivateKey is dropped, $q^{-1} \bmod p$ remains unzeroized in freed heap memory.
Adding self.qinv.zeroize() alone does not wipe the associated parameters either. In crypto-bigint 0.7.11 (src/modular/boxed_monty_form.rs:229-235), BoxedMontyForm::zeroize wipes montgomery_form and skips params:
/// NOTE: This zeroizes the value, but _not_ the associated parameters!
#[cfg(feature = "zeroize")]
impl Zeroize for BoxedMontyForm {
fn zeroize(&mut self) {
self.montgomery_form.zeroize();
}
}
Because qinv is constructed with p_params (BoxedMontyForm::new clones BoxedMontyParams for the secret prime p), and BoxedMontyParams does not zeroize on drop, a separate copy of p (along with one, r2, and mod_inv) is also freed without being wiped. Storing qinv as a BoxedUint (or zeroizing owned BoxedMontyForm parameters on drop) would clear both.
- Ngôn ngữ chính
- Rust
- Star
- 678
- Fork
- 199
- Merge trung bình
- 1 giờ 55 phút
- Pull request đã merge (30 ngày)
- 48
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RustCrypto/RSA
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
RustCrypto/RSA#508 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bring back zeroizationĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
RustCrypto/RSA#507 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
RustCrypto/RSA#423 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
RustCrypto/RSA#364 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
RSA-KEM supportĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
RustCrypto/RSA#323 · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của RustCrypto/RSA
Issue tương tự
-
The new tests repeat each other and one only checks a two-line helperCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mởinfra
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
storytold/wordcraft#9405 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
in-progress
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
area: ai-assistants documentation help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
BetaBots-LLC/latticegate#17 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 94/100
storytold/craft-libs#5594 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
available documentation good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Nixitov/Riptide-Native#932 ·
Maintainer thường phản hồi trong vòng 1 ngày