diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-11 11:45:35 +0000 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2010-02-11 11:45:35 +0000 |
commit | 045b60bf9b1a28faae0ceab053986662e20d3d59 (patch) | |
tree | 9c57899397ca1677f02aea560d3d3d0d9e779ac0 /libavutil | |
parent | 94dde5c1ec4c3d70e544282d44cd0f9be274408f (diff) | |
download | ffmpeg-045b60bf9b1a28faae0ceab053986662e20d3d59.tar.gz |
Make SHA digest function write digest value with AV_WN32 instead of assuming
that output may be written as uint32_t since output buffer may not be aligned
(and it's silly to force alignment on it) and it does not work in that case
properly on some architectures.
Originally committed as revision 21754 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/sha.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavutil/sha.c b/libavutil/sha.c index 3107deeffe..38221a7164 100644 --- a/libavutil/sha.c +++ b/libavutil/sha.c @@ -25,6 +25,7 @@ #include "avutil.h" #include "bswap.h" #include "sha.h" +#include "intreadwrite.h" /** hash context */ typedef struct AVSHA { @@ -319,7 +320,7 @@ void av_sha_final(AVSHA* ctx, uint8_t *digest) av_sha_update(ctx, "", 1); av_sha_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */ for (i = 0; i < ctx->digest_len; i++) - ((uint32_t*)digest)[i] = be2me_32(ctx->state[i]); + AV_WN32(digest + i*4, be2me_32(ctx->state[i])); } #if LIBAVUTIL_VERSION_MAJOR < 51 |