[FFmpeg-cvslog] des: allow unaligned input and output buffers

Mans Rullgard git at videolan.org
Tue Jul 5 02:52:26 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sun Jul  3 19:14:01 2011 +0100| [9e52a40695609259d1f2fe1d9381ea45f9824272] | committer: Mans Rullgard

des: allow unaligned input and output buffers

Signed-off-by: Mans Rullgard <mans at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e52a40695609259d1f2fe1d9381ea45f9824272
---

 libavutil/des.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavutil/des.c b/libavutil/des.c
index 5de8163..db2227b 100644
--- a/libavutil/des.c
+++ b/libavutil/des.c
@@ -299,10 +299,10 @@ int av_des_init(AVDES *d, const uint8_t *key, int key_bits, int decrypt) {
 }
 
 void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) {
-    uint64_t iv_val = iv ? av_be2ne64(*(uint64_t *)iv) : 0;
+    uint64_t iv_val = iv ? AV_RB64(iv) : 0;
     while (count-- > 0) {
         uint64_t dst_val;
-        uint64_t src_val = src ? av_be2ne64(*(const uint64_t *)src) : 0;
+        uint64_t src_val = src ? AV_RB64(src) : 0;
         if (decrypt) {
             uint64_t tmp = src_val;
             if (d->triple_des) {
@@ -319,12 +319,12 @@ void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t
             }
             iv_val = iv ? dst_val : 0;
         }
-        *(uint64_t *)dst = av_be2ne64(dst_val);
+        AV_WB64(dst, dst_val);
         src += 8;
         dst += 8;
     }
     if (iv)
-        *(uint64_t *)iv = av_be2ne64(iv_val);
+        AV_WB64(iv, iv_val);
 }
 
 #ifdef TEST



More information about the ffmpeg-cvslog mailing list