diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2022-06-09 12:05:42 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2024-01-22 13:05:38 +0100 |
commit | 96d829d681ea1b860bf4b16439082929f4636147 (patch) | |
tree | df23193f76319a0be62e0d2630d11157ce1a0da1 /openpgp/src/parse/stream.rs | |
parent | f396703a0ca809ce6200d7cb009a9bc83dd6683a (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/parse/stream.rs')
-rw-r--r-- | openpgp/src/parse/stream.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 46188fd0..288df6ac 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -1259,7 +1259,7 @@ impl<'a> VerifierBuilder<'a> { // Do not eagerly map `t` to the current time. let t = time.into(); Ok(Verifier { - decryptor: Decryptor::from_buffered_reader( + decryptor: Decryptor::from_cookie_reader( policy, self.message, NoDecryptionHelper { v: helper, }, @@ -1605,7 +1605,7 @@ impl<'a> DetachedVerifierBuilder<'a> { // Do not eagerly map `t` to the current time. let t = time.into(); Ok(DetachedVerifier { - decryptor: Decryptor::from_buffered_reader( + decryptor: Decryptor::from_cookie_reader( policy, self.signatures, NoDecryptionHelper { v: helper, }, @@ -2047,7 +2047,7 @@ impl<'a> DecryptorBuilder<'a> { { // Do not eagerly map `t` to the current time. let t = time.into(); - Decryptor::from_buffered_reader( + Decryptor::from_cookie_reader( policy, self.message, helper, @@ -2322,7 +2322,7 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { /// Creates the `Decryptor`, and buffers the data up to `buffer_size`. #[allow(clippy::redundant_pattern_matching)] - fn from_buffered_reader<T>( + fn from_cookie_reader<T>( policy: &'a dyn Policy, bio: Box<dyn BufferedReader<Cookie> + 'a>, helper: H, time: T, @@ -2334,7 +2334,7 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { -> Result<Decryptor<'a, H>> where T: Into<Option<time::SystemTime>> { - tracer!(TRACE, "Decryptor::from_buffered_reader", TRACE_INDENT); + tracer!(TRACE, "Decryptor::from_cookie_reader", TRACE_INDENT); let time = time.into(); let tolerance = time @@ -2343,7 +2343,7 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { *crate::packet::signature::subpacket::CLOCK_SKEW_TOLERANCE); let time = time.unwrap_or_else(crate::now); - let mut ppr = PacketParserBuilder::from_buffered_reader(bio)? + let mut ppr = PacketParserBuilder::from_cookie_reader(bio)? .map(mapping) .csf_transformation(csf_transformation) .build()?; |