Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 13 additions & 35 deletions .github/workflows/crypto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,19 @@ jobs:
- run: cargo build --no-default-features --release --target ${{ matrix.target }}
--features aead,cipher,digest,elliptic-curve,signature,universal-hash

# TODO: use the reusable workflow after this crate will be part of the
# toot workspace
# minimal-versions:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - uses: RustCrypto/actions/cargo-cache@master
# - uses: actions-rs/toolchain@v1
# with:
# toolchain: nightly
# override: true
# profile: minimal
# - uses: RustCrypto/actions/cargo-hack-install@master
# - run: cargo update -Z minimal-versions
# - run: cargo hack test --release --feature-powerset
minimal-versions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: RustCrypto/actions/cargo-cache@master
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
- uses: RustCrypto/actions/cargo-hack-install@master
- run: cargo update -Z minimal-versions
- run: cargo hack test --release --feature-powerset

test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -88,23 +86,3 @@ jobs:
override: true
profile: minimal
- run: cargo clippy --all --all-features -- -D warnings

rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
override: true
profile: minimal

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
27 changes: 2 additions & 25 deletions .github/workflows/digest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
rust:
- 1.41.0 # MSRV
- 1.57.0 # MSRV
- stable
target:
- thumbv7em-none-eabi
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
strategy:
matrix:
rust:
# - 1.41.0 # MSRV
- 1.57.0 # MSRV
- stable
steps:
- uses: actions/checkout@v3
Expand All @@ -67,26 +67,3 @@ jobs:
- run: cargo test --features alloc
- run: cargo test --features std
- run: cargo test --all-features

