Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X25519 using fiat-crypto Curve25519 field arithmetic #197

Merged
merged 23 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3abfae0
ecc: Add fiat-crypto Curve25519 generated Rust code
brycx Apr 27, 2021
2aa8b0f
ecc: Add initial draft of X25519 implementation
brycx Apr 27, 2021
633bddd
ecc: Add basic RFC tests to X25519
brycx Apr 27, 2021
28a0e7d
tests: Add Wycheproof test vectors for standard X25519
brycx Apr 27, 2021
cee8519
tests: Add Wycheproof runner and fix warnings
brycx Apr 27, 2021
1de7409
tests: Setup Wycheproof runner for X25519
brycx Apr 27, 2021
ab91329
tests: Make separate test_runner for X25519 to follow earlier convent…
brycx Apr 30, 2021
fd82cce
x25519: Rename x25519_with_err -> x25519
brycx Apr 30, 2021
1075b2e
x25519: Only imports from core
brycx Apr 30, 2021
e3b19dd
x25519: Test that the MSB in final byte of group point U is ignored d…
brycx Apr 30, 2021
04dab0d
x25519: Fix debug_assert sanity check
brycx Apr 30, 2021
97f0994
ecc: Update fiat-crypto Curve25519 arithmetic
brycx Sep 29, 2021
19220fa
ecc: Create raw-byte wrapper newtypes SecretKey, PublicKey and Shared…
brycx Sep 29, 2021
7b7b5ba
ecc: key_agreement taking PublicKey, SecretKey and returning SharedSe…
brycx Sep 29, 2021
56d88e5
ecc: Handle remaining flags in Wycheproof test vectors
brycx Sep 30, 2021
cfea5f1
NIT
brycx Sep 30, 2021
2751d59
ecc: Documentation improvements
brycx Sep 30, 2021
bb42ea5
ecc: Scalar should clamp in from_slice()
brycx Sep 30, 2021
b8ff763
ecc: Use FieldElement directly in mont_ladder()
brycx Sep 30, 2021
57fd941
ecc: No unwrap() or expect() calls in Orion nor fiat-crypto so panic-…
brycx Sep 30, 2021
18cabfa
ecc: Remove unused Neg impl (needed for CT-swap, but this is used dir…
brycx Sep 30, 2021
ff5b163
ecc: Update 1M RFC iter test
brycx Sep 30, 2021
d0273d1
Update README with support for X25519
brycx Oct 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ Orion is a cryptography library written in pure Rust. It aims to provide easy an

Currently supports:
* **AEAD**: (X)ChaCha20Poly1305.
* **Stream ciphers**: (X)ChaCha20.
* **Hashing**: BLAKE2b, SHA2.
* **KDF**: HKDF, PBKDF2, Argon2i.
* **Key exchange**: X25519.
* **MAC**: HMAC, Poly1305.
* **Hashing**: BLAKE2b, SHA2.
* **Stream ciphers**: (X)ChaCha20.

### Security
This library has **not undergone any third-party security audit**. Usage is at **own risk**.
Expand Down
694 changes: 694 additions & 0 deletions src/hazardous/ecc/fiat_curve25519_u64.rs

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions src/hazardous/ecc/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// MIT License

// Copyright (c) 2021 The orion Developers

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#[allow(
dead_code,
non_camel_case_types,
clippy::unnecessary_cast,
clippy::unused_unit
)]
/// Formally verified Curve25519 field arithmetic from: https://github.com/mit-plv/fiat-crypto
/// Last taken at commit: https://github.com/mit-plv/fiat-crypto/commit/626203aec9fcf5617631fb687d719e5e78dac09f
mod fiat_curve25519_u64;

/// Diffie-Hellman key exchange over Curve25519 as specified in the [RFC 7748](https://datatracker.ietf.org/doc/html/rfc7748).
pub mod x25519;