Fix an erroneous assertion. Clean up some other code. Bug 244929.

r= jpierre, wtc.
This commit is contained in:
nelsonb%netscape.com 2004-06-03 03:41:07 +00:00
Родитель 652c409f6e
Коммит 45fbe7addd
3 изменённых файлов: 8 добавлений и 14 удалений

Просмотреть файл

@ -197,7 +197,7 @@ CMMF_KeyRecRepContentSetCertifiedKeyPair(CMMFKeyRecRepContent *inKeyRecRep,
} }
dummy = crmf_create_encrypted_value_wrapped_privkey(inPrivKey, inPubKey, dummy = crmf_create_encrypted_value_wrapped_privkey(inPrivKey, inPubKey,
keyPair->privateKey); keyPair->privateKey);
PORT_Assert(dummy = keyPair->privateKey); PORT_Assert(dummy == keyPair->privateKey);
if (dummy != keyPair->privateKey) { if (dummy != keyPair->privateKey) {
crmf_destroy_encrypted_value(dummy, PR_TRUE); crmf_destroy_encrypted_value(dummy, PR_TRUE);
goto loser; goto loser;

Просмотреть файл

@ -770,6 +770,7 @@ crmf_create_encrypted_value_wrapped_privkey(SECKEYPrivateKey *inPrivKey,
if (pubMechType == CKM_INVALID_MECHANISM) { if (pubMechType == CKM_INVALID_MECHANISM) {
/* XXX I should probably do something here for non-RSA /* XXX I should probably do something here for non-RSA
* keys that are in certs. (ie DSA) * keys that are in certs. (ie DSA)
* XXX or at least SET AN ERROR CODE.
*/ */
goto loser; goto loser;
} }
@ -832,20 +833,14 @@ crmf_create_encrypted_value_wrapped_privkey(SECKEYPrivateKey *inPrivKey,
if (rv != SECSuccess) { if (rv != SECSuccess) {
goto loser; goto loser;
} }
PORT_Free(encodedParam.data); SECITEM_FreeItem(&encodedParam, PR_FALSE);
PORT_Free(wrappedPrivKeyBits); PORT_Free(wrappedPrivKeyBits);
PORT_Free(wrappedSymKeyBits); PORT_Free(wrappedSymKeyBits);
if (iv->data != NULL) { SECITEM_FreeItem(iv, PR_TRUE);
PORT_Free(iv->data);
}
PORT_Free(iv);
return destValue; return destValue;
loser: loser:
if (iv != NULL) { if (iv != NULL) {
if (iv->data) { SECITEM_FreeItem(iv, PR_TRUE);
PORT_Free(iv->data);
}
PORT_Free(iv);
} }
if (myEncrValue != NULL) { if (myEncrValue != NULL) {
crmf_destroy_encrypted_value(myEncrValue, PR_TRUE); crmf_destroy_encrypted_value(myEncrValue, PR_TRUE);
@ -857,7 +852,7 @@ crmf_create_encrypted_value_wrapped_privkey(SECKEYPrivateKey *inPrivKey,
PORT_Free(wrappedPrivKeyBits); PORT_Free(wrappedPrivKeyBits);
} }
if (encodedParam.data != NULL) { if (encodedParam.data != NULL) {
PORT_Free(encodedParam.data); SECITEM_FreeItem(&encodedParam, PR_FALSE);
} }
return NULL; return NULL;
} }

Просмотреть файл

@ -152,9 +152,8 @@ CMMF_CertResponseGetCertificate(CMMFCertResponse *inCertResp,
return NULL; return NULL;
} }
return cmmf_CertOrEncCertGetCertificate return cmmf_CertOrEncCertGetCertificate(
(&inCertResp->certifiedKeyPair->certOrEncCert, &inCertResp->certifiedKeyPair->certOrEncCert, inCertdb);
inCertdb);
} }