summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-11-01 16:19:49 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-11-01 16:21:29 +0100
commitabd3f57e3f154a7f6466195edfb35a196ad54266 (patch)
tree42dbfd14b0cc2b6d453bbe7f031538118aa2e328 /openpgp/src/crypto
parent83b6d0f1d1d6769bbdc00aa6c455b04576d7fdd2 (diff)
openpgp: Fix Blowfish key size.
- `cipher::Blowfish::KEY_SIZE` is the maximum key size supported by Blowfish. - Fixes #350.
Diffstat (limited to 'openpgp/src/crypto')
-rw-r--r--openpgp/src/crypto/symmetric.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/openpgp/src/crypto/symmetric.rs b/openpgp/src/crypto/symmetric.rs
index e1d78275..0d0dfbde 100644
--- a/openpgp/src/crypto/symmetric.rs
+++ b/openpgp/src/crypto/symmetric.rs
@@ -22,7 +22,8 @@ impl SymmetricAlgorithm {
match self {
SymmetricAlgorithm::TripleDES => Ok(cipher::Des3::KEY_SIZE),
SymmetricAlgorithm::CAST5 => Ok(cipher::Cast128::KEY_SIZE),
- SymmetricAlgorithm::Blowfish => Ok(cipher::Blowfish::KEY_SIZE),
+ // RFC4880, Section 9.2: Blowfish (128 bit key, 16 rounds)
+ SymmetricAlgorithm::Blowfish => Ok(16),
SymmetricAlgorithm::AES128 => Ok(cipher::Aes128::KEY_SIZE),
SymmetricAlgorithm::AES192 => Ok(cipher::Aes192::KEY_SIZE),
SymmetricAlgorithm::AES256 => Ok(cipher::Aes256::KEY_SIZE),