Ensure 'unsigned long' is 4 bytes long (Georg Sauthoff).

This commit is contained in:
Vincent Richard 2009-07-11 12:21:59 +00:00
parent 3442caf607
commit a67f0a537e

View File

@ -27,6 +27,7 @@
#include "vmime/security/digest/sha1/sha1MessageDigest.hpp" #include "vmime/security/digest/sha1/sha1MessageDigest.hpp"
#include <cstring> #include <cstring>
#include <cassert>
namespace vmime { namespace vmime {
@ -161,8 +162,8 @@ void sha1MessageDigest::finalize()
i = j = 0; i = j = 0;
std::memset(m_buffer, 0, 64); std::memset(m_buffer, 0, 64);
std::memset(m_state, 0, 20); std::memset(m_state, 0, 5 * sizeof(unsigned long));
std::memset(m_count, 0, 8); std::memset(m_count, 0, 2 * sizeof(unsigned long));
std::memset(&finalcount, 0, 8); std::memset(&finalcount, 0, 8);
} }
@ -201,6 +202,8 @@ void sha1MessageDigest::transform
unsigned long l[16]; unsigned long l[16];
} CHAR64LONG16; } CHAR64LONG16;
assert(sizeof(unsigned long) == 4);
CHAR64LONG16* block; CHAR64LONG16* block;
static unsigned char workspace[64]; static unsigned char workspace[64];