This commit is contained in:
Matthew LeVan 2023-12-20 09:50:07 -05:00
parent 78068c2820
commit ab27d667a0
2 changed files with 5 additions and 5 deletions

View File

@ -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);

View File

@ -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() {