Skip to content

Commit e101c8d

Browse files
authored
Re-export crypto_common as common (#2237)
Or rather, this imports `crypto-common` as `common` using the `package = crypto-common` syntax in Cargo.toml, then re-exports it, which should hopefully make for better diagnostics. This is shorter and more convenient for imports. Where crates were previously exporting `crypto_common`, this adds an alias with a deprecation. Adding such an alias to `digest` was necessary to even get anything to compile.
1 parent fcd5bae commit e101c8d

File tree

35 files changed

+115
-96
lines changed

35 files changed

+115
-96
lines changed

aead/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## Unreleased
9+
### Added
10+
- Re-export `crypto_common` as `common` ([#2237])
11+
912
### Fixed
1013
- Minor documentation error in `AeadCore::TagSize` ([#1351])
1114
- Fixup `hybrid-array` migration ([#1531])
@@ -43,6 +46,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4346
[#1531]: https://github.com/RustCrypto/traits/pull/1531
4447
[#1759]: https://github.com/RustCrypto/traits/pull/1759
4548
[#1999]: https://github.com/RustCrypto/traits/pull/1999
49+
[#2237]: https://github.com/RustCrypto/traits/pull/2237
4650

4751
## 0.5.2 (2023-04-02)
4852
### Added

aead/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ such as AES-GCM as ChaCha20Poly1305, which provide a high-level API
1616
"""
1717

1818
[dependencies]
19-
crypto-common = "0.2.0-rc.13"
19+
common = { version = "0.2.0-rc.13", package = "crypto-common" }
2020
inout = "0.2.2"
2121

2222
# optional dependencies
@@ -28,8 +28,8 @@ bytes = { version = "1", optional = true, default-features = false }
2828
default = ["rand_core"]
2929
alloc = []
3030
dev = ["blobby", "alloc"]
31-
getrandom = ["crypto-common/getrandom"]
32-
rand_core = ["crypto-common/rand_core"]
31+
getrandom = ["common/getrandom"]
32+
rand_core = ["common/rand_core"]
3333

3434
[package.metadata.docs.rs]
3535
all-features = true

aead/src/dev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::{
33
Aead, AeadInOut, Payload, Tag, TagPosition, array::typenum::Unsigned, inout::InOutBuf,
44
};
55
pub use blobby;
6-
use crypto_common::KeyInit;
6+
use common::KeyInit;
77

88
/// AEAD test vector
99
#[derive(Debug, Clone, Copy)]

aead/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ extern crate alloc;
1919
#[cfg(feature = "dev")]
2020
pub mod dev;
2121

22-
pub use crypto_common::{
23-
Key, KeyInit, KeySizeUser,
22+
pub use common::{
23+
self, Key, KeyInit, KeySizeUser,
2424
array::{self, typenum::consts},
2525
};
2626

@@ -29,11 +29,11 @@ pub use arrayvec;
2929
#[cfg(feature = "bytes")]
3030
pub use bytes;
3131
#[cfg(feature = "rand_core")]
32-
pub use crypto_common::{Generate, rand_core};
32+
pub use common::{Generate, rand_core};
3333
pub use inout;
3434

35+
use common::array::{Array, ArraySize, typenum::Unsigned};
3536
use core::fmt;
36-
use crypto_common::array::{Array, ArraySize, typenum::Unsigned};
3737
use inout::InOutBuf;
3838

3939
#[cfg(feature = "alloc")]

cipher/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## 0.5.0 (UNRELEASED)
99
### Changed
1010
- Edition changed to 2024 and MSRV bumped to 1.85 ([#1759])
11+
- Re-export of `crypto-common` moved to `cipher::common` ([#2237])
1112

1213
### Fixed
1314
- Seeking implementation in the stream cipher wrapper ([#2052])
1415

1516
[#1759]: https://github.com/RustCrypto/traits/pull/1759
1617
[#2052]: https://github.com/RustCrypto/traits/pull/2052
18+
[#2237]: https://github.com/RustCrypto/traits/pull/2237
1719

1820
## 0.4.4 (2022-03-09)
1921
### Changed

cipher/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"]
1313
description = "Traits for describing block ciphers and stream ciphers"
1414

1515
[dependencies]
16-
crypto-common = "0.2.0-rc.13"
16+
common = { version = "0.2.0-rc.13", package = "crypto-common" }
1717
inout = "0.2.2"
1818

1919
# optional dependencies
@@ -29,10 +29,10 @@ alloc = []
2929
block-padding = ["inout/block-padding"]
3030
stream-wrapper = ["block-buffer"]
3131
# Enable random key and IV generation methods
32-
getrandom = ["crypto-common/getrandom"]
33-
rand_core = ["crypto-common/rand_core"]
32+
getrandom = ["common/getrandom"]
33+
rand_core = ["common/rand_core"]
3434
dev = ["blobby"]
35-
zeroize = ["dep:zeroize", "crypto-common/zeroize", "block-buffer?/zeroize"]
35+
zeroize = ["dep:zeroize", "common/zeroize", "block-buffer?/zeroize"]
3636

3737
[package.metadata.docs.rs]
3838
all-features = true

cipher/src/block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
#[cfg(all(feature = "block-padding", feature = "alloc"))]
1414
use alloc::{vec, vec::Vec};
15-
use crypto_common::{Block, BlockSizeUser};
15+
use common::{Block, BlockSizeUser};
1616
use inout::{InOut, InOutBuf, NotEqualError};
1717
#[cfg(feature = "block-padding")]
1818
use inout::{
@@ -136,8 +136,8 @@ pub trait BlockCipherEncrypt: BlockSizeUser + Sized {
136136
#[inline]
137137
fn encrypt_padded_vec<P: Padding>(&self, msg: &[u8]) -> Vec<u8> {
138138
use block_padding::{NoPadding, ZeroPadding};
139+
use common::typenum::Unsigned;
139140
use core::any::TypeId;
140-
use crypto_common::typenum::Unsigned;
141141

142142
let bs = Self::BlockSize::USIZE;
143143
let msg_len = msg.len();
@@ -404,8 +404,8 @@ pub trait BlockModeEncrypt: BlockSizeUser + Sized {
404404
#[inline]
405405
fn encrypt_padded_vec<P: Padding>(self, msg: &[u8]) -> Vec<u8> {
406406
use block_padding::{NoPadding, ZeroPadding};
407+
use common::typenum::Unsigned;
407408
use core::any::TypeId;
408-
use crypto_common::typenum::Unsigned;
409409

410410
let bs = Self::BlockSize::USIZE;
411411
let msg_len = msg.len();

cipher/src/block/backends.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crypto_common::{Block, BlockSizeUser, ParBlocks, ParBlocksSizeUser, typenum::Unsigned};
1+
use common::{Block, BlockSizeUser, ParBlocks, ParBlocksSizeUser, typenum::Unsigned};
22
use inout::{InOut, InOutBuf};
33

44
/// Trait implemented by block cipher mode encryption backends.

cipher/src/block/ctx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crypto_common::{Block, BlockSizeUser, BlockSizes, typenum::Unsigned};
1+
use common::{Block, BlockSizeUser, BlockSizes, typenum::Unsigned};
22
use inout::{InOut, InOutBuf};
33

44
use super::{

cipher/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ extern crate alloc;
2424

2525
#[cfg(feature = "dev")]
2626
pub use blobby;
27-
pub use crypto_common;
27+
pub use common;
2828
#[cfg(feature = "rand_core")]
29-
pub use crypto_common::rand_core;
29+
pub use common::rand_core;
3030
pub use inout;
3131
#[cfg(feature = "block-padding")]
3232
pub use inout::block_padding;
@@ -43,10 +43,13 @@ pub use block::*;
4343
pub use stream::*;
4444
pub use tweak::*;
4545

46-
pub use crypto_common::{
46+
pub use common::{
4747
AlgorithmName, Block, BlockSizeUser, InnerIvInit, InvalidLength, Iv, IvSizeUser, IvState, Key,
4848
KeyInit, KeyIvInit, KeySizeUser, ParBlocks, ParBlocksSizeUser,
4949
array::{self, Array},
5050
typenum::{self, consts},
5151
};
5252
pub use inout::{InOut, InOutBuf};
53+
54+
#[deprecated(since = "0.5.0", note = "use `cipher::common` instead")]
55+
pub use common as crypto_common;

0 commit comments

Comments
 (0)