Bug 1061021, Part 6: Stop using PLArenaPool for boolean encoding, r=keeler

--HG--
extra : rebase_source : 557eef72848af7dd70eddb4983de25e2e50da5f3
This commit is contained in:
Brian Smith 2014-08-30 17:00:16 -07:00
Родитель 3c92292236
Коммит 653ade1f65
1 изменённых файлов: 11 добавлений и 14 удалений

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

@ -294,18 +294,12 @@ BitString(const ByteString& rawBytes, bool corrupt)
return TLV(der::BIT_STRING, prefixed);
}
static SECItem*
Boolean(PLArenaPool* arena, bool value)
static ByteString
Boolean(bool value)
{
assert(arena);
SECItem* result(SECITEM_AllocItem(arena, nullptr, 3));
if (!result) {
return nullptr;
}
result->data[0] = der::BOOLEAN;
result->data[1] = 1; // length
result->data[2] = value ? 0xff : 0x00;
return result;
ByteString encodedValue;
encodedValue.push_back(value ? 0xff : 0x00);
return TLV(der::BOOLEAN, encodedValue);
}
static ByteString
@ -570,10 +564,11 @@ Extension(PLArenaPool* arena, Input extnID,
}
if (criticality == ExtensionCriticality::Critical) {
SECItem* critical(Boolean(arena, true));
if (output.Add(critical) != Success) {
ByteString critical(Boolean(true));
if (critical == ENCODING_FAILED) {
return nullptr;
}
output.Add(critical);
}
SECItem* extnValueBytes(value.Squash(arena, der::SEQUENCE));
@ -919,9 +914,11 @@ CreateEncodedBasicConstraints(PLArenaPool* arena, bool isCA,
Output value;
if (isCA) {
if (value.Add(Boolean(arena, true)) != Success) {
ByteString cA(Boolean(true));
if (cA == ENCODING_FAILED) {
return nullptr;
}
value.Add(cA);
}
if (pathLenConstraintValue) {