Skip to content

Commit 72c538d

Browse files
authored
block-padding: add sanity assert (#748)
1 parent 286dc1a commit 72c538d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

block-padding/CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## 0.3.1 (2022-02-10)
7+
## 0.3.2 (2022-03-10)
8+
### Fixed
9+
- Potential unsoundness for incorrect `Padding` implementations ([#748])
10+
11+
[#748]: https://github.com/RustCrypto/utils/pull/748
12+
13+
## 0.3.1 (2022-02-10) [YANKED]
814
### Fixed
915
- Fix doc build on docs.rs by optionally enabling the `doc_cfg` feature ([#733])
1016

1117
[#733]: https://github.com/RustCrypto/utils/pull/733
1218

13-
## 0.3.0 (2022-02-10)
19+
## 0.3.0 (2022-02-10) [YANKED]
1420
### Added
1521
- `Iso10126` padding algorithm ([#643])
1622
- `PadType` enum, `Padding::TYPE` associated constant, and `Padding::unpad_blocks` method ([#675])

block-padding/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "block-padding"
3-
version = "0.3.1" # Also update html_root_url in lib.rs when bumping this
3+
version = "0.3.2" # Also update html_root_url in lib.rs when bumping this
44
description = "Padding and unpadding of messages divided into blocks."
55
authors = ["RustCrypto Developers"]
66
license = "MIT OR Apache-2.0"

block-padding/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![doc(
88
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
99
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg",
10-
html_root_url = "https://docs.rs/block-padding/0.3.1"
10+
html_root_url = "https://docs.rs/block-padding/0.3.2"
1111
)]
1212
#![cfg_attr(docsrs, feature(doc_cfg))]
1313
#![warn(missing_docs, rust_2018_idioms)]
@@ -60,6 +60,7 @@ pub trait Padding<BlockSize: ArrayLength<u8>> {
6060
(_, PadType::NoPadding) => bs * blocks.len(),
6161
(Some(last_block), _) => {
6262
let n = Self::unpad(last_block)?.len();
63+
assert!(n <= bs);
6364
n + bs * (blocks.len() - 1)
6465
}
6566
(None, PadType::Ambiguous) => 0,

0 commit comments

Comments
 (0)