Bug 1227096 - assert if outlen is greater than 0. r=kaie
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 21 May 2019 17:16:13 +0000
changeset 15127 ec6843bc0ce7a4d30150ef65e137c3a1654198a0
parent 15126 0556b3040451e8a7ca0a499005993a95921754d4
child 15128 370a9e85f216f5f4ff277995a997c5c9b23a819f
push id3366
push userjjones@mozilla.com
push dateTue, 21 May 2019 19:20:58 +0000
reviewerskaie
bugs1227096
Bug 1227096 - assert if outlen is greater than 0. r=kaie Differential Revision: https://phabricator.services.mozilla.com/D31757
lib/freebl/pqg.c
--- a/lib/freebl/pqg.c
+++ b/lib/freebl/pqg.c
@@ -1765,16 +1765,17 @@ PQG_VerifyParams(const PQGParams *params
     } else if (vfy->counter == -1) {
         /* If counter is set to -1, we are really only verifying G, skip
          * the remainder of the checks for P */
         CHECKPARAM(type != FIPS186_1_TYPE); /* we only do this for DSA2 */
     } else {
         /* 10. P generated from (L, counter, g, SEED, Q) matches P
          * in PQGParams. */
         outlen = HASH_ResultLen(hashtype) * PR_BITS_PER_BYTE;
+        PORT_Assert(outlen > 0);
         n = (L - 1) / outlen;
         offset = vfy->counter * (n + 1) + ((type == FIPS186_1_TYPE) ? 2 : 1);
         CHECK_SEC_OK(makePfromQandSeed(hashtype, L, N, offset, g, &vfy->seed,
                                        &Q, &P_));
         CHECKPARAM(mp_cmp(&P, &P_) == 0);
     }
 
     /* now check G, skip if don't have a g */