summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openpgp/src/packet/aed.rs21
-rw-r--r--openpgp/src/parse/parse.rs4
-rw-r--r--openpgp/src/serialize/mod.rs2
-rw-r--r--openpgp/src/serialize/stream.rs2
-rw-r--r--tool/src/commands/dump.rs4
5 files changed, 17 insertions, 16 deletions
diff --git a/openpgp/src/packet/aed.rs b/openpgp/src/packet/aed.rs
index 95f09db8..6fb8f630 100644
--- a/openpgp/src/packet/aed.rs
+++ b/openpgp/src/packet/aed.rs
@@ -21,8 +21,8 @@ use Result;
pub struct AED1 {
/// CTB packet header fields.
pub(crate) common: packet::Common,
- /// Cipher algorithm.
- cipher: SymmetricAlgorithm,
+ /// Symmetric algorithm.
+ sym_algo: SymmetricAlgorithm,
/// AEAD algorithm.
aead: AEADAlgorithm,
/// Chunk size.
@@ -33,7 +33,7 @@ pub struct AED1 {
impl AED1 {
/// Creates a new AED1 object.
- pub fn new(cipher: SymmetricAlgorithm,
+ pub fn new(sym_algo: SymmetricAlgorithm,
aead: AEADAlgorithm,
chunk_size: usize,
iv: Box<[u8]>) -> Result<Self> {
@@ -51,21 +51,22 @@ impl AED1 {
Ok(AED1 {
common: Default::default(),
- cipher: cipher,
+ sym_algo: sym_algo,
aead: aead,
chunk_size: chunk_size,
iv: iv,
})
}
- /// Gets the cipher algorithm.
- pub fn cipher(&self) -> SymmetricAlgorithm {
- self.cipher
+ /// Gets the symmetric algorithm.
+ pub fn symmetric_algo(&self) -> SymmetricAlgorithm {
+ self.sym_algo
}
- /// Sets the cipher algorithm.
- pub fn set_cipher(&mut self, cipher: SymmetricAlgorithm) -> SymmetricAlgorithm {
- ::std::mem::replace(&mut self.cipher, cipher)
+ /// Sets the sym_algo algorithm.
+ pub fn set_sym_algo(&mut self, sym_algo: SymmetricAlgorithm)
+ -> SymmetricAlgorithm {
+ ::std::mem::replace(&mut self.sym_algo, sym_algo)
}
/// Gets the AEAD algorithm.
diff --git a/openpgp/src/parse/parse.rs b/openpgp/src/parse/parse.rs
index 2fb38450..ab7de21a 100644
--- a/openpgp/src/parse/parse.rs
+++ b/openpgp/src/parse/parse.rs
@@ -3656,7 +3656,7 @@ impl<'a> PacketParser<'a> {
{
let data = self.data(aed.chunk_digest_size()?)?;
let mut dec = aead::Decryptor::new(
- 1, aed.cipher(), aed.aead(), aed.chunk_size(),
+ 1, aed.symmetric_algo(), aed.aead(), aed.chunk_size(),
aed.iv(), key, &data[..cmp::min(data.len(), aed.chunk_digest_size()?)])?;
let mut chunk = Vec::new();
dec.take(aed.chunk_size() as u64).read_to_end(&mut chunk)?;
@@ -3669,7 +3669,7 @@ impl<'a> PacketParser<'a> {
// above with the same parameters.
let reader = self.take_reader();
let mut reader = aead::BufferedReaderDecryptor::with_cookie(
- 1, aed.cipher(), aed.aead(), aed.chunk_size(),
+ 1, aed.symmetric_algo(), aed.aead(), aed.chunk_size(),
aed.iv(), key, reader, Cookie::default()).unwrap();
reader.cookie_mut().level = Some(self.recursion_depth());
diff --git a/openpgp/src/serialize/mod.rs b/openpgp/src/serialize/mod.rs
index 3dc4e1de..8ecf202d 100644
--- a/openpgp/src/serialize/mod.rs
+++ b/openpgp/src/serialize/mod.rs
@@ -1747,7 +1747,7 @@ impl AED1 {
fn serialize_headers<W: io::Write>(&self, o: &mut W)
-> Result<()> {
o.write_all(&[1, // Version.
- self.cipher().into(),
+ self.symmetric_algo().into(),
self.aead().into(),
self.chunk_size().trailing_zeros() as u8 - 6])?;
o.write_all(self.iv())?;
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs
index 6b3b0f52..173a0329 100644
--- a/openpgp/src/serialize/stream.rs
+++ b/openpgp/src/serialize/stream.rs
@@ -1018,7 +1018,7 @@ impl<'a> Encryptor<'a> {
writer::AEADEncryptor::new(
inner.into(),
Cookie::new(level),
- aed.cipher(),
+ aed.symmetric_algo(),
aed.aead(),
aed.chunk_size(),
aed.iv(),
diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs
index da092a52..d8faaca8 100644
--- a/tool/src/commands/dump.rs
+++ b/tool/src/commands/dump.rs
@@ -61,7 +61,7 @@ pub fn dump(input: &mut io::Read, output: &mut io::Write, mpis: bool, hex: bool,
Packet::AED(_) if sk.is_some() => {
let sk = sk.as_ref().unwrap();
let algo = if let Packet::AED(ref aed) = pp.packet {
- aed.cipher()
+ aed.symmetric_algo()
} else {
unreachable!()
};
@@ -387,7 +387,7 @@ impl PacketDumper {
AED(ref a) => {
writeln!(output, "AEAD Encrypted Data Packet")?;
writeln!(output, "{} Version: {}", i, a.version())?;
- writeln!(output, "{} Cipher: {}", i, a.cipher())?;
+ writeln!(output, "{} Cipher: {}", i, a.symmetric_algo())?;
writeln!(output, "{} AEAD: {}", i, a.aead())?;
writeln!(output, "{} Chunk size: {}", i, a.chunk_size())?;
writeln!(output, "{} IV: {}", i, hex::encode(a.iv()))?;