aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/misc/pbes2/pbes2.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2015-10-11 11:08:42 -0400
committerJack Lloyd <[email protected]>2015-10-11 11:08:42 -0400
commitaad256035d4ecb9c4e87a7698f74f6f3178da0e2 (patch)
tree1368a1010af106303f2b59541c96e288ef85302a /src/lib/misc/pbes2/pbes2.cpp
parent386ee3f085a7c9837ef7efbc26876e1bae8110e5 (diff)
Add missing null pointer check to PBES2
Diffstat (limited to 'src/lib/misc/pbes2/pbes2.cpp')
-rw-r--r--src/lib/misc/pbes2/pbes2.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/misc/pbes2/pbes2.cpp b/src/lib/misc/pbes2/pbes2.cpp
index ab740ff5d..470e33cb0 100644
--- a/src/lib/misc/pbes2/pbes2.cpp
+++ b/src/lib/misc/pbes2/pbes2.cpp
@@ -81,6 +81,9 @@ pbes2_encrypt(const secure_vector<byte>& key_bits,
std::unique_ptr<Cipher_Mode> enc(get_cipher_mode(cipher, ENCRYPTION));
+ if(!enc)
+ throw Decoding_Error("PBE-PKCS5 cannot decrypt no cipher " + cipher);
+
std::unique_ptr<PBKDF> pbkdf(get_pbkdf("PBKDF2(" + prf + ")"));
const size_t key_length = enc->key_spec().maximum_keylength();