зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1061021, Part 9: Stop using PLArenaPool for SingleResponse encoding, r=keeler
--HG-- extra : rebase_source : a39a5dfec9b7aaa43ee2cffc15021bb404ada1ca
This commit is contained in:
Родитель
a67503eadb
Коммит
d1e3997695
|
@ -252,7 +252,7 @@ static ByteString BasicOCSPResponse(OCSPResponseContext& context);
|
||||||
static SECItem* ResponseData(OCSPResponseContext& context);
|
static SECItem* ResponseData(OCSPResponseContext& context);
|
||||||
static ByteString ResponderID(OCSPResponseContext& context);
|
static ByteString ResponderID(OCSPResponseContext& context);
|
||||||
static ByteString KeyHash(OCSPResponseContext& context);
|
static ByteString KeyHash(OCSPResponseContext& context);
|
||||||
static SECItem* SingleResponse(OCSPResponseContext& context);
|
static ByteString SingleResponse(OCSPResponseContext& context);
|
||||||
static ByteString CertID(OCSPResponseContext& context);
|
static ByteString CertID(OCSPResponseContext& context);
|
||||||
static ByteString CertStatus(OCSPResponseContext& context);
|
static ByteString CertStatus(OCSPResponseContext& context);
|
||||||
|
|
||||||
|
@ -1135,13 +1135,12 @@ ResponseData(OCSPResponseContext& context)
|
||||||
if (producedAtEncoded == ENCODING_FAILED) {
|
if (producedAtEncoded == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
SECItem* responses = SingleResponse(context);
|
ByteString response(SingleResponse(context));
|
||||||
if (!responses) {
|
if (response == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
SECItem* responsesNested = EncodeNested(context.arena, der::SEQUENCE,
|
ByteString responses(TLV(der::SEQUENCE, response));
|
||||||
responses);
|
if (responses == ENCODING_FAILED) {
|
||||||
if (!responsesNested) {
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
SECItem* responseExtensions = nullptr;
|
SECItem* responseExtensions = nullptr;
|
||||||
|
@ -1152,9 +1151,7 @@ ResponseData(OCSPResponseContext& context)
|
||||||
Output output;
|
Output output;
|
||||||
output.Add(responderID);
|
output.Add(responderID);
|
||||||
output.Add(producedAtEncoded);
|
output.Add(producedAtEncoded);
|
||||||
if (output.Add(responsesNested) != Success) {
|
output.Add(responses);
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if (responseExtensions) {
|
if (responseExtensions) {
|
||||||
if (output.Add(responseExtensions) != Success) {
|
if (output.Add(responseExtensions) != Success) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -1214,42 +1211,40 @@ KeyHash(OCSPResponseContext& context)
|
||||||
// thisUpdate GeneralizedTime,
|
// thisUpdate GeneralizedTime,
|
||||||
// nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
|
// nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
|
||||||
// singleExtensions [1] EXPLICIT Extensions OPTIONAL }
|
// singleExtensions [1] EXPLICIT Extensions OPTIONAL }
|
||||||
SECItem*
|
ByteString
|
||||||
SingleResponse(OCSPResponseContext& context)
|
SingleResponse(OCSPResponseContext& context)
|
||||||
{
|
{
|
||||||
ByteString certID(CertID(context));
|
ByteString certID(CertID(context));
|
||||||
if (certID == ENCODING_FAILED) {
|
if (certID == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return ENCODING_FAILED;
|
||||||
}
|
}
|
||||||
ByteString certStatus(CertStatus(context));
|
ByteString certStatus(CertStatus(context));
|
||||||
if (certStatus == ENCODING_FAILED) {
|
if (certStatus == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return ENCODING_FAILED;
|
||||||
}
|
}
|
||||||
ByteString thisUpdateEncoded(TimeToGeneralizedTime(context.thisUpdate));
|
ByteString thisUpdateEncoded(TimeToGeneralizedTime(context.thisUpdate));
|
||||||
if (thisUpdateEncoded == ENCODING_FAILED) {
|
if (thisUpdateEncoded == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return ENCODING_FAILED;
|
||||||
}
|
}
|
||||||
ByteString nextUpdateEncodedNested;
|
ByteString nextUpdateEncodedNested;
|
||||||
if (context.includeNextUpdate) {
|
if (context.includeNextUpdate) {
|
||||||
ByteString nextUpdateEncoded(TimeToGeneralizedTime(context.nextUpdate));
|
ByteString nextUpdateEncoded(TimeToGeneralizedTime(context.nextUpdate));
|
||||||
if (nextUpdateEncoded == ENCODING_FAILED) {
|
if (nextUpdateEncoded == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return ENCODING_FAILED;
|
||||||
}
|
}
|
||||||
nextUpdateEncodedNested = TLV(der::CONSTRUCTED | der::CONTEXT_SPECIFIC | 0,
|
nextUpdateEncodedNested = TLV(der::CONSTRUCTED | der::CONTEXT_SPECIFIC | 0,
|
||||||
nextUpdateEncoded);
|
nextUpdateEncoded);
|
||||||
if (nextUpdateEncodedNested == ENCODING_FAILED) {
|
if (nextUpdateEncodedNested == ENCODING_FAILED) {
|
||||||
return nullptr;
|
return ENCODING_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Output output;
|
ByteString value;
|
||||||
output.Add(certID);
|
value.append(certID);
|
||||||
output.Add(certStatus);
|
value.append(certStatus);
|
||||||
output.Add(thisUpdateEncoded);
|
value.append(thisUpdateEncoded);
|
||||||
if (!nextUpdateEncodedNested.empty()) {
|
value.append(nextUpdateEncodedNested);
|
||||||
output.Add(nextUpdateEncodedNested);
|
return TLV(der::SEQUENCE, value);
|
||||||
}
|
|
||||||
return output.Squash(context.arena, der::SEQUENCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CertID ::= SEQUENCE {
|
// CertID ::= SEQUENCE {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче