On Tue, 3 Jul 2012, Samuel Pitoiset wrote:

+void av_xtea_crypt(AVXTEA *x, uint8_t *dst, const uint8_t *src, int count,
+                   uint8_t *iv, int decrypt)
+{
+    int i;
+
+    while (count > 0) {
+        if (decrypt) {
+            xtea_crypt_ecb(x, dst, src, decrypt);
+
+            if (iv) {
+                for (i = 0; i < 8; i++)
+                    dst[i] = dst[i] ^ iv[i];
+                memcpy(iv, src, 8);
+            }
+        } else {
+            if (iv) {
+                for (i = 0; i < 8; i++)
+                    dst[i] = src[i] ^ iv[i];
+                xtea_crypt_ecb(x, dst, dst, decrypt);
+            } else {
+                xtea_crypt_ecb(x, dst, src, decrypt);
+            }
+
+            if (iv)
+                memcpy(iv, dst, 8);
+        }

Since the crypt_ecb call is within the if, you can just as well move the memcpy there too.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to