|
|
@ -73,23 +73,23 @@ using niklasrosenstein::md5; |
|
|
|
* |
|
|
|
* Unfortunately, this optimization may be a C strict aliasing rules violation |
|
|
|
* if the caller's data buffer has effective type that cannot be aliased by |
|
|
|
* md5_uint32. In practice, this problem may occur if these MD5 routines are |
|
|
|
* uint32_t. In practice, this problem may occur if these MD5 routines are |
|
|
|
* inlined into a calling function, or with future and dangerously advanced |
|
|
|
* link-time optimizations. For the time being, keeping these MD5 routines in |
|
|
|
* their own translation unit avoids the problem. |
|
|
|
*/ |
|
|
|
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
|
|
|
|
#define SET(n) \
|
|
|
|
(*(md5_uint32 *)&ptr[(n) * 4]) |
|
|
|
(*(uint32_t *)&ptr[(n) * 4]) |
|
|
|
#define GET(n) \
|
|
|
|
SET(n) |
|
|
|
#else
|
|
|
|
#define SET(n) \
|
|
|
|
(this->block[(n)] = \ |
|
|
|
(md5_uint32)ptr[(n) * 4] | \ |
|
|
|
((md5_uint32)ptr[(n) * 4 + 1] << 8) | \ |
|
|
|
((md5_uint32)ptr[(n) * 4 + 2] << 16) | \ |
|
|
|
((md5_uint32)ptr[(n) * 4 + 3] << 24)) |
|
|
|
(uint32_t)ptr[(n) * 4] | \ |
|
|
|
((uint32_t)ptr[(n) * 4 + 1] << 8) | \ |
|
|
|
((uint32_t)ptr[(n) * 4 + 2] << 16) | \ |
|
|
|
((uint32_t)ptr[(n) * 4 + 3] << 24)) |
|
|
|
#define GET(n) \
|
|
|
|
(this->block[(n)]) |
|
|
|
#endif
|
|
|
@ -101,8 +101,8 @@ using niklasrosenstein::md5; |
|
|
|
void const* md5::body(const void *data, size_t size) |
|
|
|
{ |
|
|
|
unsigned char const* ptr; |
|
|
|
md5_uint32 a, b, c, d; |
|
|
|
md5_uint32 saved_a, saved_b, saved_c, saved_d; |
|
|
|
uint32_t a, b, c, d; |
|
|
|
uint32_t saved_a, saved_b, saved_c, saved_d; |
|
|
|
|
|
|
|
ptr = reinterpret_cast<unsigned char const*>(data); |
|
|
|
|
|
|
@ -218,7 +218,7 @@ md5::md5() |
|
|
|
|
|
|
|
void md5::update(const void *data, size_t size) |
|
|
|
{ |
|
|
|
md5_uint32 saved_lo; |
|
|
|
uint32_t saved_lo; |
|
|
|
unsigned long used, available; |
|
|
|
|
|
|
|
saved_lo = this->lo; |
|
|
|