Calculate chain length, certificate length and signature length, only open file once in benchmark

This commit is contained in:
Jeroen Bobbeldijk
2017-09-30 15:44:50 +02:00
parent 07ae3c8eaa
commit bb93a21027
3 changed files with 75 additions and 25 deletions

View File

@@ -118,10 +118,10 @@ func (context *SignContext) fetchRevocationData() error {
// Calculate space needed for signature.
for _, crl := range context.SignData.RevocationData.CRL {
context.SignatureMaxLength += uint32(len(crl.FullBytes) * 2)
context.SignatureMaxLength += uint32(hex.EncodedLen(len(crl.FullBytes)))
}
for _, ocsp := range context.SignData.RevocationData.OCSP {
context.SignatureMaxLength += uint32(len(ocsp.FullBytes) * 2)
context.SignatureMaxLength += uint32(hex.EncodedLen(len(ocsp.FullBytes)))
}
return nil