mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 09:57:56 +03:00
ed
: shar
This commit is contained in:
parent
78068c2820
commit
ab27d667a0
@ -9,7 +9,7 @@ pub enum Error {
|
||||
InvalidKeyLength,
|
||||
InvalidOutputLength,
|
||||
InvalidHeadersLength,
|
||||
UnauthenticCipher,
|
||||
CipherNotAuthentic,
|
||||
}
|
||||
|
||||
pub fn _ac_aes_siv_en(
|
||||
@ -70,7 +70,7 @@ pub fn _ac_aes_siv_de(
|
||||
if let Ok(mut cipher) = Aes128Siv::new_from_slice(&key) {
|
||||
match cipher.decrypt_in_place_detached(data, message, iv_array) {
|
||||
Ok(_) => (),
|
||||
Err(_) => return Err(Error::UnauthenticCipher),
|
||||
Err(_) => return Err(Error::CipherNotAuthentic),
|
||||
}
|
||||
} else {
|
||||
return Err(Error::InvalidKeyLength);
|
||||
@ -79,7 +79,7 @@ pub fn _ac_aes_siv_de(
|
||||
if let Ok(mut cipher) = Aes192Siv::new_from_slice(&key) {
|
||||
match cipher.decrypt_in_place_detached(data, message, iv_array) {
|
||||
Ok(_) => (),
|
||||
Err(_) => return Err(Error::UnauthenticCipher),
|
||||
Err(_) => return Err(Error::CipherNotAuthentic),
|
||||
}
|
||||
} else {
|
||||
return Err(Error::InvalidKeyLength);
|
||||
@ -88,7 +88,7 @@ pub fn _ac_aes_siv_de(
|
||||
if let Ok(mut cipher) = Aes256Siv::new_from_slice(&key) {
|
||||
match cipher.decrypt_in_place_detached(data, message, iv_array) {
|
||||
Ok(_) => (),
|
||||
Err(_) => return Err(Error::UnauthenticCipher),
|
||||
Err(_) => return Err(Error::CipherNotAuthentic),
|
||||
}
|
||||
} else {
|
||||
return Err(Error::InvalidKeyLength);
|
||||
|
@ -14,7 +14,7 @@ pub fn ac_ed_puck(seed: &mut [u8; 32], out: &mut [u8; 32]) {
|
||||
/// to the given output slice.
|
||||
pub fn ac_ed_shar(public: &[u8; 32], seed: &[u8; 32], out: &mut [u8; 32]) {
|
||||
let self_key = SigningKey::from_bytes(seed);
|
||||
let self_secret = StaticSecret::from(self_key.to_bytes());
|
||||
let self_secret = StaticSecret::from(self_key.to_scalar_bytes());
|
||||
|
||||
if let Ok(compressed_ed_pt) = CompressedEdwardsY::from_slice(public) {
|
||||
if let Some(ed_pt) = compressed_ed_pt.decompress() {
|
||||
|
Loading…
Reference in New Issue
Block a user