Skip to content

Commit 6bb20fc

Browse files
committed
Merge remote-tracking branch 'rust-crypto/master'
2 parents 353b97b + 13bb540 commit 6bb20fc

File tree

6 files changed

+81
-10
lines changed

6 files changed

+81
-10
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ members = [
1717
[patch.crates-io]
1818
digest = { path = "digest" }
1919
signature = { path = "signature" }
20+
21+
# https://github.com/RustCrypto/utils/pull/1192
22+
block-buffer = { git = "https://github.com/RustCrypto/utils.git" }

digest/src/buffer_macros/fixed.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ macro_rules! buffer_fixed {
6060
$crate::buffer_fixed!(
6161
impl_inner: $name$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?($core_ty);
6262
BaseFixedTraits AlgorithmName Default Clone HashMarker
63-
Reset FixedOutputReset SerializableState $($trait_name)*;
63+
Reset FixedOutputReset SerializableState ZeroizeOnDrop $($trait_name)*;
6464
);
6565
};
6666

@@ -476,5 +476,30 @@ macro_rules! buffer_fixed {
476476
}
477477

478478
$crate::buffer_fixed!(impl_inner: $name$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?($core_ty); $($trait_name)*;);
479-
}
479+
};
480+
481+
// Implements `ZeroizeOnDrop`
482+
(
483+
impl_inner: $name:ident
484+
$(< $( $lt:tt $( : $clt:tt $(+ $dlt:tt )* )? ),+ >)?
485+
($core_ty:ty);
486+
ZeroizeOnDrop $($trait_name:ident)*;
487+
) => {
488+
// Verify that `$core_ty` and `Buffer<$core_ty>` implement `ZeroizeOnDrop`
489+
#[cfg(feature = "zeroize")]
490+
const _: () = {
491+
fn check_core$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?(v: &$core_ty) {
492+
v as &dyn $crate::zeroize::ZeroizeOnDrop;
493+
}
494+
495+
fn check_buffer$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?(v: &$crate::block_api::Buffer<$core_ty>) {
496+
v as &dyn $crate::zeroize::ZeroizeOnDrop;
497+
}
498+
};
499+
500+
#[cfg(feature = "zeroize")]
501+
impl$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $crate::zeroize::ZeroizeOnDrop for $name$(< $( $lt ),+ >)? {}
502+
503+
$crate::buffer_fixed!(impl_inner: $name$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)?($core_ty); $($trait_name)*;);
504+
};
480505
}

digest/tests/dummy_fixed.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ mod block_api {
7575
})
7676
}
7777
}
78+
79+
#[cfg(feature = "zeroize")]
80+
impl Drop for FixedHashCore {
81+
fn drop(&mut self) {
82+
use zeroize::Zeroize;
83+
self.state.zeroize();
84+
}
85+
}
86+
87+
#[cfg(feature = "zeroize")]
88+
impl zeroize::ZeroizeOnDrop for FixedHashCore {}
7889
}
7990

8091
digest::buffer_fixed!(
@@ -99,3 +110,11 @@ digest::buffer_fixed!(
99110
oid: "0.1.2.3.4.5";
100111
impl: FixedHashTraits;
101112
);
113+
114+
#[cfg(feature = "zeroize")]
115+
/// check for `ZeroizeOnDrop` implementations
116+
const _: () = {
117+
const fn check_zeroize<T: zeroize::ZeroizeOnDrop>() {}
118+
check_zeroize::<FixedHashWithSer>();
119+
check_zeroize::<FixedHashWithOidSer>();
120+
};

elliptic-curve/src/arithmetic.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::{
44
Curve, CurveGroup, Error, FieldBytes, Group, NonZeroScalar, PrimeCurve, ScalarPrimitive,
5-
ops::{Invert, LinearCombination, Mul, Reduce, ShrAssign},
5+
ops::{Invert, LinearCombination, Mul, Reduce},
66
point::{AffineCoordinates, NonIdentity},
77
scalar::{FromUintUnchecked, IsHigh},
88
};
@@ -81,7 +81,6 @@ pub trait CurveArithmetic: Curve {
8181
+ for<'a> Mul<&'a Self::ProjectivePoint, Output = Self::ProjectivePoint>
8282
+ PartialOrd
8383
+ Reduce<Self::Uint, Bytes = FieldBytes<Self>>
84-
+ ShrAssign<usize>
8584
+ TryInto<NonZeroScalar<Self>, Error = Error>
8685
+ ff::Field
8786
+ ff::PrimeField<Repr = FieldBytes<Self>>;

signature/README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,30 @@
77
![Rust Version][rustc-image]
88
[![Project Chat][chat-image]][chat-link]
99

10-
This crate contains traits which provide generic, object-safe APIs for
10+
This crate contains traits which provide generic type-safe APIs for
1111
generating and verifying [digital signatures].
1212

13-
Used by the [`dsa`], [`ecdsa`], [`ed25519`], and [`rsa`] crates maintained by
14-
the [RustCrypto] organization, as well as [`ed25519-dalek`].
13+
## Supported crates
14+
15+
The following crates are implemented using traits from the `signature` crate:
16+
17+
### RustCrypto crates
18+
19+
- [`dsa`]
20+
- [`ecdsa`]
21+
- [`ed25519`]
22+
- [`ed448`]
23+
- [`ed448-goldilocks`]
24+
- [`lms`]
25+
- [`ml-dsa`]
26+
- [`slh-dsa`]
27+
- [`sm2`]
28+
- [`rsa`]
29+
30+
### Third-party crates
31+
32+
- [`ed25519-dalek`]
33+
- [`yubihsm`]
1534

1635
## SemVer Policy Exemptions
1736

@@ -55,5 +74,12 @@ dual licensed as above, without any additional terms or conditions.
5574
[`dsa`]: https://github.com/RustCrypto/signatures/tree/master/dsa
5675
[`ecdsa`]: https://github.com/RustCrypto/signatures/tree/master/ecdsa
5776
[`ed25519`]: https://github.com/RustCrypto/signatures/tree/master/ed25519
58-
[`ed25519-dalek`]: https://github.com/dalek-cryptography/ed25519-dalek
77+
[`ed25519-dalek`]: https://github.com/dalek-cryptography/curve25519-dalek/tree/main/ed25519-dalek
78+
[`ed448`]: https://github.com/RustCrypto/elliptic-curves/tree/master/ed448
79+
[`ed448-goldilocks`]: https://github.com/RustCrypto/elliptic-curves/tree/master/ed448-goldilocks
80+
[`lms`]: https://github.com/RustCrypto/signatures/tree/master/lms
81+
[`ml-dsa`]: https://github.com/RustCrypto/signatures/tree/master/ml-dsa
5982
[`rsa`]: https://github.com/RustCrypto/RSA
83+
[`slh-dsa`]: https://github.com/RustCrypto/signatures/tree/master/slh-dsa
84+
[`sm2`]: https://github.com/RustCrypto/elliptic-curves/tree/master/sm2
85+
[`yubihsm`]: https://github.com/iqlusioninc/yubihsm.rs

0 commit comments

Comments
 (0)