net: Convert OID constants to use inline constexpr uint8_t [part 1]
This part covers the OIDs from
net/cert/internal/certificate_policies.h
net/cert/internal/parse_certificate.h
The x509_certificate_model used by the cert viewer has a large mapping
of OIDs to strings which in the NSS implementation is a switch statement.
Making our OID constants into inline constexprs will allow using a
FixedFlatMap for the lookup table instead of a large series of if/else
comparisons.
(It may also allow for more optimized code generation in other
locations that use the OIDs as well.)
Bug: 953425
Change-Id: I0bbbbcd7b0eab7362c9193d0c3b4310f3820b357
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3449794
Reviewed-by: Hubert Chao <[email protected]>
Auto-Submit: Matt Mueller <[email protected]>
Reviewed-by: Doug Steedman <[email protected]>
Commit-Queue: Doug Steedman <[email protected]>
Cr-Commit-Position: refs/heads/main@{#970081}
diff --git a/net/cert/x509_util.cc b/net/cert/x509_util.cc
index b5d33c0..3eaeb35 100644
--- a/net/cert/x509_util.cc
+++ b/net/cert/x509_util.cc
@@ -496,7 +496,8 @@
return false;
}
ParsedExtension key_usage_ext;
- if (ConsumeExtension(KeyUsageOid(), &extensions, &key_usage_ext)) {
+ if (ConsumeExtension(der::Input(kKeyUsageOid), &extensions,
+ &key_usage_ext)) {
der::BitString key_usage;
if (!ParseKeyUsage(key_usage_ext.value, &key_usage) ||
!key_usage.AssertsBit(KEY_USAGE_BIT_DIGITAL_SIGNATURE)) {