mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset ace6aa02d442 (bug 1034856)
This commit is contained in:
parent
9ed2e3727d
commit
9dfd70643f
@ -501,15 +501,16 @@ CryptoKey::PublicKeyToSpki(SECKEYPublicKey* aPubKey,
|
|||||||
CryptoBuffer& aRetVal,
|
CryptoBuffer& aRetVal,
|
||||||
const nsNSSShutDownPreventionLock& /*proofOfLock*/)
|
const nsNSSShutDownPreventionLock& /*proofOfLock*/)
|
||||||
{
|
{
|
||||||
|
ScopedPLArenaPool arena;
|
||||||
ScopedCERTSubjectPublicKeyInfo spki;
|
ScopedCERTSubjectPublicKeyInfo spki;
|
||||||
|
|
||||||
ScopedPLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
|
|
||||||
if (!arena) {
|
|
||||||
return NS_ERROR_DOM_OPERATION_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// NSS doesn't support exporting DH public keys.
|
// NSS doesn't support exporting DH public keys.
|
||||||
if (aPubKey->keyType == dhKey) {
|
if (aPubKey->keyType == dhKey) {
|
||||||
|
arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
|
||||||
|
if (!arena) {
|
||||||
|
return NS_ERROR_DOM_OPERATION_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
// It's alright to assign the result of PORT_ArenaZNew(ScopedPLArenaPool)
|
// It's alright to assign the result of PORT_ArenaZNew(ScopedPLArenaPool)
|
||||||
// to a ScopedCERTSubjectPublicKeyInfo as long as we don't set |spki->arena|
|
// to a ScopedCERTSubjectPublicKeyInfo as long as we don't set |spki->arena|
|
||||||
// as that's what would be freed when |spki| goes out of scope.
|
// as that's what would be freed when |spki| goes out of scope.
|
||||||
@ -541,16 +542,17 @@ CryptoKey::PublicKeyToSpki(SECKEYPublicKey* aPubKey,
|
|||||||
MOZ_ASSERT(false);
|
MOZ_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECStatus rv = SECITEM_CopyItem(arena, &spki->algorithm.algorithm, oidData);
|
SECStatus rv = SECITEM_CopyItem(spki->arena, &spki->algorithm.algorithm,
|
||||||
|
oidData);
|
||||||
if (rv != SECSuccess) {
|
if (rv != SECSuccess) {
|
||||||
return NS_ERROR_DOM_OPERATION_ERR;
|
return NS_ERROR_DOM_OPERATION_ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const SEC_ASN1Template* tpl = SEC_ASN1_GET(CERT_SubjectPublicKeyInfoTemplate);
|
const SEC_ASN1Template* tpl = SEC_ASN1_GET(CERT_SubjectPublicKeyInfoTemplate);
|
||||||
SECItem* spkiItem(SEC_ASN1EncodeItem(arena, nullptr, spki, tpl));
|
ScopedSECItem spkiItem(SEC_ASN1EncodeItem(nullptr, nullptr, spki, tpl));
|
||||||
|
|
||||||
aRetVal.Assign(spkiItem);
|
aRetVal.Assign(spkiItem.get());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user