Convert source and destination bytes into words length as
zynq_decrypt_load() expects it in terms of words instead
of bytes. This fixes the issue of zynqaes comamnd failure
while decrypting an encrypted image.
Note: roundup can work even without % 4 check before but expectation is
that src and dest is already aligned properly.
Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
goto usage;
}
- status = zynq_decrypt_load(srcaddr, srclen, dstaddr, dstlen, imgtype);
+ /*
+ * Roundup source and destination lengths to
+ * word size
+ */
+ if (srclen % 4)
+ srclen = roundup(srclen, 4);
+ if (dstlen % 4)
+ dstlen = roundup(dstlen, 4);
+
+ status = zynq_decrypt_load(srcaddr, srclen >> 2, dstaddr, dstlen >> 2,
+ imgtype);
if (status != 0)
return -1;