# The `oid` feature bumps MSRV to 1.57, so we temporarily split this job.
test-msrv:
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- 1.41.0 # MSRV
steps:
- uses: actions/checkout@v3
- uses: RustCrypto/actions/cargo-cache@master
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
profile: minimal
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --features dev
- run: cargo test --features alloc
- run: cargo test --features std
32 changes: 32 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ members = [
"cipher",
"crypto",
"crypto-common",
"digest",
"elliptic-curve",
"kem",
"signature",
"signature/async",
"universal-hash",
]
exclude = [
"digest",
]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Collection of traits which describe functionality of cryptographic primitives.
| [`async‑signature`] | [Digital signature] | [![crates.io](https://img.shields.io/crates/v/async-signature.svg)](https://crates.io/crates/async-signature) | [![Documentation](https://docs.rs/async-signature/badge.svg)](https://docs.rs/async-signature) | ![MSRV 1.56][msrv-1.56] |
| [`cipher`] | [Block] and [stream cipher] | [![crates.io](https://img.shields.io/crates/v/cipher.svg)](https://crates.io/crates/cipher) | [![Documentation](https://docs.rs/cipher/badge.svg)](https://docs.rs/cipher) | ![MSRV 1.56][msrv-1.56] |
| [`crypto‑common`] | Common cryptographic traits | [![crates.io](https://img.shields.io/crates/v/crypto-common.svg)](https://crates.io/crates/crypto-common) | [![Documentation](https://docs.rs/crypto-common/badge.svg)](https://docs.rs/crypto-common) | ![MSRV 1.56][msrv-1.56] |
| [`digest`] | [Cryptographic hash function] | [![crates.io](https://img.shields.io/crates/v/digest.svg)](https://crates.io/crates/digest) | [![Documentation](https://docs.rs/digest/badge.svg)](https://docs.rs/digest) | ![MSRV 1.41][msrv-1.41] |
| [`digest`] | [Cryptographic hash function] | [![crates.io](https://img.shields.io/crates/v/digest.svg)](https://crates.io/crates/digest) | [![Documentation](https://docs.rs/digest/badge.svg)](https://docs.rs/digest) | ![MSRV 1.57][msrv-1.57] |
| [`elliptic‑curve`] | [Elliptic curve cryptography] | [![crates.io](https://img.shields.io/crates/v/elliptic-curve.svg)](https://crates.io/crates/elliptic-curve) | [![Documentation](https://docs.rs/elliptic-curve/badge.svg)](https://docs.rs/elliptic-curve) | ![MSRV 1.57][msrv-1.57] |
| [`kem`] | [Key encapsulation mechanism] | [![crates.io](https://img.shields.io/crates/v/kem.svg)](https://crates.io/crates/kem) | [![Documentation](https://docs.rs/kem/badge.svg)](https://docs.rs/kem) | ![MSRV 1.56][msrv-1.56] |
| [`password-hash`] | [Password hashing] | [![crates.io](https://img.shields.io/crates/v/password-hash.svg)](https://crates.io/crates/password-hash) | [![Documentation](https://docs.rs/password-hash/badge.svg)](https://docs.rs/password-hash) | ![MSRV 1.57][msrv-1.57] |
Expand Down Expand Up @@ -49,7 +49,6 @@ Unless you explicitly state otherwise, any contribution intentionally submitted
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
[deps-image]: https://deps.rs/repo/github/RustCrypto/traits/status.svg
[deps-link]: https://deps.rs/repo/github/RustCrypto/traits
[msrv-1.41]: https://img.shields.io/badge/rustc-1.41.0+-blue.svg
[msrv-1.56]: https://img.shields.io/badge/rustc-1.56.0+-blue.svg
[msrv-1.57]: https://img.shields.io/badge/rustc-1.57.0+-blue.svg

Expand Down
10 changes: 10 additions & 0 deletions digest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ 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).

## UNRELEASED
### Changed
- `crypto-common` dependency bumped to v0.2 ([#1173])
- Edition changed to 2021 and MSRV bumped to 1.57 ([#1173])

### Removed
- `Mac::new`, `Mac::new_from_slice`, and `Mac::generate_key` methods ([#1173])

[#1173]: https://github.com/RustCrypto/traits/pull/1173

## 0.10.6 (2022-11-17)
### Added
- `Mac::verify_reset` and `Mac::verify_slice_reset` methods ([#1154])
Expand Down
11 changes: 6 additions & 5 deletions digest/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
[package]
name = "digest"
description = "Traits for cryptographic hash functions and message authentication codes"
version = "0.10.6"
version = "0.11.0-pre"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
readme = "README.md"
edition = "2018"
edition = "2021"
rust-version = "1.57"
documentation = "https://docs.rs/digest"
repository = "https://github.com/RustCrypto/traits"
keywords = ["digest", "crypto", "hash"]
categories = ["cryptography", "no-std"]

[dependencies]
crypto-common = "0.1.3"
crypto-common = "0.2.0-pre"

# optional dependencies
block-buffer = { version = "0.10", optional = true }
block-buffer = { version = "0.11.0-pre", optional = true }
subtle = { version = "=2.4", default-features = false, optional = true }
blobby = { version = "0.3", optional = true }
const-oid = { version = "0.9", optional = true }
Expand All @@ -25,7 +26,7 @@ default = ["core-api"]
core-api = ["block-buffer"] # Enable Core API traits
mac = ["subtle"] # Enable MAC traits
rand_core = ["crypto-common/rand_core"] # Enable random key generation methods
oid = ["const-oid"] # OID support. WARNING: Bumps MSRV to 1.57
oid = ["const-oid"]
alloc = []
std = ["alloc", "crypto-common/std"]
dev = ["blobby"]
Expand Down
6 changes: 3 additions & 3 deletions digest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ See [RustCrypto/hashes][1] for implementations which use this trait.

## Minimum Supported Rust Version

Rust **1.41** or higher.
Rust **1.57** or higher.

Minimum supported Rust version can be changed in the future, but it will be
done with a minor version bump.
Expand All @@ -35,7 +35,7 @@ First add the `sha2` crate to your `Cargo.toml`:

```toml
[dependencies]
sha2 = "0.10"
sha2 = "0.11"
```

`sha2` and other crates re-export `digest` crate and `Digest` trait for
Expand Down Expand Up @@ -147,7 +147,7 @@ dual licensed as above, without any additional terms or conditions.
[docs-image]: https://docs.rs/digest/badge.svg
[docs-link]: https://docs.rs/digest/
[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
[rustc-image]: https://img.shields.io/badge/rustc-1.57+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260041-hashes
[build-image]: https://github.com/RustCrypto/traits/workflows/digest/badge.svg?branch=master&event=push
Expand Down
23 changes: 4 additions & 19 deletions digest/src/core_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use crate::InvalidOutputSize;
pub use crypto_common::{AlgorithmName, Block, BlockSizeUser, OutputSizeUser, Reset};

use block_buffer::{BlockBuffer, BufferKind};
use crypto_common::{
typenum::{IsLess, Le, NonZero, U256},
Output,
};
use crypto_common::Output;

mod ct_variable;
mod rt_variable;
Expand Down Expand Up @@ -40,22 +37,14 @@ pub trait BufferKindUser: BlockSizeUser {
}

/// Core trait for hash functions with fixed output size.
pub trait FixedOutputCore: UpdateCore + BufferKindUser + OutputSizeUser
where
Self::BlockSize: IsLess<U256>,
Le<Self::BlockSize, U256>: NonZero,
{
pub trait FixedOutputCore: UpdateCore + BufferKindUser + OutputSizeUser {
/// Finalize state using remaining data stored in the provided block buffer,
/// write result into provided array and leave `self` in a dirty state.
fn finalize_fixed_core(&mut self, buffer: &mut Buffer<Self>, out: &mut Output<Self>);
}

/// Core trait for hash functions with extendable (XOF) output size.
pub trait ExtendableOutputCore: UpdateCore + BufferKindUser
where
Self::BlockSize: IsLess<U256>,
Le<Self::BlockSize, U256>: NonZero,
{
pub trait ExtendableOutputCore: UpdateCore + BufferKindUser {
/// XOF reader core state.
type ReaderCore: XofReaderCore;

Expand All @@ -81,11 +70,7 @@ pub trait XofReaderCore: BlockSizeUser {
/// [`finalize_variable_core`]: VariableOutputCore::finalize_variable_core
/// [`new`]: VariableOutputCore::new
/// [`TRUNC_SIDE`]: VariableOutputCore::TRUNC_SIDE
pub trait VariableOutputCore: UpdateCore + OutputSizeUser + BufferKindUser + Sized
where
Self::BlockSize: IsLess<U256>,
Le<Self::BlockSize, U256>: NonZero,
{
pub trait VariableOutputCore: UpdateCore + OutputSizeUser + BufferKindUser + Sized {
/// Side which should be used in a truncated result.
const TRUNC_SIDE: TruncSide;

Expand Down
Loading