trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sor...@apache.org
Subject [trafficserver] branch master updated: TS-4906: Ignore EVP return values (CID 1363289)
Date Wed, 28 Sep 2016 22:03:42 GMT
This is an automated email from the ASF dual-hosted git repository.

sorber pushed a commit to branch master
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  d7d27c3   TS-4906: Ignore EVP return values (CID 1363289)
d7d27c3 is described below

commit d7d27c3b09a6252d0094d7cbeae550b2a94a8c68
Author: Phil Sorber <sorber@apache.org>
AuthorDate: Wed Sep 28 12:52:10 2016 -0600

    TS-4906: Ignore EVP return values (CID 1363289)
---
 lib/ts/HashMD5.cc | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lib/ts/HashMD5.cc b/lib/ts/HashMD5.cc
index c457b71..f3698d9 100644
--- a/lib/ts/HashMD5.cc
+++ b/lib/ts/HashMD5.cc
@@ -20,20 +20,21 @@
  */
 
 #include "ts/HashMD5.h"
+#include "ts/ink_assert.h"
 
-ATSHashMD5::ATSHashMD5(void)
+ATSHashMD5::ATSHashMD5(void) : md_len(0), finalized(false)
 {
-  ctx = EVP_MD_CTX_create();
-  EVP_DigestInit(ctx, EVP_md5());
-  md_len    = 0;
-  finalized = false;
+  ctx     = EVP_MD_CTX_create();
+  int ret = EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
+  ink_assert(ret == 1);
 }
 
 void
 ATSHashMD5::update(const void *data, size_t len)
 {
   if (!finalized) {
-    EVP_DigestUpdate(ctx, data, len);
+    int ret = EVP_DigestUpdate(ctx, data, len);
+    ink_assert(ret == 1);
   }
 }
 
@@ -41,7 +42,8 @@ void
 ATSHashMD5::final(void)
 {
   if (!finalized) {
-    EVP_DigestFinal_ex(ctx, md_value, &md_len);
+    int ret = EVP_DigestFinal_ex(ctx, md_value, &md_len);
+    ink_assert(ret == 1);
     finalized = true;
   }
 }
@@ -65,9 +67,10 @@ ATSHashMD5::size(void) const
 void
 ATSHashMD5::clear(void)
 {
-  EVP_MD_CTX_destroy(ctx);
-  ctx = EVP_MD_CTX_create();
-  EVP_DigestInit(ctx, EVP_md5());
+  int ret = EVP_MD_CTX_cleanup(ctx);
+  ink_assert(ret == 1);
+  ret = EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
+  ink_assert(ret == 1);
   md_len    = 0;
   finalized = false;
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message