Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
makavity committed May 18, 2024
1 parent 1b9f000 commit e2ffe6b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 29 deletions.
52 changes: 38 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ crate.

## Crates

| Name | Algorithm | Crates.io | Documentation | MSRV |
|----------------------|------------------------------|-----------|---------------|-------|
| [`aes-gcm-siv`] | [AES-GCM-SIV] | [![crates.io](https://img.shields.io/crates/v/aes-gcm-siv.svg)](https://crates.io/crates/aes-gcm-siv) | [![Documentation](https://docs.rs/aes-gcm-siv/badge.svg)](https://docs.rs/aes-gcm-siv) | 1.51 |
| [`aes-gcm`] | [AES-GCM] | [![crates.io](https://img.shields.io/crates/v/aes-gcm.svg)](https://crates.io/crates/aes-gcm) | [![Documentation](https://docs.rs/aes-gcm/badge.svg)](https://docs.rs/aes-gcm) | 1.51 |
| [`aes-siv`] | [AES-SIV] | [![crates.io](https://img.shields.io/crates/v/aes-siv.svg)](https://crates.io/crates/aes-siv) | [![Documentation](https://docs.rs/aes-siv/badge.svg)](https://docs.rs/aes-siv) | 1.51 |
| [`ascon-aead`] | [Ascon] | [![crates.io](https://img.shields.io/crates/v/ascon-aead.svg)](https://crates.io/crates/ascon-aead) | [![Documentation](https://docs.rs/ascon-aead/badge.svg)](https://docs.rs/ascon-aead) | 1.56 |
| [`belt-dwp`] | [BeltDwp] | [![crates.io](https://img.shields.io/crates/v/belt-dwp.svg)](https://crates.io/crates/belt-dwp) | [![Documentation](https://docs.rs/belt-dwp/badge.svg)](https://docs.rs/belt-dwp) | 1.56 |
| [`ccm`] | [CCM] | [![crates.io](https://img.shields.io/crates/v/ccm.svg)](https://crates.io/crates/ccm) | [![Documentation](https://docs.rs/ccm/badge.svg)](https://docs.rs/ccm) | 1.41 |
| [`chacha20poly1305`] | [(X)ChaCha20Poly1305] | [![crates.io](https://img.shields.io/crates/v/chacha20poly1305.svg)](https://crates.io/crates/chacha20poly1305) | [![Documentation](https://docs.rs/chacha20poly1305/badge.svg)](https://docs.rs/chacha20poly1305) | 1.56 |
| [`deoxys`] | [Deoxys-I/II] | [![crates.io](https://img.shields.io/crates/v/deoxys.svg)](https://crates.io/crates/deoxys) | [![Documentation](https://docs.rs/deoxys/badge.svg)](https://docs.rs/deoxys) | 1.51 |
| [`eax`] | [EAX] | [![crates.io](https://img.shields.io/crates/v/eax.svg)](https://crates.io/crates/eax) | [![Documentation](https://docs.rs/eax/badge.svg)](https://docs.rs/eax) | 1.41 |
| [`mgm`] | [MGM] | [![crates.io](https://img.shields.io/crates/v/mgm.svg)](https://crates.io/crates/mgm) | [![Documentation](https://docs.rs/mgm/badge.svg)](https://docs.rs/mgm) | 1.41 |
| Name | Algorithm | Crates.io | Documentation | MSRV |
|----------------------|-----------------------|-----------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|------|
| [`aes-gcm-siv`] | [AES-GCM-SIV] | [![crates.io](https://img.shields.io/crates/v/aes-gcm-siv.svg)](https://crates.io/crates/aes-gcm-siv) | [![Documentation](https://docs.rs/aes-gcm-siv/badge.svg)](https://docs.rs/aes-gcm-siv) | 1.51 |
| [`aes-gcm`] | [AES-GCM] | [![crates.io](https://img.shields.io/crates/v/aes-gcm.svg)](https://crates.io/crates/aes-gcm) | [![Documentation](https://docs.rs/aes-gcm/badge.svg)](https://docs.rs/aes-gcm) | 1.51 |
| [`aes-siv`] | [AES-SIV] | [![crates.io](https://img.shields.io/crates/v/aes-siv.svg)](https://crates.io/crates/aes-siv) | [![Documentation](https://docs.rs/aes-siv/badge.svg)](https://docs.rs/aes-siv) | 1.51 |
| [`ascon-aead`] | [Ascon] | [![crates.io](https://img.shields.io/crates/v/ascon-aead.svg)](https://crates.io/crates/ascon-aead) | [![Documentation](https://docs.rs/ascon-aead/badge.svg)](https://docs.rs/ascon-aead) | 1.56 |
| [`belt-dwp`] | [BeltDwp] | [![crates.io](https://img.shields.io/crates/v/belt-dwp.svg)](https://crates.io/crates/belt-dwp) | [![Documentation](https://docs.rs/belt-dwp/badge.svg)](https://docs.rs/belt-dwp) | 1.56 |
| [`ccm`] | [CCM] | [![crates.io](https://img.shields.io/crates/v/ccm.svg)](https://crates.io/crates/ccm) | [![Documentation](https://docs.rs/ccm/badge.svg)](https://docs.rs/ccm) | 1.41 |
| [`chacha20poly1305`] | [(X)ChaCha20Poly1305] | [![crates.io](https://img.shields.io/crates/v/chacha20poly1305.svg)](https://crates.io/crates/chacha20poly1305) | [![Documentation](https://docs.rs/chacha20poly1305/badge.svg)](https://docs.rs/chacha20poly1305) | 1.56 |
| [`deoxys`] | [Deoxys-I/II] | [![crates.io](https://img.shields.io/crates/v/deoxys.svg)](https://crates.io/crates/deoxys) | [![Documentation](https://docs.rs/deoxys/badge.svg)](https://docs.rs/deoxys) | 1.51 |
| [`eax`] | [EAX] | [![crates.io](https://img.shields.io/crates/v/eax.svg)](https://crates.io/crates/eax) | [![Documentation](https://docs.rs/eax/badge.svg)](https://docs.rs/eax) | 1.41 |
| [`mgm`] | [MGM] | [![crates.io](https://img.shields.io/crates/v/mgm.svg)](https://crates.io/crates/mgm) | [![Documentation](https://docs.rs/mgm/badge.svg)](https://docs.rs/mgm) | 1.41 |

## MSRV Policy

Expand All @@ -38,8 +38,8 @@ done with a minor version bump.

All crates licensed under either of

* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* [MIT license](http://opensource.org/licenses/MIT)
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* [MIT license](http://opensource.org/licenses/MIT)

at your option.

Expand All @@ -52,39 +52,63 @@ dual licensed as above, without any additional terms or conditions.
[//]: # (badges)

[deps-image]: https://deps.rs/repo/github/RustCrypto/AEADs/status.svg

[deps-link]: https://deps.rs/repo/github/RustCrypto/AEADs

[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg

[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260038-AEADs

[//]: # (general links)

[AEAD]: https://en.wikipedia.org/wiki/Authenticated_encryption

[IND-CCA3]: https://eprint.iacr.org/2004/272.pdf

[//]: # (crates)

[`aead`]: https://docs.rs/aead

[`aes-ccm`]: https://crates.io/crates/aes-ccm

[`aes-gcm`]: https://github.com/RustCrypto/AEADs/tree/master/aes-gcm

[`aes-gcm-siv`]: https://github.com/RustCrypto/AEADs/tree/master/aes-gcm-siv

[`aes-siv`]: https://github.com/RustCrypto/AEADs/tree/master/aes-siv

[`ascon-aead`]: https://github.com/RustCrypto/AEADs/tree/master/ascon-aead

[`belt-dwp`]: https://github.com/RustCrypto/AEADs/tree/master/belt-dwp

[`ccm`]: https://github.com/RustCrypto/AEADs/tree/master/ccm

[`chacha20poly1305`]: https://github.com/RustCrypto/AEADs/tree/master/chacha20poly1305

[`deoxys`]: https://github.com/RustCrypto/AEADs/tree/master/deoxys

[`eax`]: https://github.com/RustCrypto/AEADs/tree/master/eax

[`mgm`]: https://github.com/RustCrypto/AEADs/tree/master/mgm

[//]: # (algorithms)

[AES-GCM]: https://en.wikipedia.org/wiki/Galois/Counter_Mode

[AES-GCM-SIV]: https://en.wikipedia.org/wiki/AES-GCM-SIV

[AES-SIV]: https://github.com/miscreant/meta/wiki/AES-SIV

[Ascon]: https://ascon.iaik.tugraz.at/

[CCM]: https://en.wikipedia.org/wiki/CCM_mode

[Deoxys-I/II]: https://sites.google.com/view/deoxyscipher

[EAX]: https://en.wikipedia.org/wiki/EAX_mode

[MGM]: https://eprint.iacr.org/2019/123.pdf

[BeltDwp]: https://apmi.bsu.by/assets/files/std/belt-spec372.pdf

[(X)ChaCha20Poly1305]: https://tools.ietf.org/html/rfc8439
7 changes: 1 addition & 6 deletions belt-dwp/src/ghash.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
use aead::{
consts::U16,
KeyInit,
KeySizeUser,
consts::U1
};
use aead::{consts::U1, consts::U16, KeyInit, KeySizeUser};
use belt_block::cipher::{BlockSizeUser, ParBlocksSizeUser};
use universal_hash::{Reset, UhfBackend, UhfClosure, UniversalHash};

Expand Down
8 changes: 3 additions & 5 deletions belt-dwp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,12 @@
//! [`aead::Buffer`] for `arrayvec::ArrayVec` (re-exported from the [`aead`] crate as
//! [`aead::arrayvec::ArrayVec`]).

use aead::consts::{U0, U16, U32, U8};
pub use aead::{self, AeadCore, AeadInPlace, Error, Key, KeyInit, KeySizeUser};
use aead:: {
consts::{U0, U16, U32, U8},
};

use belt_block::cipher::{Block, BlockEncrypt, KeyIvInit, StreamCipher};
use belt_block::{belt_block_raw, BeltBlock};
use belt_ctr::BeltCtr;
use belt_block::cipher::{Block, BlockEncrypt, KeyIvInit, StreamCipher};
use universal_hash::UniversalHash;

use crate::{
Expand Down Expand Up @@ -172,7 +170,7 @@ impl Cipher {
) -> aead::Result<Tag> {
let sizes_block =
get_sizes_block(associated_data.len() as u64 * 8, buffer.len() as u64 * 8);

// 3. For 𝑖 = 1, 2, . . . , 𝑚 do:
// 3.1 𝑡 ← 𝑡 ⊕ (𝐼𝑖 ‖ 0^{128−|𝐼𝑖|})
// 3.2 𝑡 ← 𝑡 * 𝑟.
Expand Down
8 changes: 4 additions & 4 deletions belt-dwp/tests/belt.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use aead::AeadInPlace;
use hex_literal::hex;
use belt_dwp::{BeltDwp, KeyInit};
use hex_literal::hex;

/// Test from Appendix A, tables 19-20 of [STB 34.101.31-2020](https://apmi.bsu.by/assets/files/std/belt-spec372.pdf)
#[test]
Expand Down Expand Up @@ -30,9 +30,9 @@ fn test_belt_dwp() {
x: hex!("DF181ED0 08A20F43 DCBBB936 50DAD34B"),
y: hex!("E12BDC1A E28257EC 703FCCF0 95EE8DF1"),
t: hex!("6A2C2C94 C4150DC0"),
}
},
];

for vec in test_vectors {
let mut x = vec.x;
let beltdwp = BeltDwp::new_from_slice(&vec.k).unwrap();
Expand All @@ -44,4 +44,4 @@ fn test_belt_dwp() {
.unwrap();
assert_eq!(x, vec.x);
}
}
}

0 comments on commit e2ffe6b

Please sign in to comment.