From a0b8f38ab54ac451646aa00cd5e91b6c76f22a84 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:57:19 +0200 Subject: Merging upstream version 1.72.1+dfsg1. Signed-off-by: Daniel Baumann --- vendor/ecdsa/.cargo-checksum.json | 2 +- vendor/ecdsa/CHANGELOG.md | 21 ++++++++++++++++++++ vendor/ecdsa/Cargo.toml | 10 ++++++++-- vendor/ecdsa/src/der.rs | 29 ++++++++++++++++++++++++--- vendor/ecdsa/src/lib.rs | 41 ++++++++++++++++++--------------------- 5 files changed, 75 insertions(+), 28 deletions(-) (limited to 'vendor/ecdsa') diff --git a/vendor/ecdsa/.cargo-checksum.json b/vendor/ecdsa/.cargo-checksum.json index 10d399ee2..0bb212096 100644 --- a/vendor/ecdsa/.cargo-checksum.json +++ b/vendor/ecdsa/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"CHANGELOG.md":"3b692c15478b5aa15df17a094b84b03e0cfb6c56dbe8a5ec6d40b53ef1dcea2f","Cargo.toml":"09391aecb7abdf0ec8a55d81dad7f5df355562b286d2aca24b764243a8e06453","LICENSE-APACHE":"78779d420019e6b4630376af8e86b6b335ee8a2f89ede6e0411e0469a326aaa4","LICENSE-MIT":"bdebaf9156a298f8fdab56dd26cb5144673de522d80f4c0d88e0039145f147f9","README.md":"f99485065d3d5541ef1814ea8d3f75718f08cb78eb5626f9d34941799655b4b9","src/der.rs":"d3320fc6c6c3e5f08c8323c07bdf774a2f4cfc97d8951751c7e89232572167a7","src/dev.rs":"75d56ac79f04efc018b37eca752c7861579772a758cac94874ccf85aa880602a","src/hazmat.rs":"6d888d3389ac9d0431beed24b865260f0554271cdbb9aa24a6ca9341717fdfc7","src/lib.rs":"63f4d7ead0024b1fba3083c413a21e168d435d0917208be61c9fad868c84acdc","src/recovery.rs":"41141f9f4ffbd155c5167fbe749299496077c55e6b64ed83f65ced1372205623","src/signing.rs":"11842af046b43fe53add72a7fdc78a9555a1dbc37fe6bb0d1139e8b25491538f","src/verifying.rs":"c7441025d4ddcfce2c7701813d84c032364da4bd38bd28895a75d09eaca53ee3","tests/lib.rs":"68922b3fb793f7f64a6fdf8aa59b6fb9432d4706d7ad1d82129a8337c5cf6568"},"package":"a48e5d537b8a30c0b023116d981b16334be1485af7ca68db3a2b7024cbc957fd"} \ No newline at end of file +{"files":{"CHANGELOG.md":"4279491bdaea14ba337058cfa381685d13f79cf38e806e8dfb3acb969f29d204","Cargo.toml":"c202563302268fd4423282cac188151281fe6b20baba52231bd62648e5fc6a1d","LICENSE-APACHE":"78779d420019e6b4630376af8e86b6b335ee8a2f89ede6e0411e0469a326aaa4","LICENSE-MIT":"bdebaf9156a298f8fdab56dd26cb5144673de522d80f4c0d88e0039145f147f9","README.md":"f99485065d3d5541ef1814ea8d3f75718f08cb78eb5626f9d34941799655b4b9","src/der.rs":"12d336b65d1a9d45a44809746c572084d512812e4a8baad23158127a67c583b6","src/dev.rs":"75d56ac79f04efc018b37eca752c7861579772a758cac94874ccf85aa880602a","src/hazmat.rs":"6d888d3389ac9d0431beed24b865260f0554271cdbb9aa24a6ca9341717fdfc7","src/lib.rs":"83449168dc7e3c9777291900b1c8e470d9c9701a705091a1a9aa3ff0862dacbe","src/recovery.rs":"41141f9f4ffbd155c5167fbe749299496077c55e6b64ed83f65ced1372205623","src/signing.rs":"11842af046b43fe53add72a7fdc78a9555a1dbc37fe6bb0d1139e8b25491538f","src/verifying.rs":"c7441025d4ddcfce2c7701813d84c032364da4bd38bd28895a75d09eaca53ee3","tests/lib.rs":"68922b3fb793f7f64a6fdf8aa59b6fb9432d4706d7ad1d82129a8337c5cf6568"},"package":"0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428"} \ No newline at end of file diff --git a/vendor/ecdsa/CHANGELOG.md b/vendor/ecdsa/CHANGELOG.md index c551aaa8d..675eecc2a 100644 --- a/vendor/ecdsa/CHANGELOG.md +++ b/vendor/ecdsa/CHANGELOG.md @@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 0.16.7 (2023-05-11) + +### Added +- RFC5480 citation for `der::Signature` ([#710]) +- support for the `SignatureBitStringEncoding` trait ([#716]) + +### Changed +- bump `elliptic-curve` from 0.13.3 to 0.13.4 ([#709]) +- `der::Signature` citation to RFC5912 ([#711]) +- make `fmt` impls more consistent ([#713]) + +### Fixed +- `serde` doc fixup ([#712]) + +[#709]: https://github.com/RustCrypto/signatures/pull/709 +[#710]: https://github.com/RustCrypto/signatures/pull/710 +[#711]: https://github.com/RustCrypto/signatures/pull/711 +[#712]: https://github.com/RustCrypto/signatures/pull/712 +[#713]: https://github.com/RustCrypto/signatures/pull/713 +[#716]: https://github.com/RustCrypto/signatures/pull/716 + ## 0.16.6 (2023-04-09) ### Fixed - Test macro handling of serialized field size ([#707]) diff --git a/vendor/ecdsa/Cargo.toml b/vendor/ecdsa/Cargo.toml index 5f0e94d97..6e0c75aba 100644 --- a/vendor/ecdsa/Cargo.toml +++ b/vendor/ecdsa/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" rust-version = "1.65" name = "ecdsa" -version = "0.16.6" +version = "0.16.7" authors = ["RustCrypto Developers"] description = """ Pure Rust implementation of the Elliptic Curve Digital Signature Algorithm @@ -53,7 +53,7 @@ optional = true default-features = false [dependencies.elliptic-curve] -version = "0.13.3" +version = "0.13.4" features = [ "digest", "sec1", @@ -81,6 +81,11 @@ version = "2.0, <2.2" features = ["rand_core"] default-features = false +[dependencies.spki] +version = "0.7.2" +optional = true +default-features = false + [dev-dependencies.elliptic-curve] version = "0.13" features = ["dev"] @@ -97,6 +102,7 @@ default-features = false alloc = [ "elliptic-curve/alloc", "signature/alloc", + "spki/alloc", ] arithmetic = ["elliptic-curve/arithmetic"] default = ["digest"] diff --git a/vendor/ecdsa/src/der.rs b/vendor/ecdsa/src/der.rs index cb774232e..b4b03c172 100644 --- a/vendor/ecdsa/src/der.rs +++ b/vendor/ecdsa/src/der.rs @@ -1,4 +1,7 @@ -//! Support for ECDSA signatures encoded as ASN.1 DER. +//! Support for ASN.1 DER-encoded ECDSA signatures as specified in +//! [RFC5912 Appendix A]. +//! +//! [RFC5912 Appendix A]: https://www.rfc-editor.org/rfc/rfc5912#appendix-A use crate::{Error, Result}; use core::{ @@ -16,6 +19,7 @@ use elliptic_curve::{ use { alloc::{boxed::Box, vec::Vec}, signature::SignatureEncoding, + spki::{der::asn1::BitString, SignatureBitStringEncoding}, }; #[cfg(feature = "serde")] @@ -43,9 +47,16 @@ pub type MaxSize = < as Add>::Output as Add>:: /// Byte array containing a serialized ASN.1 signature type SignatureBytes = GenericArray>; -/// ASN.1 DER-encoded signature. +/// ASN.1 DER-encoded signature as specified in [RFC5912 Appendix A]: /// -/// Generic over the scalar size of the elliptic curve. +/// ```text +/// ECDSA-Sig-Value ::= SEQUENCE { +/// r INTEGER, +/// s INTEGER +/// } +/// ``` +/// +/// [RFC5912 Appendix A]: https://www.rfc-editor.org/rfc/rfc5912#appendix-A pub struct Signature where C: PrimeCurve, @@ -299,6 +310,18 @@ where } } +#[cfg(feature = "alloc")] +impl SignatureBitStringEncoding for Signature +where + C: PrimeCurve, + MaxSize: ArrayLength, + as Add>::Output: Add + ArrayLength, +{ + fn to_bitstring(&self) -> der::Result { + BitString::new(0, self.to_vec()) + } +} + #[cfg(feature = "serde")] impl Serialize for Signature where diff --git a/vendor/ecdsa/src/lib.rs b/vendor/ecdsa/src/lib.rs index 4842d507f..96f1a16e5 100644 --- a/vendor/ecdsa/src/lib.rs +++ b/vendor/ecdsa/src/lib.rs @@ -83,10 +83,7 @@ pub use crate::signing::SigningKey; #[cfg(feature = "verifying")] pub use crate::verifying::VerifyingKey; -use core::{ - fmt::{self, Debug}, - ops::Add, -}; +use core::{fmt, ops::Add}; use elliptic_curve::{ generic_array::{sequence::Concat, typenum::Unsigned, ArrayLength, GenericArray}, FieldBytes, FieldBytesSize, ScalarPrimitive, @@ -192,8 +189,8 @@ pub type SignatureBytes = GenericArray>; /// serializing and deserializing ECDSA signatures using the `Serialize` and /// `Deserialize` traits. /// -/// The serialization uses a 64-byte fixed encoding when used with binary -/// formats, and a hexadecimal encoding when used with text formats. +/// The serialization uses a hexadecimal encoding when used with +/// "human readable" text formats, and a binary encoding otherwise. #[derive(Clone, Eq, PartialEq)] pub struct Signature { r: ScalarPrimitive, @@ -321,22 +318,6 @@ where { } -impl Debug for Signature -where - C: PrimeCurve, - SignatureSize: ArrayLength, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "ecdsa::Signature<{:?}>(", C::default())?; - - for byte in self.to_bytes() { - write!(f, "{:02X}", byte)?; - } - - write!(f, ")") - } -} - impl From> for SignatureBytes where C: PrimeCurve, @@ -367,6 +348,22 @@ where } } +impl fmt::Debug for Signature +where + C: PrimeCurve, + SignatureSize: ArrayLength, +{ + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "ecdsa::Signature<{:?}>(", C::default())?; + + for byte in self.to_bytes() { + write!(f, "{:02X}", byte)?; + } + + write!(f, ")") + } +} + impl fmt::Display for Signature where C: PrimeCurve, -- cgit v1.2.3