Define CBS/CBB tags as uint32_t with a typedef. We use unsigned, but we actually assume it is 32-bit for the bit-packing strategy. But also introduce a typedef to hint that callers shouldn't treat it as an arbitrary 32-bit integer. A typedef would also allow us to extend to uint64_t in the future, if we ever need to. Update-Note: Some APIs switch from unsigned * to uint32_t * out pointers. This is only source-compatible if unsigned and uint32_t are the exact same type. The CQ suggests this is indeed true. If they are not, replace unsigned with CBS_ASN1_TAG to fix the build. Bug: 525 Change-Id: I45cbe127c1aa252f5f6a169dca2e44d1e6e1d669 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/54986 Reviewed-by: Bob Beck <bbe@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/include/openssl/base.h b/include/openssl/base.h index 1e61e98..a2fb76b 100644 --- a/include/openssl/base.h +++ b/include/openssl/base.h
@@ -335,6 +335,10 @@ // are sizes of or indices into C objects, can be converted without overflow. typedef ptrdiff_t ossl_ssize_t; +// CBS_ASN1_TAG is the type used by |CBS| and |CBB| for ASN.1 tags. See that +// header for details. This type is defined in base.h as a forward declaration. +typedef uint32_t CBS_ASN1_TAG; + // CRYPTO_THREADID is a dummy value. typedef int CRYPTO_THREADID;