Skip to content

Commit 6a955f7

Browse files
committed
fixes for belt-dwp + rebase
1 parent 5b771fc commit 6a955f7

File tree

7 files changed

+60
-29
lines changed

7 files changed

+60
-29
lines changed

.github/workflows/belt-dwp.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
paths:
66
- ".github/workflows/belt-dwp.yml"
7-
- "aes-gcm/**"
7+
- "belt-dwp/**"
88
- "Cargo.*"
99
push:
1010
branches: master
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
rust:
26-
- 1.65.0 # MSRV
26+
- 1.85.0 # MSRV
2727
- stable
2828
target:
2929
- armv7a-none-eabi
@@ -44,15 +44,15 @@ jobs:
4444
include:
4545
# 32-bit Linux
4646
- target: i686-unknown-linux-gnu
47-
rust: 1.72.0 # MSRV
47+
rust: 1.85.0 # MSRV
4848
deps: sudo apt update && sudo apt install gcc-multilib
4949
- target: i686-unknown-linux-gnu
5050
rust: stable
5151
deps: sudo apt update && sudo apt install gcc-multilib
5252

5353
# 64-bit Linux
5454
- target: x86_64-unknown-linux-gnu
55-
rust: 1.72.0 # MSRV
55+
rust: 1.85.0 # MSRV
5656
- target: x86_64-unknown-linux-gnu
5757
rust: stable
5858
steps:

Cargo.lock

Lines changed: 33 additions & 0 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
@@ -5,6 +5,7 @@ members = [
55
"aes-gcm-siv",
66
"aes-siv",
77
"ascon-aead",
8+
"belt-dwp",
89
"ccm",
910
"chacha20poly1305",
1011
"deoxys",
@@ -28,3 +29,5 @@ ctr = { git = "https://github.com/RustCrypto/block-modes.git" }
2829
ghash = { git = "https://github.com/RustCrypto/universal-hashes.git" }
2930

3031
pmac = { git = "https://github.com/RustCrypto/MACs.git" }
32+
33+
belt-ctr = { git = "https://github.com/RustCrypto/block-modes.git" }

belt-dwp/Cargo.toml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rust-version = "1.81"
1313

1414
[dependencies]
1515
aead = { version = "0.6.0-rc.0", default-features = false }
16-
zeroize = { version = "1.7", default-features = false }
16+
zeroize = { version = "1.7", default-features = false, optional = true }
1717
universal-hash = { version = "0.6.0-rc.0" }
1818
opaque-debug = { version = "0.3" }
1919

@@ -24,13 +24,15 @@ belt-ctr = { version = "0.2.0-pre" }
2424
hex-literal = "0.4"
2525

2626
[features]
27-
default = ["alloc", "getrandom"]
28-
std = ["aead/std", "alloc"]
29-
alloc = ["aead/alloc"]
30-
arrayvec = ["aead/arrayvec"]
31-
getrandom = ["aead/getrandom", "rand_core"]
32-
heapless = ["aead/heapless"]
33-
rand_core = ["aead/rand_core"]
27+
default = ["alloc", "os_rng"]
28+
alloc = ["aead/alloc"]
29+
arrayvec = ["aead/arrayvec"]
30+
bytes = ["aead/bytes"]
31+
os_rng = ["aead/os_rng", "rand_core"]
32+
heapless = ["aead/heapless"]
33+
rand_core = ["aead/rand_core"]
34+
reduced-round = []
35+
zeroize = ["dep:zeroize", "belt-ctr/zeroize"]
3436

3537
[package.metadata.docs.rs]
3638
all-features = true

belt-dwp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dual licensed as above, without any additional terms or conditions.
4444
[docs-image]: https://docs.rs/belt-dwp/badge.svg
4545
[docs-link]: https://docs.rs/belt-dwp/
4646
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
47-
[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg
47+
[rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg
4848
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
4949
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260038-AEADs
5050
[downloads-image]: https://img.shields.io/crates/d/chacha20poly1305.svg

belt-dwp/src/lib.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//!
1212
//! Simple usage (allocating, no associated data):
1313
//!
14-
#![cfg_attr(all(feature = "getrandom", feature = "std"), doc = "```")]
15-
#![cfg_attr(not(all(feature = "getrandom", feature = "std")), doc = "```ignore")]
14+
#![cfg_attr(all(feature = "os_rng", feature = "heapless"), doc = "```")]
15+
#![cfg_attr(not(all(feature = "os_rng", feature = "heapless")), doc = "```ignore")]
1616
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
//! use belt_dwp::{
1818
//! aead::{Aead, AeadCore, KeyInit, OsRng},
@@ -44,17 +44,11 @@
4444
//! which can then be passed as the `buffer` parameter to the in-place encrypt
4545
//! and decrypt methods:
4646
//!
47-
#![cfg_attr(
48-
all(feature = "getrandom", feature = "heapless", feature = "std"),
49-
doc = "```"
50-
)]
51-
#![cfg_attr(
52-
not(all(feature = "getrandom", feature = "heapless", feature = "std")),
53-
doc = "```ignore"
54-
)]
47+
#![cfg_attr(all(feature = "os_rng", feature = "heapless"), doc = "```")]
48+
#![cfg_attr(not(all(feature = "os_rng", feature = "heapless")), doc = "```ignore")]
5549
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
5650
//! use belt_dwp::{
57-
//! aead::{AeadInPlace, KeyInit, OsRng, heapless::Vec},
51+
//! aead::{AeadInPlaceDetached, KeyInit, OsRng, heapless::Vec},
5852
//! BeltDwp, Nonce
5953
//! };
6054
//!
@@ -82,9 +76,9 @@
8276
//! [`aead::Buffer`] for `arrayvec::ArrayVec` (re-exported from the [`aead`] crate as
8377
//! [`aead::arrayvec::ArrayVec`]).
8478
85-
use aead::consts::{U0, U16, U32, U8};
79+
use aead::consts::{U16, U32, U8};
80+
use aead::AeadInPlaceDetached;
8681
pub use aead::{self, AeadCore, AeadInPlace, Error, Key, KeyInit, KeySizeUser};
87-
8882
use belt_block::cipher::{Block, BlockCipherEncrypt, KeyIvInit, StreamCipher};
8983
use belt_block::{belt_block_raw, BeltBlock};
9084
use belt_ctr::BeltCtr;
@@ -118,7 +112,7 @@ impl KeySizeUser for BeltDwp {
118112
type KeySize = U32;
119113
}
120114

121-
impl AeadInPlace for BeltDwp {
115+
impl AeadInPlaceDetached for BeltDwp {
122116
fn encrypt_in_place_detached(
123117
&self,
124118
nonce: &Nonce,
@@ -254,7 +248,6 @@ impl KeyInit for BeltDwp {
254248
impl AeadCore for BeltDwp {
255249
type NonceSize = U16;
256250
type TagSize = U8;
257-
type CiphertextOverhead = U0;
258251
}
259252

260253
/// Get the sizes block for the GHASH

belt-dwp/tests/belt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use aead::AeadInPlace;
1+
use aead::AeadInPlaceDetached;
22
use belt_dwp::{BeltDwp, KeyInit};
33
use hex_literal::hex;
44

0 commit comments

Comments
 (0)