pod for AESCiphertext
This commit is contained in:
parent
beba0eac55
commit
2d225de48c
|
@ -15,6 +15,7 @@ mod target_arch {
|
|||
use {
|
||||
super::pod,
|
||||
crate::{
|
||||
encryption::aes::AESCiphertext,
|
||||
encryption::elgamal::{ElGamalCiphertext, ElGamalPubkey},
|
||||
encryption::pedersen::{PedersenCommitment, PedersenDecryptHandle},
|
||||
errors::ProofError,
|
||||
|
@ -123,6 +124,18 @@ mod target_arch {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<AESCiphertext> for pod::AESCiphertext {
|
||||
fn from(ct: AESCiphertext) -> Self {
|
||||
Self(ct.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<pod::AESCiphertext> for AESCiphertext {
|
||||
fn from(ct: pod::AESCiphertext) -> Self {
|
||||
Self(ct.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl TryFrom<RangeProof> for pod::RangeProof64 {
|
||||
type Error = ProofError;
|
||||
|
||||
|
|
|
@ -69,3 +69,14 @@ pub struct RangeProof128(pub [u8; 736]);
|
|||
// Add the marker traits manually because `bytemuck` only adds them for some `u8` arrays
|
||||
unsafe impl Zeroable for RangeProof128 {}
|
||||
unsafe impl Pod for RangeProof128 {}
|
||||
|
||||
/// Serialization for AESCiphertext
|
||||
#[derive(Clone, Copy, Pod, Zeroable, PartialEq)]
|
||||
#[repr(transparent)]
|
||||
pub struct AESCiphertext(pub [u8; 16]);
|
||||
|
||||
impl fmt::Debug for AESCiphertext {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{:?}", self.0)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue