From dd4adddf8b716bb51eb8ccb8c73e47bff1e358aa Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Fri, 1 Mar 2024 15:08:17 +0300 Subject: [PATCH] opaque-debug: release v0.3.1 (#1054) --- Cargo.lock | 30 ++++++++++++++-------------- opaque-debug/CHANGELOG.md | 13 +++++++++++++ opaque-debug/Cargo.toml | 3 ++- opaque-debug/LICENSE-MIT | 2 +- opaque-debug/README.md | 40 ++++++++++++++++++++++++++++++++++++++ opaque-debug/src/lib.rs | 41 ++++++++++++++++++++++++++++++++------- 6 files changed, 105 insertions(+), 24 deletions(-) create mode 100644 opaque-debug/CHANGELOG.md create mode 100644 opaque-debug/README.md diff --git a/Cargo.lock b/Cargo.lock index 2076795a..cf62d248 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -107,13 +107,13 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" [[package]] name = "prettyplease" @@ -127,9 +127,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -145,24 +145,24 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -171,9 +171,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -182,9 +182,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", diff --git a/opaque-debug/CHANGELOG.md b/opaque-debug/CHANGELOG.md new file mode 100644 index 00000000..99224fdb --- /dev/null +++ b/opaque-debug/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog +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.3.1 (2024-03-01) +### Added +- Support for generic parameters ([#1053]) + +[#1053]: https://github.com/RustCrypto/utils/pull/1053 + +## 0.3.0 (2020-06-11) diff --git a/opaque-debug/Cargo.toml b/opaque-debug/Cargo.toml index d2d788e6..6faca837 100644 --- a/opaque-debug/Cargo.toml +++ b/opaque-debug/Cargo.toml @@ -1,9 +1,10 @@ [package] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" description = "Macro for opaque Debug trait implementation" documentation = "https://docs.rs/opaque-debug" repository = "https://github.com/RustCrypto/utils" edition = "2018" +readme = "README.md" diff --git a/opaque-debug/LICENSE-MIT b/opaque-debug/LICENSE-MIT index 502cee6e..1aef8daa 100644 --- a/opaque-debug/LICENSE-MIT +++ b/opaque-debug/LICENSE-MIT @@ -1,4 +1,4 @@ -Copyright (c) 2018-2019 The RustCrypto Project Developers +Copyright (c) 2018-2024 The RustCrypto Project Developers Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated diff --git a/opaque-debug/README.md b/opaque-debug/README.md new file mode 100644 index 00000000..4ec6a1ef --- /dev/null +++ b/opaque-debug/README.md @@ -0,0 +1,40 @@ +# [RustCrypto]: Opaque Debug + +[![crate][crate-image]][crate-link] +[![Docs][docs-image]][docs-link] +[![Build Status][build-image]][build-link] +![Apache2/MIT licensed][license-image] +![Rust Version][rustc-image] +[![Project Chat][chat-image]][chat-link] + +Macro for opaque Debug trait implementation. + +## License + +Licensed under either of: + + * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) + * [MIT license](http://opensource.org/licenses/MIT) + +at your option. + +### Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. + +[//]: # (badges) + +[crate-image]: https://img.shields.io/crates/v/opaque-debug.svg +[crate-link]: https://crates.io/crates/opaque-debug +[docs-image]: https://docs.rs/opaque-debug/badge.svg +[docs-link]: https://docs.rs/opaque-debug/ +[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg +[rustc-image]: https://img.shields.io/badge/rustc-1.41+-blue.svg +[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg +[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260052-utils +[build-image]: https://github.com/RustCrypto/utils/workflows/opaque-debug/badge.svg?branch=master&event=push +[build-link]: https://github.com/RustCrypto/utils/actions/workflows/opaque-debug.yml + +[//]: # (general links) + +[RustCrypto]: https://github.com/rustcrypto diff --git a/opaque-debug/src/lib.rs b/opaque-debug/src/lib.rs index 62f84a49..9e636343 100644 --- a/opaque-debug/src/lib.rs +++ b/opaque-debug/src/lib.rs @@ -1,4 +1,36 @@ -//! Macro for opaque `Debug` trait implementation. +//! Macro for opaque [`Debug`] trait implementation. +//! +//! In many cases it's convenient to have `Debug` implementation for all crate types, +//! e.g. to allow deriving of `Debug` in user-defined structs. But at the same time, using +//! the default derive macro can be a security hazard since it cause leaking of sensitive +//! information, for example, through uncareful logging. +//! +//! This crate introduces the [`implement!`] macro which creates an opaque [`Debug`] +//! implementation, which does not expose any internal type data. +//! +//! # Examples +//! ``` +//! pub struct CryptoStuff { +//! key: [u8; 16], +//! } +//! +//! opaque_debug::implement!(CryptoStuff); +//! +//! let val = CryptoStuff { key: [42; 16] }; +//! assert_eq!(format!("{:?}", val), "CryptoStuff { ... }") +//! ``` +//! +//! The macro also support generic paramters: +//! ``` +//! pub struct GenricCryptoStuff { +//! key: K, +//! } +//! +//! opaque_debug::implement!(GenricCryptoStuff); +//! +//! let val = GenricCryptoStuff { key: [42u8; 16] }; +//! assert_eq!(format!("{:?}", val), "GenricCryptoStuff<[u8; 16]> { ... }") +//! ``` #![no_std] #![doc( html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", @@ -19,12 +51,7 @@ macro_rules! format_params { }; } -/// Macro for defining opaque `Debug` implementation. -/// -/// It will use the following format: "StructName { ... }". While it's -/// convenient to have it (e.g. for including into other structs), it could be -/// undesirable to leak internal state, which can happen for example through -/// uncareful logging. +/// Macro for implementing an opaque `Debug` implementation. #[macro_export] macro_rules! implement { ($struct:ident <$($params:ident),+>) => {