mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-28 06:23:08 -08:00
doc(rp+rosenpass+ciphers+cipher-traits): Apply cargo fmt formatting
This commit is contained in:
committed by
Jan Winkelmann (keks)
parent
006946442a
commit
b21a95dbbd
@@ -66,10 +66,12 @@ where
|
|||||||
Static::keyed_hash(key, data, out)
|
Static::keyed_hash(key, data, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the key length of the keyed hash function.
|
||||||
pub const fn key_len(self) -> usize {
|
pub const fn key_len(self) -> usize {
|
||||||
Self::KEY_LEN
|
Self::KEY_LEN
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the hash length of the keyed hash function.
|
||||||
pub const fn hash_len(self) -> usize {
|
pub const fn hash_len(self) -> usize {
|
||||||
Self::HASH_LEN
|
Self::HASH_LEN
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
use rosenpass_cipher_traits::primitives::Aead as _;
|
|
||||||
use static_assertions::const_assert;
|
use static_assertions::const_assert;
|
||||||
|
|
||||||
pub mod subtle;
|
pub mod subtle;
|
||||||
|
|||||||
@@ -718,13 +718,11 @@ impl KnownResponseHasher {
|
|||||||
/// Panics in case of a problem with this underlying hash function
|
/// Panics in case of a problem with this underlying hash function
|
||||||
pub fn hash<Msg: AsBytes + FromBytes>(&self, msg: &Envelope<Msg>) -> KnownResponseHash {
|
pub fn hash<Msg: AsBytes + FromBytes>(&self, msg: &Envelope<Msg>) -> KnownResponseHash {
|
||||||
let data = &msg.as_bytes()[span_of!(Envelope<Msg>, msg_type..cookie)];
|
let data = &msg.as_bytes()[span_of!(Envelope<Msg>, msg_type..cookie)];
|
||||||
// TODO: the hash choice hasn't been propagated here so far
|
|
||||||
// TODO: FIX DOCU AND OUT-COMMENTED_CODE_BELOW
|
|
||||||
let hash_choice =
|
|
||||||
rosenpass_ciphers::subtle::keyed_hash::KeyedHash::incorrect_hmac_blake2b();
|
|
||||||
|
|
||||||
|
// This function is only used internally and results are not propagated
|
||||||
|
// to outside the peer. Thus, it uses SHAKE256 exclusively.
|
||||||
let mut hash = [0; 32];
|
let mut hash = [0; 32];
|
||||||
hash_choice
|
KeyedHash::keyed_shake256()
|
||||||
.keyed_hash(self.key.secret(), data, &mut hash)
|
.keyed_hash(self.key.secret(), data, &mut hash)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Public::from_slice(&hash[0..16]) // truncate to 16 bytes
|
Public::from_slice(&hash[0..16]) // truncate to 16 bytes
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use std::{process::Command};
|
use std::process::Command;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_gen_ipc_msg_types() -> anyhow::Result<()> {
|
fn test_gen_ipc_msg_types() -> anyhow::Result<()> {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ use std::pin::Pin;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::{net::SocketAddr, path::PathBuf, process::Command};
|
use std::{net::SocketAddr, path::PathBuf, process::Command};
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use rosenpass::config::ProtocolVersion;
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||||
use crate::key::WG_B64_LEN;
|
use crate::key::WG_B64_LEN;
|
||||||
|
use anyhow::Result;
|
||||||
|
use rosenpass::config::ProtocolVersion;
|
||||||
|
|
||||||
/// Used to define a peer for the rosenpass connection that consists of
|
/// Used to define a peer for the rosenpass connection that consists of
|
||||||
/// a directory for storing public keys and optionally an IP address and port of the endpoint,
|
/// a directory for storing public keys and optionally an IP address and port of the endpoint,
|
||||||
@@ -25,7 +25,7 @@ pub struct ExchangePeer {
|
|||||||
/// The IPs that are allowed for this peer.
|
/// The IPs that are allowed for this peer.
|
||||||
pub allowed_ips: Option<String>,
|
pub allowed_ips: Option<String>,
|
||||||
/// The protocol version used by the peer.
|
/// The protocol version used by the peer.
|
||||||
pub protocol_version: ProtocolVersion
|
pub protocol_version: ProtocolVersion,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Options for the exchange operation of the `rp` binary.
|
/// Options for the exchange operation of the `rp` binary.
|
||||||
|
|||||||
Reference in New Issue
Block a user