ltq-deu: fix aes initialization vector handling
authorMartin Schiller <mschiller@tdt.de>
Thu, 18 Aug 2016 10:03:15 +0000 (12:03 +0200)
committerJohn Crispin <john@phrozen.org>
Sat, 20 Aug 2016 03:32:44 +0000 (05:32 +0200)
This fix is a backport from the lantiq UGW-6.1.1-MR1

Signed-off-by: Martin Schiller <mschiller@tdt.de>
package/kernel/lantiq/ltq-deu/src/ifxmips_aes.c

index bf7753794098e9d8a8a3932f4f5ace6e4c82f373..fe888b852e6ac3b1ac17e5690a292b695e242c17 100644 (file)
@@ -252,10 +252,10 @@ void ifx_deu_aes (void *ctx_arg, u8 *out_arg, const u8 *in_arg,
 
     //tc.chen : copy iv_arg back
     if (mode > 0) {
-        *((u32 *) iv_arg) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg));
-        *((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 1));             
-        *((u32 *) iv_arg + 2) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 2));             
-        *((u32 *) iv_arg + 3) = DEU_ENDIAN_SWAP(*((u32 *) iv_arg + 3));              
+        *((u32 *) iv_arg) = DEU_ENDIAN_SWAP(aes->IV3R);
+        *((u32 *) iv_arg + 1) = DEU_ENDIAN_SWAP(aes->IV2R);
+        *((u32 *) iv_arg + 2) = DEU_ENDIAN_SWAP(aes->IV1R);
+        *((u32 *) iv_arg + 3) = DEU_ENDIAN_SWAP(aes->IV0R);
     }
 
     CRTCL_SECT_END;