Index: net/cert/ct_serialization.cc |
diff --git a/net/cert/ct_serialization.cc b/net/cert/ct_serialization.cc |
index 3de512c81813386fa14cdc38ab315aa4899f56ec..2d0562cdf7ddd750d6990d584784f64f03e6fa2c 100644 |
--- a/net/cert/ct_serialization.cc |
+++ b/net/cert/ct_serialization.cc |
@@ -153,9 +153,8 @@ bool ConvertHashAlgorithm(unsigned in, DigitallySigned::HashAlgorithm* out) { |
// |in| is the numeric representation of the algorithm. |
// If the signing algorithm value is in a set of known values, fills in |out| |
// and returns true. Otherwise, returns false. |
-bool ConvertSignatureAlgorithm( |
- unsigned in, |
- DigitallySigned::SignatureAlgorithm* out) { |
+bool ConvertSignatureAlgorithm(unsigned in, |
+ DigitallySigned::SignatureAlgorithm* out) { |
switch (in) { |
case DigitallySigned::SIG_ALGO_ANONYMOUS: |
case DigitallySigned::SIG_ALGO_RSA: |
@@ -178,7 +177,7 @@ void WriteUint(size_t length, T value, std::string* output) { |
DCHECK(length == sizeof(T) || value >> (length * 8) == 0); |
for (; length > 0; --length) { |
- output->push_back((value >> ((length - 1)* 8)) & 0xFF); |
+ output->push_back((value >> ((length - 1) * 8)) & 0xFF); |
} |
} |
@@ -218,8 +217,8 @@ bool WriteVariableBytes(size_t prefix_length, |
// Returns true if the leaf_certificate in the LogEntry does not exceed |
// kMaxAsn1CertificateLength and so can be written to |output|. |
bool EncodeAsn1CertLogEntry(const LogEntry& input, std::string* output) { |
- return WriteVariableBytes(kAsn1CertificateLengthBytes, |
- input.leaf_certificate, output); |
+ return WriteVariableBytes( |
+ kAsn1CertificateLengthBytes, input.leaf_certificate, output); |
} |
// Writes a LogEntry of type PreCertificate to |output|. |
@@ -227,28 +226,24 @@ bool EncodeAsn1CertLogEntry(const LogEntry& input, std::string* output) { |
// Returns true if the TBSCertificate component in the LogEntry does not |
// exceed kMaxTbsCertificateLength and so can be written to |output|. |
bool EncodePrecertLogEntry(const LogEntry& input, std::string* output) { |
- WriteEncodedBytes( |
- base::StringPiece( |
- reinterpret_cast<const char*>(input.issuer_key_hash.data), |
- kLogIdLength), |
- output); |
- return WriteVariableBytes(kTbsCertificateLengthBytes, |
- input.tbs_certificate, output); |
+ WriteEncodedBytes(base::StringPiece(reinterpret_cast<const char*>( |
+ input.issuer_key_hash.data), |
+ kLogIdLength), |
+ output); |
+ return WriteVariableBytes( |
+ kTbsCertificateLengthBytes, input.tbs_certificate, output); |
} |
} // namespace |
-bool EncodeDigitallySigned(const DigitallySigned& input, |
- std::string* output) { |
+bool EncodeDigitallySigned(const DigitallySigned& input, std::string* output) { |
WriteUint(kHashAlgorithmLength, input.hash_algorithm, output); |
- WriteUint(kSigAlgorithmLength, input.signature_algorithm, |
- output); |
- return WriteVariableBytes(kSignatureLengthBytes, input.signature_data, |
- output); |
+ WriteUint(kSigAlgorithmLength, input.signature_algorithm, output); |
+ return WriteVariableBytes( |
+ kSignatureLengthBytes, input.signature_data, output); |
} |
-bool DecodeDigitallySigned(base::StringPiece* input, |
- DigitallySigned* output) { |
+bool DecodeDigitallySigned(base::StringPiece* input, DigitallySigned* output) { |
unsigned hash_algo; |
unsigned sig_algo; |
base::StringPiece sig_data; |
@@ -289,13 +284,10 @@ bool EncodeV1SCTSignedData(const base::Time& timestamp, |
const std::string& serialized_log_entry, |
const std::string& extensions, |
std::string* output) { |
- WriteUint(kVersionLength, SignedCertificateTimestamp::SCT_VERSION_1, |
- output); |
- WriteUint(kSignatureTypeLength, SIGNATURE_TYPE_CERTIFICATE_TIMESTAMP, |
- output); |
+ WriteUint(kVersionLength, SignedCertificateTimestamp::SCT_VERSION_1, output); |
+ WriteUint(kSignatureTypeLength, SIGNATURE_TYPE_CERTIFICATE_TIMESTAMP, output); |
base::TimeDelta time_since_epoch = timestamp - base::Time::UnixEpoch(); |
- WriteUint(kTimestampLength, time_since_epoch.InMilliseconds(), |
- output); |
+ WriteUint(kTimestampLength, time_since_epoch.InMilliseconds(), output); |
// NOTE: serialized_log_entry must already be serialized and contain the |
// length as the prefix. |
WriteEncodedBytes(serialized_log_entry, output); |
@@ -305,8 +297,8 @@ bool EncodeV1SCTSignedData(const base::Time& timestamp, |
bool DecodeSCTList(base::StringPiece* input, |
std::vector<base::StringPiece>* output) { |
std::vector<base::StringPiece> result; |
- if (!ReadList(kSCTListLengthBytes, kSerializedSCTLengthBytes, |
- input, &result)) { |
+ if (!ReadList( |
+ kSCTListLengthBytes, kSerializedSCTLengthBytes, input, &result)) { |
return false; |
} |
@@ -335,8 +327,7 @@ bool DecodeSignedCertificateTimestamp( |
base::StringPiece extensions; |
if (!ReadFixedBytes(kLogIdLength, input, &log_id) || |
!ReadUint(kTimestampLength, input, ×tamp) || |
- !ReadVariableBytes(kExtensionsLengthBytes, input, |
- &extensions) || |
+ !ReadVariableBytes(kExtensionsLengthBytes, input, &extensions) || |
!DecodeDigitallySigned(input, &result->signature)) { |
return false; |
} |
@@ -360,7 +351,7 @@ bool EncodeSCTListForTesting(const base::StringPiece& sct, |
std::string* output) { |
std::string encoded_sct; |
return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) && |
- WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); |
+ WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); |
} |
} // namespace ct |