Fixed mantis Bug#1750: Don't call EVP_cleanup(). This will remove all digest from...
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 Jan 2011 12:15:39 +0000 (13:15 +0100)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Mon, 17 Jan 2011 12:15:39 +0000 (13:15 +0100)
src/util.cpp

index 6b7cbda..8aa5bd9 100644 (file)
@@ -47,7 +47,6 @@ std::string compute_md5_digest(std::string data)
     if ( EVP_DigestInit_ex(&mdctx, md, NULL) == 0 )
     {
         EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-        EVP_cleanup();  /*lint !e534 */
         throw std::invalid_argument("Could not set up digest context correctly");
     }
 
@@ -55,7 +54,6 @@ std::string compute_md5_digest(std::string data)
     if ( data.empty() )
     {
         EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-        EVP_cleanup();  /*lint !e534 */
         throw std::invalid_argument("Passed data is empty");
     }
 
@@ -63,7 +61,6 @@ std::string compute_md5_digest(std::string data)
     if ( EVP_DigestUpdate(&mdctx, data.c_str(), data.size()) == 0 )
     {
         EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-        EVP_cleanup();  /*lint !e534 */
         throw std::invalid_argument("Could not hash data into digest context");
     }
 
@@ -71,7 +68,6 @@ std::string compute_md5_digest(std::string data)
     if ( EVP_DigestFinal_ex(&mdctx, md_value, &md_len) == 0 )
     {
         EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-        EVP_cleanup();  /*lint !e534 */
         throw std::invalid_argument("Could not retrieve digest value");
     }
 
@@ -79,13 +75,11 @@ std::string compute_md5_digest(std::string data)
     if ( (md_len == 0) || (EVP_MD_CTX_size(&mdctx) == 0) )
     {
         EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-        EVP_cleanup();  /*lint !e534 */
         throw std::invalid_argument("Retrieved invalid digest value");
     }
 
     // Internal cleanup of the digest content.
     EVP_MD_CTX_cleanup(&mdctx); /*lint !e534 */
-    EVP_cleanup();  /*lint !e534 */
 
     // Convert md5 digest C string to hex.
     std::ostringstream oss_digest_md5_hex;