* Add Rustfmt

* Add Taplo
This commit is contained in:
daxpedda
2022-01-05 21:19:02 -08:00
committed by GitHub
parent 36f0a55518
commit 47a26a19c5
30 changed files with 698 additions and 554 deletions
+3 -3
View File
@@ -5,13 +5,13 @@
// License, Version 2.0 found in the LICENSE-APACHE file in the root directory
// of this source tree.
//! Includes the KeGroup trait and definitions for the
//! key exchange groups
//! Includes the KeGroup trait and definitions for the key exchange groups
use crate::errors::InternalError;
use generic_array::{ArrayLength, GenericArray};
use rand::{CryptoRng, RngCore};
use crate::errors::InternalError;
/// A group representation for use in the key exchange
pub trait KeGroup: Sized + Clone {
/// Length of the public key
+3 -2
View File
@@ -7,8 +7,6 @@
//! Key Exchange group implementation for p256
use super::KeGroup;
use crate::errors::InternalError;
use generic_array::typenum::{U32, U33};
use generic_array::GenericArray;
use p256_::elliptic_curve::group::GroupEncoding;
@@ -17,6 +15,9 @@ use p256_::elliptic_curve::{PublicKey, SecretKey};
use p256_::NistP256;
use rand::{CryptoRng, RngCore};
use super::KeGroup;
use crate::errors::InternalError;
impl KeGroup for PublicKey<NistP256> {
type PkLen = U33;
type SkLen = U32;
+5 -3
View File
@@ -7,8 +7,6 @@
//! Key Exchange group implementation for ristretto255
use super::KeGroup;
use crate::errors::InternalError;
use curve25519_dalek::constants::RISTRETTO_BASEPOINT_POINT;
use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint};
use curve25519_dalek::scalar::Scalar;
@@ -16,6 +14,9 @@ use generic_array::typenum::U32;
use generic_array::GenericArray;
use rand::{CryptoRng, RngCore};
use super::KeGroup;
use crate::errors::InternalError;
impl KeGroup for RistrettoPoint {
type PkLen = U32;
type SkLen = U32;
@@ -36,7 +37,8 @@ impl KeGroup for RistrettoPoint {
Scalar::from_bytes_mod_order_wide(&scalar_bytes)
}
// Tests need an exact conversion from bytes to scalar, sampling only 32 bytes from rng
// Tests need an exact conversion from bytes to scalar, sampling only 32 bytes
// from rng
#[cfg(test)]
{
let mut scalar_bytes = [0u8; 32];
+5 -3
View File
@@ -7,12 +7,14 @@
//! Key Exchange group implementation for X25519
use super::KeGroup;
use crate::errors::InternalError;
use generic_array::{typenum::U32, GenericArray};
use generic_array::typenum::U32;
use generic_array::GenericArray;
use rand::{CryptoRng, RngCore};
use x25519_dalek::{PublicKey, StaticSecret};
use super::KeGroup;
use crate::errors::InternalError;
/// The implementation of such a subgroup for Ristretto
impl KeGroup for PublicKey {
type PkLen = U32;