Embedded systems coursework 2.
Fork of Crypto_light by
Diff: hash/MD5.cpp
- Revision:
- 13:ac8e23b98dae
- Parent:
- 10:bc9c23aa3870
diff -r cb30c135cd5f -r ac8e23b98dae hash/MD5.cpp --- a/hash/MD5.cpp Tue Apr 08 19:39:25 2014 +0000 +++ b/hash/MD5.cpp Sun May 11 11:14:51 2014 +0000 @@ -52,7 +52,7 @@ void MD5::update(uint8_t *data, uint32_t length) { - if(length < 64-bufferLength) + if((int)length < 64-bufferLength) { memcpy(&buffer[bufferLength], data, length); bufferLength += length; @@ -68,7 +68,7 @@ computeRounds(&a, &b, &c, &d, buffer); offset += 64; } - if(offset > length) + if(offset > (int)length) offset -= 64; bufferLength = length - offset; memcpy(buffer, &data[offset], bufferLength); @@ -157,7 +157,12 @@ hash2[3] = d; } -__forceinline void MD5::computeRounds(uint32_t *a2, uint32_t *b2, uint32_t *c2, uint32_t *d2, uint8_t *buffer) + + +#ifdef __CC_ARM +__forceinline +#endif +void MD5::computeRounds(uint32_t *a2, uint32_t *b2, uint32_t *c2, uint32_t *d2, uint8_t *buffer) { uint32_t a = *a2, b = *b2, c = *c2, d = *d2; uint32_t tmpA = a, tmpB = b, tmpC = c, tmpD = d; @@ -195,4 +200,4 @@ *b2 = b + tmpB; *c2 = c + tmpC; *d2 = d + tmpD; -} +} \ No newline at end of file