summaryrefslogtreecommitdiff
path: root/libavutil/sha.c
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2011-07-04 11:57:46 +0200
committerMans Rullgard <mans@mansr.com>2011-07-04 11:16:52 +0100
commit3e2aa268f652be8828b6351f54d41914c1ec3dae (patch)
tree3b490c03ded82129de8b3b2d5b43a5aac63e4eaa /libavutil/sha.c
parent9e52a40695609259d1f2fe1d9381ea45f9824272 (diff)
downloadffmpeg-3e2aa268f652be8828b6351f54d41914c1ec3dae.tar.gz
sha: use AV_RB32() instead of assuming buffer can be cast to uint32_t*
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavutil/sha.c')
-rw-r--r--libavutil/sha.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavutil/sha.c b/libavutil/sha.c
index ae6069dd34..5af742dc48 100644
--- a/libavutil/sha.c
+++ b/libavutil/sha.c
@@ -42,7 +42,7 @@ const int av_sha_size = sizeof(AVSHA);
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define blk0(i) (block[i] = av_be2ne32(((const uint32_t*)buffer)[i]))
+#define blk0(i) (block[i] = AV_RB32(buffer + 4 * (i)))
#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1))
#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30);
@@ -67,7 +67,7 @@ static void sha1_transform(uint32_t state[5], const uint8_t buffer[64])
for (i = 0; i < 80; i++) {
int t;
if (i < 16)
- t = av_be2ne32(((uint32_t*)buffer)[i]);
+ t = AV_RB32(buffer + 4 * i);
else
t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1);
block[i] = t;