aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/security/digest/sha1/sha1MessageDigest.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
index a51e250d..51eec6ae 100644
--- a/src/security/digest/sha1/sha1MessageDigest.cpp
+++ b/src/security/digest/sha1/sha1MessageDigest.cpp
@@ -27,6 +27,7 @@
#include "vmime/security/digest/sha1/sha1MessageDigest.hpp"
#include <cstring>
+#include <cassert>
namespace vmime {
@@ -161,8 +162,8 @@ void sha1MessageDigest::finalize()
i = j = 0;
std::memset(m_buffer, 0, 64);
- std::memset(m_state, 0, 20);
- std::memset(m_count, 0, 8);
+ std::memset(m_state, 0, 5 * sizeof(unsigned long));
+ std::memset(m_count, 0, 2 * sizeof(unsigned long));
std::memset(&finalcount, 0, 8);
}
@@ -201,6 +202,8 @@ void sha1MessageDigest::transform
unsigned long l[16];
} CHAR64LONG16;
+ assert(sizeof(unsigned long) == 4);
+
CHAR64LONG16* block;
static unsigned char workspace[64];