aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/prov/openssl/openssl_hash.cpp
diff options
context:
space:
mode:
authorKirill A. Korinsky <[email protected]>2017-06-29 13:36:52 +0400
committerKirill A. Korinsky <[email protected]>2017-06-29 20:03:48 +0400
commite015fd1709b4b0c9cee7f8292f7e5ecd1b8d4ff7 (patch)
treee3d4a66f471204f389d96b91b3f2a56a643d93e1 /src/lib/prov/openssl/openssl_hash.cpp
parent8b0986310ae9fdf7fa93e28e2820d818cc954cdd (diff)
Don't crash if openssl can't allocate a new context
Diffstat (limited to 'src/lib/prov/openssl/openssl_hash.cpp')
-rw-r--r--src/lib/prov/openssl/openssl_hash.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lib/prov/openssl/openssl_hash.cpp b/src/lib/prov/openssl/openssl_hash.cpp
index d7a8014a8..16b1a79fe 100644
--- a/src/lib/prov/openssl/openssl_hash.cpp
+++ b/src/lib/prov/openssl/openssl_hash.cpp
@@ -58,6 +58,8 @@ class OpenSSL_HashFunction : public HashFunction
m_md = EVP_MD_CTX_new();
#endif
+ if(m_md == nullptr)
+ throw OpenSSL_Error("Can't allocate new context");
EVP_MD_CTX_init(m_md);
if(md && !EVP_DigestInit_ex(m_md, md, nullptr))
throw OpenSSL_Error("EVP_DigestInit_ex");