Clear unused bits in ASN1_STRING_set/set0

Previously, they left the bit count alone, even if it was inconsistent
with the string, which mostly meant callers needed to go back and fix up
the flags field afterwards.

Bump BORINGSSL_API_VERSION. Between this and other fixes in this series,
callers should not need to mess with ASN1_STRING_FLAG_BITS_LEFT anymore.
BORINGSSL_API_VERSION can be used to gate such code that may still be
needed in older BoringSSLs.

Update-Note: ASN1_STRING_set/set0 on a BIT STRING will now cleanly set
the BIT STRING to containing the specified bytes, without carrying over
the unused bit count from the previous value. To set a BIT STRING that
isn't a whole number of bytes, use ASN1_BIT_STRING_set1.

Bug: 42290311
Change-Id: I8dfd6ca6485de7a3bae0be055e4e624f5ff9b340
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/92571
Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Lily Chen <chlily@google.com>
Reviewed-by: Lily Chen <chlily@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
9 files changed
tree: 8922680415f606c3fd3882eab2fd4769c9ecf7dc
  1. .bcr/
  2. .github/
  3. bench/
  4. cmake/
  5. crypto/
  6. decrepit/
  7. docs/
  8. fuzz/
  9. gen/
  10. include/
  11. infra/
  12. pki/
  13. rust/
  14. ssl/
  15. third_party/
  16. tool/
  17. util/
  18. .bazelignore
  19. .bazelrc
  20. .bazelversion
  21. .clang-format
  22. .clang-format-ignore
  23. .gitattributes
  24. .gitignore
  25. API-CONVENTIONS.md
  26. AUTHORS
  27. BREAKING-CHANGES.md
  28. BUILD.bazel
  29. build.json
  30. BUILDING.md
  31. CMakeLists.txt
  32. codereview.settings
  33. CONTRIBUTING.md
  34. FUZZING.md
  35. go.mod
  36. go.sum
  37. INCORPORATING.md
  38. LICENSE
  39. MODULE.bazel
  40. MODULE.bazel.lock
  41. PORTING.md
  42. PRESUBMIT.py
  43. PrivacyInfo.xcprivacy
  44. README.md
  45. SANDBOXING.md
  46. SECURITY.md
  47. STYLE.md
README.md

BoringSSL

BoringSSL is a fork of OpenSSL that is designed to meet Google's needs.

Although BoringSSL is an open source project, it is not intended for general use, as OpenSSL is. We don't recommend that third parties depend upon it. Doing so is likely to be frustrating because there are no guarantees of API or ABI stability.

Programs ship their own copies of BoringSSL when they use it and we update everything as needed when deciding to make API changes. This allows us to mostly avoid compromises in the name of compatibility. It works for us, but it may not work for you.

BoringSSL arose because Google used OpenSSL for many years in various ways and, over time, built up a large number of patches that were maintained while tracking upstream OpenSSL. As Google's product portfolio became more complex, more copies of OpenSSL sprung up and the effort involved in maintaining all these patches in multiple places was growing steadily.

Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it's not part of the NDK) and a number of other apps/programs.

Project links:

To file a security issue, use the Chromium process and mention in the report this is for BoringSSL. You can ignore the parts of the process that are specific to Chromium/Chrome.

There are other files in this directory which might be helpful: