summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/aead.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-10-23 17:17:02 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-10-23 17:17:02 +0200
commitdcc70d1cbe8e89f735d10c9cd66e7cfe17c73a9c (patch)
treeeaa1c8171976b0a14c95eff9a88ce5f493807662 /openpgp/src/crypto/aead.rs
parente6e2658e8159449b0a6752d83db6f490942b8bf8 (diff)
openpgp: Use Vec::resize instead of a loop.
- Instead of pushing an element at a time, use Vec::resize to grow the vector to the desired size.
Diffstat (limited to 'openpgp/src/crypto/aead.rs')
-rw-r--r--openpgp/src/crypto/aead.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs
index 0a34cbae..0f3e5330 100644
--- a/openpgp/src/crypto/aead.rs
+++ b/openpgp/src/crypto/aead.rs
@@ -304,9 +304,7 @@ impl<'a> Decryptor<'a> {
// chunk, then we have to double buffer.
let double_buffer = to_decrypt > plaintext.len() - pos;
let buffer = if double_buffer {
- while self.buffer.len() < to_decrypt {
- self.buffer.push(0u8);
- }
+ self.buffer.resize(to_decrypt, 0);
&mut self.buffer[..]
} else {
&mut plaintext[pos..pos + to_decrypt]