Skip to content

Commit

Permalink
fix(sym): disable broken blowfish
Browse files Browse the repository at this point in the history
Former-commit-id: d786f26
  • Loading branch information
dignifiedquire committed Mar 10, 2019
1 parent 60366fc commit b63fa44
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Symbols:
- [ ] ❓IDEA
- [x] DES
- [x] CAST5
- [x] Blowfish
- [ ] Blowfish
- [x] AES 128
- [x] AES 192
- [x] AES 256
Expand Down
22 changes: 11 additions & 11 deletions src/composed/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ mod tests {
}

fn test_parse_msg(entry: &str, base_path: &str) {
use pretty_env_logger;
let _ = pretty_env_logger::try_init();

// TODO: verify filename
let n = format!("{}/{}", base_path, entry);
let mut file = File::open(&n).unwrap_or_else(|_| panic!("no file: {}", &n));
Expand Down Expand Up @@ -717,20 +720,18 @@ mod tests {
// RSA
msg_test!(msg_gnupg_v1_003, "gnupg-v1-003");

// disabled because of blockciphers not updated
// msg_test!(msg_gnupg_v1_4_11_001, "gnupg-v1-4-11-001");
msg_test!(msg_gnupg_v1_4_11_001, "gnupg-v1-4-11-001");
msg_test!(msg_gnupg_v1_4_11_002, "gnupg-v1-4-11-002");
msg_test!(msg_gnupg_v1_4_11_003, "gnupg-v1-4-11-003");
msg_test!(msg_gnupg_v1_4_11_004, "gnupg-v1-4-11-004");
// disabled because of blockciphers not updated
// blowfish
// msg_test!(msg_gnupg_v1_4_11_005, "gnupg-v1-4-11-005");
msg_test!(msg_gnupg_v1_4_11_006, "gnupg-v1-4-11-006");
// disabled because of blockciphers not updated
// msg_test!(msg_gnupg_v2_0_17_001, "gnupg-v2-0-17-001");
msg_test!(msg_gnupg_v2_0_17_001, "gnupg-v2-0-17-001");
msg_test!(msg_gnupg_v2_0_17_002, "gnupg-v2-0-17-002");
msg_test!(msg_gnupg_v2_0_17_003, "gnupg-v2-0-17-003");
msg_test!(msg_gnupg_v2_0_17_004, "gnupg-v2-0-17-004");
// disabled because of blockciphers not updated
// blowfish
// msg_test!(msg_gnupg_v2_0_17_005, "gnupg-v2-0-17-005");
msg_test!(msg_gnupg_v2_0_17_006, "gnupg-v2-0-17-006");
// parsing error
Expand All @@ -742,13 +743,13 @@ mod tests {
// parsing error
// ECDH key - nist p512
// msg_test!(msg_gnupg_v2_1_5_003, "gnupg-v2-1-5-003");
// disabled because of blockciphers not updated
// msg_test!(msg_gnupg_v2_10_001, "gnupg-v2-10-001");

msg_test!(msg_gnupg_v2_10_001, "gnupg-v2-10-001");
msg_test!(msg_gnupg_v2_10_002, "gnupg-v2-10-002");
msg_test!(msg_gnupg_v2_10_003, "gnupg-v2-10-003");
msg_test!(msg_gnupg_v2_10_004, "gnupg-v2-10-004");
msg_test!(msg_gnupg_v2_10_005, "gnupg-v2-10-005");
// disabled because of blockciphers not updated
// blowfish
// msg_test!(msg_gnupg_v2_10_006, "gnupg-v2-10-006");
msg_test!(msg_gnupg_v2_10_007, "gnupg-v2-10-007");

Expand All @@ -757,8 +758,7 @@ mod tests {
// ECDH
// msg_test!(msg_e2e_002, "e2e-001");

// disabled because of blockciphers not updated
// msg_test!(msg_pgp_10_0_001, "pgp-10-0-001");
msg_test!(msg_pgp_10_0_001, "pgp-10-0-001");
msg_test!(msg_pgp_10_0_002, "pgp-10-0-002");
msg_test!(msg_pgp_10_0_003, "pgp-10-0-003");
msg_test!(msg_pgp_10_0_004, "pgp-10-0-004");
Expand Down
42 changes: 21 additions & 21 deletions src/crypto/sym.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use aes::{Aes128, Aes192, Aes256};
use blowfish::Blowfish;
// use blowfish::Blowfish;
use cast5::Cast5;
use cfb_mode::stream_cipher::{NewStreamCipher, StreamCipher};
use cfb_mode::Cfb;
Expand Down Expand Up @@ -133,7 +133,7 @@ impl SymmetricKeyAlgorithm {
SymmetricKeyAlgorithm::TripleDES => 24,
SymmetricKeyAlgorithm::CAST5 => 16,
// TODO: Validate this is the right key size.
SymmetricKeyAlgorithm::Blowfish => 56,
SymmetricKeyAlgorithm::Blowfish => 16, //56,
SymmetricKeyAlgorithm::AES128 => 16,
SymmetricKeyAlgorithm::AES192 => 24,
SymmetricKeyAlgorithm::AES256 => 32,
Expand Down Expand Up @@ -234,15 +234,15 @@ impl SymmetricKeyAlgorithm {
bs,
resync
),
SymmetricKeyAlgorithm::Blowfish => decrypt!(
Blowfish,
key,
iv_vec,
encrypted_prefix,
encrypted_data,
bs,
resync
),
SymmetricKeyAlgorithm::Blowfish => unimplemented_err!("needs fixing"), // decrypt!(
// Blowfish,
// key,
// iv_vec,
// encrypted_prefix,
// encrypted_data,
// bs,
// resync
// ),
SymmetricKeyAlgorithm::AES128 => decrypt!(
Aes128,
key,
Expand Down Expand Up @@ -317,9 +317,9 @@ impl SymmetricKeyAlgorithm {
decrypt_regular!(TdesEde3, key, iv_vec, ciphertext, self.block_size());
}
SymmetricKeyAlgorithm::CAST5 => decrypt_regular!(Cast5, key, iv_vec, ciphertext, bs),
SymmetricKeyAlgorithm::Blowfish => {
decrypt_regular!(Blowfish, key, iv_vec, ciphertext, self.block_size())
}
SymmetricKeyAlgorithm::Blowfish => unimplemented_err!("needs fixing"), // {
// decrypt_regular!(Blowfish, key, iv_vec, ciphertext, self.block_size())
// }
SymmetricKeyAlgorithm::AES128 => {
decrypt_regular!(Aes128, key, iv_vec, ciphertext, self.block_size())
}
Expand Down Expand Up @@ -451,9 +451,9 @@ impl SymmetricKeyAlgorithm {
SymmetricKeyAlgorithm::CAST5 => {
encrypt!(Cast5, key, iv_vec, prefix, data, bs, resync)
}
SymmetricKeyAlgorithm::Blowfish => {
encrypt!(Blowfish, key, iv_vec, prefix, data, bs, resync)
}
SymmetricKeyAlgorithm::Blowfish => unimplemented_err!("needs fixing"), // {
// encrypt!(Blowfish, key, iv_vec, prefix, data, bs, resync)
// }
SymmetricKeyAlgorithm::AES128 => {
encrypt!(Aes128, key, iv_vec, prefix, data, bs, resync)
}
Expand Down Expand Up @@ -499,9 +499,9 @@ impl SymmetricKeyAlgorithm {
encrypt_regular!(TdesEde3, key, iv_vec, plaintext, bs);
}
SymmetricKeyAlgorithm::CAST5 => encrypt_regular!(Cast5, key, iv_vec, plaintext, bs),
SymmetricKeyAlgorithm::Blowfish => {
encrypt_regular!(Blowfish, key, iv_vec, plaintext, bs)
}
SymmetricKeyAlgorithm::Blowfish => unimplemented_err!("needs fixing"), // {
// encrypt_regular!(Blowfish, key, iv_vec, plaintext, bs)
// }
SymmetricKeyAlgorithm::AES128 => encrypt_regular!(Aes128, key, iv_vec, plaintext, bs),
SymmetricKeyAlgorithm::AES192 => encrypt_regular!(Aes192, key, iv_vec, plaintext, bs),
SymmetricKeyAlgorithm::AES256 => encrypt_regular!(Aes256, key, iv_vec, plaintext, bs),
Expand Down Expand Up @@ -570,7 +570,7 @@ mod tests {
roundtrip!(roundtrip_aes192, SymmetricKeyAlgorithm::AES192);
roundtrip!(roundtrip_aes256, SymmetricKeyAlgorithm::AES256);
roundtrip!(roundtrip_tripledes, SymmetricKeyAlgorithm::TripleDES);
roundtrip!(roundtrip_blowfish, SymmetricKeyAlgorithm::Blowfish);
// roundtrip!(roundtrip_blowfish, SymmetricKeyAlgorithm::Blowfish);
roundtrip!(roundtrip_twofish, SymmetricKeyAlgorithm::Twofish);
roundtrip!(roundtrip_cast5, SymmetricKeyAlgorithm::CAST5);
}

0 comments on commit b63fa44

Please sign in to comment.