Bug 1561598 - Remove -Wmaybe-uninitialized warning in pqg.c r=marcusburghardt,jcj
authorGiulio Benetti <giulio.benetti@micronovasrl.com>
Fri, 26 Jul 2019 09:30:10 -0700
changeset 15240 caf5d97f786fc3dad2f9318b228007a233b5f0bd
parent 15239 d57bae1204fa4643d75ca20e3a5b518a4e21c6df
child 15241 009a7163c80a711bd681b155ecffa5962fd98a46
push id3452
push userjjones@mozilla.com
push dateFri, 26 Jul 2019 17:32:39 +0000
reviewersmarcusburghardt, jcj
bugs1561598
Bug 1561598 - Remove -Wmaybe-uninitialized warning in pqg.c r=marcusburghardt,jcj
lib/freebl/pqg.c
--- a/lib/freebl/pqg.c
+++ b/lib/freebl/pqg.c
@@ -885,17 +885,17 @@ findQfromSeed(
     const SECItem *seed,        /* input.  */
     mp_int *Q,                  /* input. */
     mp_int *Q_,                 /* output. */
     unsigned int *qseed_len,    /* output */
     HASH_HashType *hashtypePtr, /* output. Hash uses */
     pqgGenType *typePtr,        /* output. Generation Type used */
     unsigned int *qgen_counter) /* output. q_counter */
 {
-    HASH_HashType hashtype;
+    HASH_HashType hashtype = HASH_AlgNULL;
     SECItem firstseed = { 0, 0, 0 };
     SECItem qseed = { 0, 0, 0 };
     SECStatus rv;
 
     *qseed_len = 0; /* only set if FIPS186_3_ST_TYPE */
 
     /* handle legacy small DSA first can only be FIPS186_1_TYPE */
     if (L < 1024) {
@@ -1234,17 +1234,17 @@ pqg_ParamGen(unsigned int L, unsigned in
              unsigned int seedBytes, PQGParams **pParams, PQGVerify **pVfy)
 {
     unsigned int n;       /* Per FIPS 186, app 2.2. 186-3 app A.1.1.2 */
     unsigned int seedlen; /* Per FIPS 186-3 app A.1.1.2  (was 'g' 186-1)*/
     unsigned int counter; /* Per FIPS 186, app 2.2. 186-3 app A.1.1.2 */
     unsigned int offset;  /* Per FIPS 186, app 2.2. 186-3 app A.1.1.2 */
     unsigned int outlen;  /* Per FIPS 186-3, appendix A.1.1.2. */
     unsigned int maxCount;
-    HASH_HashType hashtype;
+    HASH_HashType hashtype = HASH_AlgNULL;
     SECItem *seed; /* Per FIPS 186, app 2.2. 186-3 app A.1.1.2 */
     PLArenaPool *arena = NULL;
     PQGParams *params = NULL;
     PQGVerify *verify = NULL;
     PRBool passed;
     SECItem hit = { 0, 0, 0 };
     SECItem firstseed = { 0, 0, 0 };
     SECItem qseed = { 0, 0, 0 };
@@ -1625,18 +1625,18 @@ PQG_VerifyParams(const PQGParams *params
     unsigned int g, n, L, N, offset, outlen;
     mp_int p0, P, Q, G, P_, Q_, G_, r, h;
     mp_err err = MP_OKAY;
     int j;
     unsigned int counter_max = 0; /* handle legacy L < 1024 */
     unsigned int qseed_len;
     unsigned int qgen_counter_ = 0;
     SECItem pseed_ = { 0, 0, 0 };
-    HASH_HashType hashtype;
-    pqgGenType type;
+    HASH_HashType hashtype = HASH_AlgNULL;
+    pqgGenType type = FIPS186_1_TYPE;
 
 #define CHECKPARAM(cond)      \
     if (!(cond)) {            \
         *result = SECFailure; \
         goto cleanup;         \
     }
     if (!params || !vfy || !result) {
         PORT_SetError(SEC_ERROR_INVALID_ARGS);