Bug 550869 RSA_PrivateKeyCheck doesn't MP_DIGITS = 0 all locals before using CHECK_MPI_OK mp_init SOFTOKEN_3_13_BRANCH
authornelson%bolyard.com
Mon, 15 Mar 2010 06:43:00 +0000
branchSOFTOKEN_3_13_BRANCH
changeset 9581 f4eca79c40ab8a55333fecd1dee2c66900317dba
parent 9579 9807db98b8ff32f201aee4050a3910b41b8bb0d5
child 9585 b586b8af68a2ae833b9eeac477c8d8c6376faeb5
push idunknown
push userunknown
push dateunknown
bugs550869
Bug 550869 RSA_PrivateKeyCheck doesn't MP_DIGITS = 0 all locals before using CHECK_MPI_OK mp_init Patch contributed by Timeless <timeless@mozdev.org>, r=nelson
security/nss/lib/freebl/rsa.c
--- a/security/nss/lib/freebl/rsa.c
+++ b/security/nss/lib/freebl/rsa.c
@@ -803,28 +803,30 @@ swap_in_key_value(PRArenaPool *arena, mp
 }
 
 SECStatus
 RSA_PrivateKeyCheck(RSAPrivateKey *key)
 {
     mp_int p, q, n, psub1, qsub1, e, d, d_p, d_q, qInv, res;
     mp_err   err = MP_OKAY;
     SECStatus rv = SECSuccess;
+    MP_DIGITS(&p)    = 0;
+    MP_DIGITS(&q)    = 0;
     MP_DIGITS(&n)    = 0;
     MP_DIGITS(&psub1)= 0;
     MP_DIGITS(&qsub1)= 0;
     MP_DIGITS(&e)    = 0;
     MP_DIGITS(&d)    = 0;
     MP_DIGITS(&d_p)  = 0;
     MP_DIGITS(&d_q)  = 0;
     MP_DIGITS(&qInv) = 0;
     MP_DIGITS(&res)  = 0;
-    CHECK_MPI_OK( mp_init(&n)    );
     CHECK_MPI_OK( mp_init(&p)    );
     CHECK_MPI_OK( mp_init(&q)    );
+    CHECK_MPI_OK( mp_init(&n)    );
     CHECK_MPI_OK( mp_init(&psub1));
     CHECK_MPI_OK( mp_init(&qsub1));
     CHECK_MPI_OK( mp_init(&e)    );
     CHECK_MPI_OK( mp_init(&d)    );
     CHECK_MPI_OK( mp_init(&d_p)  );
     CHECK_MPI_OK( mp_init(&d_q)  );
     CHECK_MPI_OK( mp_init(&qInv) );
     CHECK_MPI_OK( mp_init(&res)  );