Bug 1566124 - Fix counter increase in ppc-gcm-wrap.c r=bbeurdouche
authormamonet <maamoun.tk@gmail.com>
Fri, 04 Jun 2021 09:36:15 +0000
changeset 15937 91ce0df5a56952c35714c9790c7b19190a18d658
parent 15936 66b9da6f53d50417d75eb076c2d97fcfb2ee4029
child 15938 9891dbb983526c2e0a9b3983db926f4da740f675
push id3973
push userbbeurdouche@mozilla.com
push dateFri, 04 Jun 2021 09:38:24 +0000
reviewersbbeurdouche
bugs1566124
Bug 1566124 - Fix counter increase in ppc-gcm-wrap.c r=bbeurdouche Differential Revision: https://phabricator.services.mozilla.com/D116297
lib/freebl/ppc-gcm-wrap.c
--- a/lib/freebl/ppc-gcm-wrap.c
+++ b/lib/freebl/ppc-gcm-wrap.c
@@ -150,17 +150,17 @@ ppc_aes_gcmInitCounter(ppc_AES_GCMContex
                         AES_BLOCK_SIZE, AES_BLOCK_SIZE);
     if (rv != SECSuccess) {
         return SECFailure;
     }
 
     /* Promote the counter by 1 */
     gcm->CTR[14] += !(++gcm->CTR[15]);
     gcm->CTR[13] += !(gcm->CTR[15]) && !(gcm->CTR[14]);
-    gcm->CTR[12] += !(gcm->CTR[15]) && !(gcm->CTR[13]) && !(gcm->CTR[12]);
+    gcm->CTR[12] += !(gcm->CTR[15]) && !(gcm->CTR[14]) && !(gcm->CTR[13]);
 
     /* Now hash AAD - it would actually make sense to seperate the context
      * creation from the AAD, because that would allow to reuse the H, which
      * only changes when the AES key changes, and not every package, like the
      * IV and AAD */
     ppc_aes_gcmHASH(gcm->Htbl, aad, aadLen, gcm->T);
     gcm->Alen += aadLen;
     return SECSuccess;