diff --git a/.github/workflows/concat-kdf.yml b/.github/workflows/one-step-kdf.yml similarity index 89% rename from .github/workflows/concat-kdf.yml rename to .github/workflows/one-step-kdf.yml index d866554..b96523f 100644 --- a/.github/workflows/concat-kdf.yml +++ b/.github/workflows/one-step-kdf.yml @@ -1,17 +1,17 @@ -name: concat-kdf +name: one-step-kdf on: pull_request: paths: - - ".github/workflows/concat-kdf.yml" - - "concat-kdf/**" + - ".github/workflows/one-step-kdf.yml" + - "one-step-kdf/**" - "Cargo.*" push: branches: master defaults: run: - working-directory: concat-kdf + working-directory: one-step-kdf env: CARGO_INCREMENTAL: 0 diff --git a/Cargo.lock b/Cargo.lock index 7f0a723..de8012b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,15 +88,6 @@ dependencies = [ "digest", ] -[[package]] -name = "concat-kdf" -version = "0.2.0-pre" -dependencies = [ - "digest", - "hex-literal", - "sha2", -] - [[package]] name = "cpufeatures" version = "0.2.17" @@ -205,6 +196,15 @@ version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +[[package]] +name = "one-step-kdf" +version = "0.1.0-pre" +dependencies = [ + "digest", + "hex-literal", + "sha2", +] + [[package]] name = "sha1" version = "0.11.0-rc.3" diff --git a/Cargo.toml b/Cargo.toml index 93fc126..05682de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [workspace] resolver = "2" members = [ + "ansi-x963-kdf", "bake-kdf", "hkdf", - "concat-kdf", - "ansi-x963-kdf", "kbkdf", + "one-step-kdf" ] [profile.dev] diff --git a/concat-kdf/CHANGELOG.md b/one-step-kdf/CHANGELOG.md similarity index 100% rename from concat-kdf/CHANGELOG.md rename to one-step-kdf/CHANGELOG.md diff --git a/concat-kdf/Cargo.toml b/one-step-kdf/Cargo.toml similarity index 61% rename from concat-kdf/Cargo.toml rename to one-step-kdf/Cargo.toml index bfcf23f..547caed 100644 --- a/concat-kdf/Cargo.toml +++ b/one-step-kdf/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "concat-kdf" -version = "0.2.0-pre" -description = "Concatenation Key Derivation Function (Concat KDF)" +name = "one-step-kdf" +version = "0.1.0-pre" +description = "One-Step Key Derivation Function as defined in NIST SP 800-56C R2" authors = ["RustCrypto Developers"] license = "MIT OR Apache-2.0" readme = "README.md" edition = "2024" -documentation = "https://docs.rs/concat-kdf" +documentation = "https://docs.rs/one-step-kdf" repository = "https://github.com/RustCrypto/KDFs" -keywords = ["crypto", "concat-kdf", "KDF", "NIST"] +keywords = ["crypto", "one-step-kdf", "KDF", "NIST"] categories = ["cryptography", "no-std"] rust-version = "1.85" diff --git a/concat-kdf/LICENSE-APACHE b/one-step-kdf/LICENSE-APACHE similarity index 100% rename from concat-kdf/LICENSE-APACHE rename to one-step-kdf/LICENSE-APACHE diff --git a/concat-kdf/LICENSE-MIT b/one-step-kdf/LICENSE-MIT similarity index 100% rename from concat-kdf/LICENSE-MIT rename to one-step-kdf/LICENSE-MIT diff --git a/concat-kdf/README.md b/one-step-kdf/README.md similarity index 54% rename from concat-kdf/README.md rename to one-step-kdf/README.md index e105aad..e35577a 100644 --- a/concat-kdf/README.md +++ b/one-step-kdf/README.md @@ -1,19 +1,21 @@ -# RustCrypto: Concat KDF +# RustCrypto: One-Step KDF [![crate][crate-image]][crate-link] [![Docs][docs-image]][docs-link] +[![Build Status][build-image]][build-link] ![Apache2/MIT licensed][license-image] ![Rust Version][rustc-image] [![Project Chat][chat-image]][chat-link] -[![Build Status][build-image]][build-link] -Pure Rust implementation of the Concatenation Key Derivation Function (Concat KDF) generic over hash function. -This function is described in the section 5.8.1 of [NIST SP 800-56A, Recommendation for Pair-Wise Key Establishment -Schemes Using Discrete Logarithm Cryptography](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-56ar.pdf). +Pure Rust implementation of the One-Step Key Derivation Function (formerly known as Concat KDF) +implemented generically over the underlying hash function. + +This KDF is described in the section 4 of +[NIST SP 800-56C: Recommendation for Key-Derivation Methods in Key-Establishment Schemes](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-56Cr2.pdf). # Usage -The most common way to use Concat KDF is as follows: you generate a shared secret with other party +The most common way to use One-Step KDF is as follows: you generate a shared secret with other party (e.g. via Diffie-Hellman algorithm) and use key derivation function to derive a shared key. ```rust @@ -21,7 +23,7 @@ use hex_literal::hex; use sha2::Sha256; let mut key = [0u8; 16]; -concat_kdf::derive_key_into::(b"secret", b"shared-info", &mut key).unwrap(); +one_step_kdf::derive_key_into::(b"secret", b"shared-info", &mut key).unwrap(); assert_eq!(key, hex!("960db2c549ab16d71a7b008e005c2bdc")); ``` @@ -40,13 +42,13 @@ Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. -[crate-image]: https://img.shields.io/crates/v/concat-kdf.svg -[crate-link]: https://crates.io/crates/concat-kdf -[docs-image]: https://docs.rs/concat-kdf/badge.svg -[docs-link]: https://docs.rs/concat-kdf/ +[crate-image]: https://img.shields.io/crates/v/one-step-kdf.svg +[crate-link]: https://crates.io/crates/one-step-kdf +[docs-image]: https://docs.rs/one-step-kdf/badge.svg +[docs-link]: https://docs.rs/one-step-kdf/ +[build-image]: https://github.com/RustCrypto/KDFs/actions/workflows/one-step-kdf.yml/badge.svg +[build-link]: https://github.com/RustCrypto/KDFs/actions/workflows/one-step-kdf.yml [license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg [rustc-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg [chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg [chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260043-KDFs -[build-image]: https://github.com/RustCrypto/KDFs/workflows/concat-kdf/badge.svg?branch=master&event=push -[build-link]: https://github.com/RustCrypto/KDFs/actions?query=workflow:concat-kdf diff --git a/concat-kdf/src/lib.rs b/one-step-kdf/src/lib.rs similarity index 94% rename from concat-kdf/src/lib.rs rename to one-step-kdf/src/lib.rs index 00c1928..ca7c15a 100644 --- a/concat-kdf/src/lib.rs +++ b/one-step-kdf/src/lib.rs @@ -19,7 +19,7 @@ use digest::{Digest, FixedOutputReset, Update, array::typenum::Unsigned}; /// use sha2::Sha256; /// /// let mut key = [0u8; 16]; -/// concat_kdf::derive_key_into::(b"secret", b"shared-info", &mut key).unwrap(); +/// one_step_kdf::derive_key_into::(b"secret", b"shared-info", &mut key).unwrap(); /// assert_eq!(key, hex!("960db2c549ab16d71a7b008e005c2bdc")); /// ``` pub fn derive_key_into(secret: &[u8], other_info: &[u8], key: &mut [u8]) -> Result<(), Error> @@ -53,7 +53,7 @@ where Ok(()) } -/// Concat KDF errors. +/// One-Step KDF errors. #[derive(Clone, Copy, Debug, PartialEq)] pub enum Error { /// The length of the secret is zero. diff --git a/concat-kdf/tests/tests.rs b/one-step-kdf/tests/tests.rs similarity index 96% rename from concat-kdf/tests/tests.rs rename to one-step-kdf/tests/tests.rs index 210cd47..541bcbf 100644 --- a/concat-kdf/tests/tests.rs +++ b/one-step-kdf/tests/tests.rs @@ -16,7 +16,7 @@ where let mut buf = [0u8; 256]; for key_length in 1..f.expected_key.len() { let key = &mut buf[..key_length]; - concat_kdf::derive_key_into::(f.secret, f.other_info, key).unwrap(); + one_step_kdf::derive_key_into::(f.secret, f.other_info, key).unwrap(); assert_eq!(&f.expected_key[..key_length], key); } } @@ -175,15 +175,15 @@ fn test_input_output_sha512() { #[test] fn test_no_secret() { assert_eq!( - concat_kdf::derive_key_into::(&[], &[], &mut [0u8; 42]), - Err(concat_kdf::Error::NoSecret) + one_step_kdf::derive_key_into::(&[], &[], &mut [0u8; 42]), + Err(one_step_kdf::Error::NoSecret) ); } #[test] fn test_no_output() { assert_eq!( - concat_kdf::derive_key_into::(&[0u8; 42], &[], &mut [0u8; 0]), - Err(concat_kdf::Error::NoOutput) + one_step_kdf::derive_key_into::(&[0u8; 42], &[], &mut [0u8; 0]), + Err(one_step_kdf::Error::NoOutput) ); }