diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2022-06-09 12:05:42 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2022-06-10 11:15:40 +0200 |
commit | f77e833080e0476df8618a1f1e8009a0583929b6 (patch) | |
tree | 6e74c441a2efeed2baef3c9bfcd8b5299cc7f0fd /openpgp/src/crypto/symmetric.rs | |
parent | 990d3cc525773f3464fc0dbeba210bb24de63b6a (diff) |
openpgp: Rename every from_buffered_reader to from_cookie_reader.
- This is an internal interface that uses our reader stack's
cookie. We need this to traverse the buffered reader stack. We
did not, however, expose it as an external interface, because we
didn't want to bake in the cookie type into the API.
- Having a public API that operates on buffered readers is
convenient: the current Parser::from_reader operates on
io::Readers, and will most likely construct a
buffered_reader::Generic from it. This will eagerly buffer some
data, making this interface unsuitable if you want to read in one
artifact (e.g. an MPI) without consuming more data.
- Renaming the internal functions gives us a chance to add a more
general buffered reader interface.
Diffstat (limited to 'openpgp/src/crypto/symmetric.rs')
-rw-r--r-- | openpgp/src/crypto/symmetric.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/openpgp/src/crypto/symmetric.rs b/openpgp/src/crypto/symmetric.rs index ea4beb11..c9586906 100644 --- a/openpgp/src/crypto/symmetric.rs +++ b/openpgp/src/crypto/symmetric.rs @@ -60,14 +60,14 @@ impl<'a> Decryptor<'a> { where R: io::Read + Send + Sync + 'a, { - Self::from_buffered_reader( + Self::from_cookie_reader( algo, key, Box::new(buffered_reader::Generic::with_cookie( source, None, Default::default()))) } /// Instantiate a new symmetric decryptor. - fn from_buffered_reader(algo: SymmetricAlgorithm, key: &[u8], + fn from_cookie_reader(algo: SymmetricAlgorithm, key: &[u8], source: Box<dyn BufferedReader<Cookie> + 'a>) -> Result<Self> { @@ -182,7 +182,7 @@ impl<'a> BufferedReaderDecryptor<'a> { { Ok(BufferedReaderDecryptor { reader: buffered_reader::Generic::with_cookie( - Decryptor::from_buffered_reader(algo, key, reader)?, + Decryptor::from_cookie_reader(algo, key, reader)?, None, cookie), }) } |