LibTLS: Rename parse_version to parse_certificate_version

This is not a generic version, but specifically for certificates.
This commit is contained in:
stelar7 2023-04-11 22:31:28 +02:00 committed by Jelle Raaijmakers
parent 0c95564533
commit 77080fbade
Notes: sideshowbarker 2024-07-17 06:29:49 +09:00

View File

@ -85,7 +85,7 @@ static ErrorOr<SupportedGroup> oid_to_curve(Vector<int> curve)
return Error::from_string_view("Unknown curve oid"sv); return Error::from_string_view("Unknown curve oid"sv);
} }
static ErrorOr<Crypto::UnsignedBigInteger> parse_version(Crypto::ASN1::Decoder& decoder, Vector<StringView> current_scope) static ErrorOr<Crypto::UnsignedBigInteger> parse_certificate_version(Crypto::ASN1::Decoder& decoder, Vector<StringView> current_scope)
{ {
// Version ::= INTEGER {v1(0), v2(1), v3(2)} // Version ::= INTEGER {v1(0), v2(1), v3(2)}
if (auto tag = decoder.peek(); !tag.is_error() && tag.value().type == Crypto::ASN1::Type::Constructed) { if (auto tag = decoder.peek(); !tag.is_error() && tag.value().type == Crypto::ASN1::Type::Constructed) {
@ -695,7 +695,7 @@ static ErrorOr<Certificate> parse_tbs_certificate(Crypto::ASN1::Decoder& decoder
Certificate certificate; Certificate certificate;
certificate.tbs_asn1 = asn1_data; certificate.tbs_asn1 = asn1_data;
certificate.version = TRY(parse_version(decoder, current_scope)).to_u64(); certificate.version = TRY(parse_certificate_version(decoder, current_scope)).to_u64();
certificate.serial_number = TRY(parse_serial_number(decoder, current_scope)); certificate.serial_number = TRY(parse_serial_number(decoder, current_scope));
certificate.algorithm = TRY(parse_algorithm_identifier(decoder, current_scope)); certificate.algorithm = TRY(parse_algorithm_identifier(decoder, current_scope));
certificate.issuer = TRY(parse_name(decoder, current_scope)); certificate.issuer = TRY(parse_name(decoder, current_scope));