Thread (14 messages) 14 messages, 3 authors, 2021-11-02

Re: [PATCH 3/8] crypto: stm32/cryp - fix CTR counter carry

From: Nicolas Toromanoff <hidden>
Date: 2021-11-02 11:12:51
Also in: linux-crypto, lkml


On Sun, 31 Oct 2021, Ard Biesheuvel wrote:
On Fri, 29 Oct 2021 at 16:01, Nicolas Toromanoff
[off-list ref] wrote:
quoted
[...]
@@ -1219,25 +1219,26 @@ static void stm32_cryp_check_ctr_counter(struct stm32_cryp *cryp)

        if (unlikely(cryp->last_ctr[3] == 0xFFFFFFFF)) {
                cryp->last_ctr[3] = 0;
-               cryp->last_ctr[2]++;
+               cryp->last_ctr[2] = cpu_to_be32(be32_to_cpu(cryp->last_ctr[2]) + 1);
                if (!cryp->last_ctr[2]) {
-                       cryp->last_ctr[1]++;
+                       cryp->last_ctr[1] = cpu_to_be32(be32_to_cpu(cryp->last_ctr[1]) + 1);
                        if (!cryp->last_ctr[1])
-                               cryp->last_ctr[0]++;
+                               cryp->last_ctr[0] = cpu_to_be32(be32_to_cpu(cryp->last_ctr[0]) + 1);
                }
crypto_inc() ??
Good point, I didn't know/find this function.

Thanks,
Nicolas.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help