195 Commits
Author SHA1 Message Date
David Benjamin 96c2425224 Introduce EVP_PKEY_ALG
This adds new SPKI and PKCS#8 parser entrypoints that pass in the list
of allowed algorithms. Algorithms are expressed as EVP_PKEY_ALG
functions and roughly things that can create EVP_PKEYs in various ways.
(Right now just SPKI and PKCS#8 parsers, but I'm imagining that they'll
also be the handle for the "raw" public/private key parsers and things
like the list of curves for ECPrivateKey or X9.62 points.)

The immediate motivation is to give a handle for opting into
EVP_PKEY_RSA_PSS (we don't want most applications to be exposed to
those), but I'm hoping this can also:

- Let us add legacy or experimental algorithms for one caller without
  worrying about exposing all callers to them.

- Let size-constrained applications use EVP without worrying about
  binary size.

- Reduce the need for people to check the key type after parsing keys. I
  would like to it eliminate the need, but RSA having a continuum of
  sizes makes things tricky. For now, EVP_pkey_rsa() just accepts all
  supported RSA sizes (512 through 8192, but hopefully we can clamp it
  down).

While we're here, correct what, in hindsight, were I think some missteps
in the EVP_parse_public_key convention:

- Not saying the name of the format in the function name. Since I expect
  we'll add EVP_PKEY_from_ec_private_key, EVP_PKEY_from_rsa_private_key,
  etc., functions to start filling out EVP, having the name of the
  format would have been nice.

- Taking an in/out CBS parameter. As an in/out parameter, we don't check
  trailing data and just pass it to the caller to check. This optimized
  for parsing an SPKI inside a structure, rather than standalone. In
  practice, folks forget to check trailing data.

In comparison to OpenSSL 3.x, I think an EVP_PKEY_ALG is roughly an
OSSL_KEYMGMT, but that's a very confusing name. Maybe also with bits of
the OSSL_DECODER in there. Mostly I don't understand their very
complicated (and apparently quadratic-time) decoder system.

OpenSSL 3.x also has an OSSL_LIB_CTX which has been threaded into a
bunch of objects. Having BoringSSL's OSSL_LIB_CTX carry a list of these
things would be plausible, but different call sites within a single
application may support different algorithms, so let's start with the
explicit list approach and see where we go from there.

Bug: 42290364
Change-Id: I342603efdc167c8f587357d17800d7ad545d5908
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/81651
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-08-28 10:03:48 -07:00
David Benjamin 99eba5614c Suppress -Wcast-qual in STACK_OF implementation
This appears in public headers, so we have to tolerate any warnings that
any downstream project might try to use. -Wcast-qual unfortunately seems
to be pretty unusable in C. There is no way to tell the compiler that
you actually did intentionally cast away const (here because of the type
erasure silliness we have to do to support OpenSSL's API). In C++,
const_cast works, but not in C.

So, instead, use pragmas to suppress the warning in GCC and Clang.

Fixed: 411164106
Change-Id: I37a651fb52f3049e10b7cfd3ef979ae19969c571
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/79288
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-05-15 15:41:15 -07:00
David Benjamin 3718975696 Make LHASH a completely internal type
The one remaining external reference was in an unused parameter where it
was impossible to obtain a non-null value. Remove the last of that
machinery from the public API. This leaves us free to completely rework
LHASH_OF(T) internally, including making it a template that understands
whether it owns its values.

(If we end up needing to revert it, we can still make the real
LHASH_OF(T) into a template. It just won't be called LHASH_OF(T)
anymore.)

Update-Note: Calling code which references LHASH_OF(T) will no longer
compile. We have had no public APIs that allow a caller to usefully
construct an LHASH_OF(T) for some time, so this only ever came up in odd
cases around bindings APIs.

Change-Id: I5a44310b04d8f8f3599f0f356b64786e62db5fbf
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78787
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-22 12:29:02 -07:00
David Benjamin 34a1d37575 Implement functions to generate CMS external signatures
This implements just the small subset of OpenSSL's CMS API to support
the Linux kernel's sign-file.c tool. It is nowhere close to a full CMS
implementation and is not intended to become one. In particular, it does
not implement enough of CMS to support S/MIME. That requires much, much
more infrastructure than was implemented here.

CMS is, like PKCS#7, an over-engineered and cryptographically unsound
set of nestable combinators to support just about any configuration of
cryptographic operations. Profiling CMS down to a usable subset is, as a
result, more complicated, more risky, and less efficient than just
designing a bespoke structure for your use case. It is derived from
PKCS#7, and largely overlaps. However, both PKCS#7 and CMS use the v1
version number, but CMS made incompatible changes in some corner cases
that, so far, do not matter to us. (It is incompatible if you try to
layer SignedData atop another combinator, where the lack of proper
domain separation in this badly designed format is of extra risk.)

In the case of the kernel, sign-file.c wants an "external signature",
which is when the data to be signed lives elsewhere. This is, as a
result, a very, very inefficient way to concatenate an enum with a byte
string. But this is what the kernel chose, so here we are.

Because PKCS#7 and CMS are broadly the same structure, I've generalized
the internal PKCS#7 function rather than duplicating all this code. If
we ever hit the cases where PKCS#7 and CMS v1 are incompatible, plumbing
an extra boolean will be the least of our worries.

Test data was generated by compiling the actual sign-file.c against
OpenSSL and saving the output.

Change-Id: Idb0874d2b5294bfad564f3a00458c3fd044d9da5
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78452
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-04-14 13:44:28 -07:00
Victor Tan c86127e656 Change to use ALPS new codepoint as default
Change-Id: Id8f0fd89bd64c5cc79c18d70ceedf959f4bd33ce
Bug: 396645354
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/78187
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-04-01 09:36:04 -07:00
David Benjamin 30b7a01dd4 Mark some transitive includes as IWYU export.
This reflects some assumptions we have on our headers:

- <openssl/foo.h> pulls in <openssl/base.h>. In particular, the
  canonical FOO typedefs for foo_st all live forward declared in
  <opessl/base.h>, but including <openssl/foo.h> is sufficient to use
  FOO.

- <openssl/base.h> pulls in <stdint.h> and <stddef.h> so we don't have
  to keep including it.

Add IWYU exports to reflect this so that clang's include cleaner gets
less upset. It's a bit of a blunt instrument because it also means that
<openssl/foo.h> lets you use the forward-declared BAR typedef, and
downstream projects might still prefer to explicit include <stdint.h>
when they use it (we use it so much that it would be too much), but I
think this is fine.

NB: By adding these, we're essentially promising we won't include those
transitive includes because downstream code might accidentally start
relying on it.

Change-Id: I705fe6d1026fbd302ed0f070a0cf7658a70af8ef
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77687
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-03-15 18:29:02 -07:00
David Benjamin 562ed3183a Update deps and tag a version for BCR
Also bump BORINGSSL_API_VERSION for draft-ietf-tls-cross-sni-resumption.

Change-Id: Ie71484f701d232e2138abef504aca95e1d58f23c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/77347
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-03-11 10:52:14 -07:00
David Benjamin 33d1049b1f Switch the license to Apache 2.0, matching OpenSSL upstream
We use the standard Apache 2.0 file header, described in "APPENDIX: How
to apply the Apache License to your work."

This was primarily automated by running:

  git ls-tree -r --name-only HEAD | xargs go run ./util/relicense.go

See go/boringssl-relicensing-triage for the results of triaging the
output of the tool.

As part of this, switch from taking fiat-crypto under MIT license to
Apache 2.0. (It is licensed under MIT OR Apache-2.0 OR BSD-1-Clause.)

The copyright_summary tool can also be used to confirm we didn't
accidentally drop any copyright lines:

  # Run before the CL
  git grep -l Copyright | xargs go run ./util/copyright_summary.go  -out /tmp/old.json
  # Run after the CL
  git grep -l Copyright | xargs go run ./util/copyright_summary.go  -compare /tmp/old.json

Bug: 364634028
Change-Id: I17c50e761e9d077a1f92e25969e50ed35e320c59
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75852
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-02-03 15:05:16 -08:00
Bob Beck 15bab61253 Bump API version to 34
Change-Id: I6fc3367377d8c4ec6e75e23c1b7e3056ff31b90f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/75627
Reviewed-by: David Benjamin <davidben@google.com>
Auto-Submit: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2025-01-23 12:24:26 -08:00
Adam Langley dc59036b9f Remove uses of strcpy, strcat, and sprintf, and handle NULL in some functions.
This change reimplements some OpenSSL changes based only on the
description of the work in base.h.

Change-Id: I1a8b3d2774216c43ab446aa56b31cbb40d58b29d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74847
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2025-01-06 14:59:43 -08:00
David Benjamin 3cdbf04c19 Import "Remove some code for a contributor that we cannot find" from upstream OpenSSL
This imports
https://github.com/openssl/openssl/commit/320a81277e402f393289ae7229b2320324321fb1
from upstream OpenSSL.

This causes the following free functions to no longer check for NULL:

* BIO_CONNECT_free
* BUF_MEM_free
* BN_CTX_free
* BN_RECP_CTX_free
* BN_MONT_CTX_free
* BN_BLINDING_free
* X509_STORE_free
* SSL_SESSION_free

(It also causes tls_free to no longer check for NULL, but that check was
unnecessary.)

Bug: 364634028
Change-Id: Ia625039a0a22b0bf368c39d6b8090ca15955f8e4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74828
Reviewed-by: Adam Langley <agl@google.com>
2025-01-06 14:59:38 -08:00
David Benjamin b9e84d0bb9 Import "Undo commit d420ac2" from upstream OpenSSL
This imports
https://github.com/openssl/openssl/commit/0904e79a6e6109240d5a552f2699408b26cf63ee
from upstream OpenSSL. The tree intentionally does not compile at this
point.

Bug: 364634028
Change-Id: I39001741cf0db059e76ad4940004a1d57bf8af12
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74827
Reviewed-by: Adam Langley <agl@google.com>
2025-01-06 14:59:33 -08:00
David Benjamin 4854ec106f Apply OpenSSL's "copyright consolidation" changes
This applies the OpenSSL "copyright consolidation" process from the
following upstream changes:

* https://github.com/openssl/openssl/commit/e0a651945cb5a70a2abd9902c0fd3e9759d35867
* https://github.com/openssl/openssl/commit/3fb2cf1ad19feaf6f7c571b49bd9e320eb4daf31
* https://github.com/openssl/openssl/commit/ac3d0e13777a0f0533792ed8fdd7de485675a3a2
* https://github.com/openssl/openssl/commit/c2f312f5c2379e1dcb6b3678bda27f7544508ee6
* https://github.com/openssl/openssl/commit/596d6b7e1ca5aa24700098e262cb1625f256343f
* https://github.com/openssl/openssl/commit/e18cf66aaf44b4d476625b2416386b051007d495
* https://github.com/openssl/openssl/commit/846e33c729311169d9c988ceba29484b3783f244
* https://github.com/openssl/openssl/commit/440e5d805f449d662520313b33fd90aeee86980b
* https://github.com/openssl/openssl/commit/21dcbebc6e35419f1842f39a125374ea1ba45693
* https://github.com/openssl/openssl/commit/6286757141a8c6e14d647ec733634ae0c83d9887
* https://github.com/openssl/openssl/commit/4f22f40507fea3f272637eb8e00cadf1f34b10d9
* https://github.com/openssl/openssl/commit/d2e9e320186f0917cc940f46bdf1a7e4120da9b0
* https://github.com/openssl/openssl/commit/2039c421b0e5b75ffcf6a88e39cc09089b4303dc
* https://github.com/openssl/openssl/commit/b1322259d93cf6b6286f9febcd468b6a9f577d91
* https://github.com/openssl/openssl/commit/aa6bb1352b1026b20a23b49da4efdcf171926eb0
* https://github.com/openssl/openssl/commit/b6cff313cbb1d0381b329fe4f6a8f009cdb270e4
* https://github.com/openssl/openssl/commit/9e20068958b8c1772067299dda7df0b8a82283b4
* https://github.com/openssl/openssl/commit/6aa36e8e5a062e31543e7796f0351ff9628832ce
* https://github.com/openssl/openssl/commit/44c8a5e2b9af8909844cc002c53049311634b314

This was mostly automated, but partially manual. The automated portion
can be reproduced by checking OpenSSL to commit
44c8a5e2b9af8909844cc002c53049311634b314, and running the following:

  git grep -l -E 'Copyright remains Eric Young|Copyright.*The OpenSSL Project\.|Written by.*for the OpenSSL Project' crypto/ decrepit/ include/ ssl/ | grep -v objects.go > files.txt
  cat files.txt | xargs -n1 perl -i ./util/copyright.pl

From there, some years were fixed up manually according to
go/openssl-copyright-consolidation-comparison (internal-only).

Three files required additional manual fixing:

- crypto/ecdh_extra/ecdh_extra.cc
- crypto/fipsmodule/ecdh/ecdh.cc.inc
- include/openssl/ecdh.h

These files have an OpenSSL header, but *after* a different header, so
the script does not correctly detect the now redundant OpenSSL header.
They were manually modified to remove it. This matches what seems to
have been done to crypto/ec/ecdh_ossl.c in OpenSSL's
4f22f40507fea3f272637eb8e00cadf1f34b10d9.

Bug: 364634028
Change-Id: I79a559a409ebe2476f2cb8a48a488ac5dd77c90a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74710
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2025-01-03 13:56:35 -08:00
Adam Langley 5813c2c10c crypto: switch to C++
This change switches nearly all of BoringSSL to use C++. The public
functions still use the C ABI, and so code written in C can still use
BoringSSL. Also the use of the C++ standard library is minimal and no
run-time requirement for it is intended.

Change-Id: I902d2f51a3c8d6bd0dc4aabe1b192a15d7b788e8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/72747
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2024-11-26 21:10:44 +00:00
David Benjamin c59bf8bf18 Support skipping tickets in both ticket callbacks
TLS 1.2 and TLS 1.3 both support some mechanism for the server to change
its mind at the last minute and not send a ticket. In TLS 1.2, you leave
the ticket field empty. In TLS 1.3, you just don't send NewSessionTicket
in the first place.

We have two ticket encryption callbacks, the old "ticket key callback"
and the "ticket AEAD callback".

The ticket key callback has no way to trigger this behavior, but it has
an unused zero return that could be repurposed for this, in principle.
Back in 2016, OpenSSL did so in
https://github.com/openssl/openssl/pull/1098

The ticket AEAD callback could, in principle, support this by
successfully returning the empty string. This goes against the current
documented API contract, but it accidentally worked in TLS 1.2. In TLS
1.3, it caused our servers to send a syntax error.

The QUIC folks want this behavior and used to accidentally trigger the
syntax error, and have switched to returning some garbage placeholder
string. Between that, the new OpenSSL behavior, and it accidentally
working in TLS 1.2 anyway, let's just go ahead and support this.

To aid in version skew messes, this also bumps BORINGSSL_API_VERSION.

Change-Id: Id4fef7b9aa552dc8e927f89a5d746bdd2247e1c6
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/73028
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2024-11-13 05:22:33 +00:00
Brian Ledger 68c6fd8943 Disable -Wcast-function-type-strict for BORINGSSL_DEFINE_STACK_OF_IMPL.
Change-Id: I8340cf9259de72792a01049ecc36997233887006
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67607
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2024-04-02 23:26:52 +00:00
David Benjamin 91a3f26a2e Add an SSL_CREDENTIAL API for ECDSA/RSA and delegated credentials
This adds a notion of "credentials" to BoringSSL's API, to support
certificate selection by key type (typically ECDSA vs RSA), though the
aim is for it to be generalizable to other certificate types and other
kinds of selection criteria, such as Trust Expressions, or Merkle Tree
Certificates. Since we already had some nascent delegated credentials
I've reworked that feature with SSL_CREDENTIALs as well.

The model is that you create an SSL_CREDENTIAL object containing all the
configuration for what you are authenticating as. An X.509
SSL_CREDENTIAL has a certificate chain, private key, optionally an OCSP
response and SCT list. Delegated credentials are similar. In the future,
we might use this for raw public keys, other certificate types, etc.
Once you set those up, you configure those on the SSL or SSL_CTX in
preference order, and BoringSSL will internally pick the first one that
is usable.

The current implementation ends up redundantly selecting the signature
algorithm a couple of times. This works but is a little goofy. A
follow-up change will remove this redundancy. The protocol between the
runner and shim for tests is also a little weird, but it was the easiest
way I could think of for injecting that. Long-term, I think we should
just replace that protocol with a JSON structure. (See
https://crbug.com/boringssl/704.)

As split handshakes are in the process of being replaced with handshake
hints, this won't work with split handshakes. It works with handshake
hints without any extra work.

Update-Note: The delegated credentials API has been revamped.
Previously, it worked by configuring an optional delegated credential
and key with your normal certificate chain. This has the side effect of
forcing your DC issuer and your fallback certificate to be the same. The
SSL_CREDENTIAL API lifts this restriction.

A delegated credential is now just a different kind of credential. It
may use the same certificate chain as an X.509 credential or be
completely separate. All the SSL_CREDENTIAL APIs take CRYPTO_BUFFERs,
so, if common, the buffers may be shared to reduce memory.

The SSL_delegated_credential_used API is also removed, in favor of the
more general SSL_get0_selected_credential API. Callers can use ex_data
or pointer equality to identify the credential.

Bug: 249
Change-Id: Ibc290df3b7b95f148df12625e41cf55c50566602
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66690
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2024-03-07 22:19:26 +00:00
David Benjamin 1a118bbf76 Rename CRYPTO_get_ex_new_index to CRYPTO_get_ex_new_index_ex
Change-Id: I459e71c4ff12cdcd2783704409b64bbc0fe9b23d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66808
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2024-03-07 00:51:57 +00:00
David Benjamin 1b08502fe2 Unexport most of X509_TRUST and X509_PURPOSE and simplify
X509_PURPOSE can't be fully trimmed because rust-openssl uses a few APIs
to look up purposes by string.

Change-Id: I39e3cec4d8b01ecf7dec1f368fabea4a82eff8e9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65788
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2024-02-15 04:05:02 +00:00
Bob Beck 48b814697f Move signature_verify_cache.h to openssl/pki as public api
Update-note: This moves signature_verify_cache.h from the pki
directory to <openssl/pki/signature_verify_cache.h>. Nothing
should really have been depending on this but if so it can
be pre-conditioned on OPENSSL_API_VERSION of 30 or more.

Bug: 660
Change-Id: Ia0ab6e9d16da2a86994ce0dfc6a086e43b79c9ae
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64787
Reviewed-by: David Benjamin <davidben@google.com>
2024-02-14 19:32:33 +00:00
David Benjamin b251d813ec Change certificate depth limit to match OpenSSL and document
OpenSSL 1.1.0 included d9b8b89bec4480de3a10bdaf9425db371c19145b, which a
cleanup change to X509_verify_cert. This cleanup changed the semanitcs
of the depth limit. Previously, the depth limit omitted the leaf but
included the trust anchor. Now it omits both.

We forked a little before 1.0.2, so we still had the old behavior. Now
that the new behavior is well-established, switch to new one. Bump
BORINGSSL_API_VERSION so callers can detect one or the other as needed.

Document the new semantics. Also fix up some older docs where I implied
-1 was unlimited depth. Negative numbers were actually enforced as
negative numbers (which means only explicitly-trusted self-signed certs
worked).

Update-Note: The new semantics increase the limit by 1 compared to the
old ones. Thus this change should only accept more chains than
previously and be relatively safe. It also makes us more
OpenSSL-compatible. Envoy will need a tweak because they unit test the
boundary condition for the depth limit.

Bug: 426
Fixed: 459
Change-Id: Ifaa108b8135ea3d875f2ac1f2a3b2cd8a22aa323
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64707
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-12-14 18:17:25 +00:00
David Benjamin 314c2520ea Document or unexport some more of x509.h
Get the remaining config APIs, extensions accessors, and the get1_email
family. I'm not sure yet whether the various remaining
extension-specific functions should get their own sections (probably),
in which case, maybe we should move the accessors these into their
sections? Put them with the rest of the certificate getters for now.

As part of this, deduplicate the X509v3_KU_* and KU_* constants. See
https://github.com/openssl/openssl/issues/22955

Bug: 426
Change-Id: I31a9b887eb1e6cfa272f04d2ee80dbb5a9ed98f7
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64256
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-12-06 18:58:00 +00:00
David Benjamin 2d7adaea91 Pull the string-based extensions APIs into their own section
Unexport X509V3_EXT_val_prn because no one calls it. One less thing to
document.

Also add a warning in honor of our favorite bindings libraries about
these string-based APIs.

Bug: 426
Change-Id: If77f1139a945f234b3b85978aae95e564428aeb8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64139
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2023-11-30 22:10:19 +00:00
David Benjamin 251ee0b761 Implement the old FIPS 186-2 PRF
FIPS 186-2 included some ad-hoc PRF, based on SHA-1's internals, to
generate some numbers for DSA, though nothing uses it for DSA anymore.
However, it made its way into EAP-SIM and EAP-AKA. Some applications
implement it by reaching into the SHA_CTX structure.

https://boringssl-review.googlesource.com/c/boringssl/+/63967 broke some
of those callers. Rather than revert it, just add a support API for this
PRF and we'll move that caller to it.

Reference:
https://csrc.nist.gov/files/pubs/fips/186-2/upd1/final/docs/fips186-2-change1.pdf

Bug: 566, 667
Change-Id: I5821811f15f20f9f43165fcda23befad03ff277a
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/64307
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2023-11-29 21:55:48 +00:00
Victor Tan 558960d1e1 Add support for the new ALPS codepoint
Old version Chrome with the existing ALPS codepoint can potentially cause network error due to an arithmetic overflow bug in Chrome ALPS decoder (We already fixed the issues starting from M100 in Chrome).

This CL add a new codepoint for ALPS extension in a way that can be enabled on individual connections., To support multiple versions of Chrome, we need to support both codepoints in BoringSSL.

For details: https://docs.google.com/document/d/16pysbV_ym_qAau_DBYnrw2A4h5ve2212wfcoYASt52U

Change-Id: Iea7822e757d23009648febc8eaff1c91b0f06e18
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61125
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
2023-09-12 18:01:21 +00:00
Bob Beck b8e012e1ff Make a BSSL_CHECK that always aborts
Change-Id: Ie1867ed8a9763331bcc83482cfb22f1e39a281d4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62366
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-08-16 20:47:47 +00:00
David Benjamin 6738d477b8 Restore OPENSSL_RAND_TRUSTY
With b/291102972 resolved, we can try this again.

Bug: 629, b:291102972
Change-Id: Ic04d1855f185ead6ae2e151dcc56493afce40b4f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62105
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-08-01 01:17:59 +00:00
David Benjamin 0ffd3658dc Use a stub fopen implementation when OPENSSL_NO_FILESYSTEM is set
Detecting errors (i.e. fs-less platforms using fs-only APIs) at compile
time is generally preferable to doing so at runtime, so
https://boringssl-review.googlesource.com/c/boringssl/+/61726 opted to
remove the APIs altogether on applicable targets.

However, Trusty uses rust-openssl somewhere and rust-openssl binds a
bunch of filesystem-dependent APIs unconditionally. To keep that
working, switch to a stub fopen when OPENSSL_NO_FILESYSTEM is set. We
effectively model a platform where the filesystem "exists", but is
empty. Upstream OpenSSL similarly has OPENSSL_NO_STDIO still define the
file BIO (unlike the socket BIO, which is excluded), but in a stub form.

As part of this, I've gone ahead and resolved one of the Trusty TODOs.
It does produce a duplicate symbol with [1], but things seem to link
fine in treehugger. In case it does break, I've bumped
BORINGSSL_API_VERSION, so we can go in and condition it if needed.

[1] https://android.googlesource.com/trusty/lib/+/refs/heads/main/lib/openssl-stubs/bio.c

Bug: 629
Change-Id: I4f20d872a7cde863d21c78090f270b77b03545fa
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61925
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2023-07-24 17:02:01 +00:00
Bob Beck 2b8a057ca2 Entropy changes for trusty and windows.
Add a rand_extra file for trusty, bump the BORINGSSL_API_VERION
and mark both trusty and windows as non-forking so we do not
require fork detection support.

Update-Note:
Prior to API version 24, Trusty maintained their own CRYPTO_sysrand
implementations outside of the BoringSSL tree.  With this change
they are not expected to provide CRYPTO_sysrand, it is maintained
inside the BoringSSL tree.

Change-Id: Iabcef024ff85bd767e2869a6ff27a64236322325
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61465
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-07-11 19:32:21 +00:00
David Benjamin a905bbb52a Consistently include BTI markers in every assembly file
Trying to migrate Chromium to the "link all the asm files together"
strategy broke the aarch64 Android build because some of the ifdef'd out
assembly files were missing the .note.gnu.property section for BTI. If
we add support for IBT, that'll be another one.

To fix this, introduce <openssl/asm_base.h>, which must be included at
the start of every assembly file (before the target ifdefs). This does a
couple things:

- It emits BTI and noexecstack markers into every assembly file, even
  those that ifdef themselves out.

- It resolves the MSan -> OPENSSL_NO_ASM logic, so we only need to do it
  once.

- It defines the same OPENSSL_X86_64, etc., defines we set elsewhere, so
  we can ensure they're consistent.

This required carving files up a bit. <openssl/base.h> has a lot of
things, such that trying to guard everything in it on __ASSEMBLER__
would be tedious. Instead, I moved the target defines to a new
<openssl/target.h>. Then <openssl/asm_base.h> is the new header that
pulls in all those things.

Bug: 542
Change-Id: I1682b4d929adea72908655fa1bb15765a6b3473b
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60765
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-06-22 23:36:55 +00:00
David Benjamin 9fcaec6435 Start recognizing the OPENSSL_NANOLIBC define
nanolibc is an embedded platform with no threads. To start unforking
that build, generalize some of the OPENSSL_TRUSTY defines. OpenSSL has
OPENSSL_NO_SOCK if you don't have sockets and OPENSSL_NO_POSIX_IO if you
don't have file descriptors. Those names are fine enough, so I've
borrowed them here too.

There's more to be done here, but this will clear out some of it.

Change-Id: Iaba1fafdebb46ebb8f68b7956535dd0ccaaa832f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60890
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2023-06-20 18:41:34 +00:00
David Benjamin 556a973f9b Add SSL_CIPHER_get_handshake_digest
We added SSL_CIPHER_get_prf_nid to match the other SSL_CIPHER_get_*_nid
functions, but OpenSSL went with returning the EVP_MD instead.
rust-openssl uses this function, and all the callers of
SSL_CIPHER_get_prf_nid then call EVP_get_digestbynid anyway, so this
version is preferable.

Update-Note: This change is backwards-compatible, but we should update
the QUIC code to use this new function when OPENSSL_API_VERSION is
high enough. It has the benefit of not pulling in random other hash
functions like MD4.

Change-Id: Ied66a6f0adbd5d7d86257d9349c40a2830e3c7e8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60606
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-06-08 17:16:14 +00:00
David Benjamin 6cf9820837 Align NIDs vs group IDs in TLS group APIs
Right now we use NIDs to configure the group list, but group IDs (the
TLS codepoints) to return the negotiated group. The NIDs come from
OpenSSL, while the group ID was original our API. OpenSSL has since
added SSL_get_negotiated_group, but we don't implement it.

To add Kyber to QUIC, we'll need to add an API for configuring groups to
QUICHE. Carrying over our inconsistency into QUICHE's public API would
be unfortunate, so let's use this as the time to align things.

We could either align with OpenSSL and say NIDs are now the group
representation at the public API, or we could add a parallel group ID
API. (Or we could make a whole new SSL_NAMED_GROUP object to pattern
after SSL_CIPHER, which isn't wrong, but is even more new APIs.)

Aligning with OpenSSL would be fewer APIs, but NIDs aren't a great
representation. The numbers are ad-hoc and even diverge a bit between
OpenSSL and BoringSSL. The TLS codepoints are better to export out to
callers. Also QUICHE has exported the negotiated group using the
codepoints, so the natural solution would be to use codepoints on input
too.

Thus, this CL adds SSL_CTX_set1_group_ids and SSL_set1_group_ids. It
also rearranges the API docs slightly to put the group ID ones first,
and leaves a little note about the NID representation before introducing
those.

While I'm here, I've added SSL_get_negotiated_group. NGINX seems to use
it when available, so we may as well fill in that unnecessary
compatibility hole.

Bug: chromium:1442377
Change-Id: I47ca8ae52c274133f28da9893aed7fc70f942bf8
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60208
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2023-05-31 15:24:16 +00:00
Bob Beck 4540c3caf0 OpenBSD Support
Includes bits by me and Robert Nagy <robert.nagy@gmail.com> who has a
google CLA.

Update-Note: Additionally, BoringSSL now requires macOS 10.12 or later
for getentropy support. This is consistent with
https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md

WANT_LGTM=all

Change-Id: I5ab74fa8a6677fac29c316aa29a954df401ba647
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59225
Commit-Queue: Bob Beck <bbe@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2023-05-11 16:37:32 +00:00
David Benjamin a972b78d1b Add APIs to query a list of possible strings for TLS features
Envoy needs to have the possible cipher, etc., strings predeclared to
reduce synchronization needs in the steady state. It currently does this
by (1) iterating over SSL_CTX_get_ciphers at SSL_CTX creation time and
(2) hard-coding a lists of known TLS 1.3 ciphers, TLS versions,
NamedGroups, etc.

(1) would work for some applications, but it breaks any applications
that configure ciphers on the SSL on a certificate callback, etc. If the
callback configures a cipher that wasn't configured on the SSL_CTX (e.g.
if the SSL_CTX were left at defaults), Envoy's logging breaks and we hit
an ENVOY_BUG assertion.

(2) breaks whenever BoringSSL adds a new feature. In principle, we could
update Envoy when updating BoringSSL, but this is an unresasonable
development overhead for just one of many BoringSSL consumers to impose.
Such costs are particularly high when considering needing to coordinate
updates to Envoy and BoringSSL across different repositories.

Add APIs to enumerate the possible strings these functions can return.
These string lists are a superset of those that any one application may
care about (e.g. we may have a deprecated cipher that Envoy no longer
needs, or an experimental cipher that's not yet ready for Envoy's
stability goals), but this is fine provided this is just used to
initialize the table. In particular, they are *not* intended to
enumerate supported features.

Bump BORINGSSL_API_VERSION to aid in patching these into Envoy.

Bug: b:280350955
Change-Id: I4d11db980eebed5620d3657778c09dbec004653c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59667
Commit-Queue: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2023-05-08 17:49:32 +00:00
David Benjamin 86ada1ea2f Add new APIs for creating RSA keys
This adds APIs for constructing RSA keys given all the parameters. This
is much less tedious than the set0 functions, and also avoids issues
caused by deferred initialization.

It doesn't quite finish initializing the keys on construction, as that
is tied up in the rest of this mess. But later work, probably after
Conscrypt is moved to these APIs, will do this.

As part of this, add APIs that explicitly create RSA keys with no e.
There is actually no way to do this right now without reaching into
library internals, because RSA_set0_key refuses to accept an e-less
private key. Handle this by adding a flag.

I also had to add a path for Conscrypt to make an RSA_METHOD-backed key
with n but no e. (They need n to compute RSA-PSS padding.) I think that
all wants to be rethought but, for now, just add an API for it.

This bumps BORINGSSL_API_VERSION so Conscrypt can have an easier time
switching to the new APIs.

Bug: 316
Change-Id: I81498a7d0690886842016c3680ea27d1ee0fa490
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59386
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2023-05-01 21:50:19 +00:00
Bob Beck ac6d55859a Add mechanism for deprecated declarations.
This allows us to mark functions as deprecated
declarations with OPENSSL_DEPRECATED.

We also add an OPENSSL_BEGIN_ALLOW_DEPRECATED and an
OPENSSL_END_ALLOW_DEPRECATED for testing use to
test deprecated functions.

The purpose of this is to allow us to mark things
people should not be using as deprecated, and force some
inconvenience on the user of such things to notice them
(as opposed to a only a warning to not use it that they
may not see or read without something tripping them up.)

The intent is to still allow use, with some effort,
before removing the function, or moving it to
libdecrepit.

We initially mark X509V3_EXT_add and X509V3_EXT_add_alias
as deprecated.

Update-Note: We are starting to mark some functions in
boringssl as deprecated declarations which will cause the
compiler to emit warnings if they are used. The intention
is both to prevent accidental use in new code, and to to call
attention to call sites in existing code so that the documentation
for the deprecated function can be revisted and appropriate action
taken.

Bug: 584
Change-Id: Ia9ff386f0d22588e8a5999eda1a48b8c28dca2de
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/58405
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-04-21 15:46:49 +00:00
David Benjamin af0739fc73 Const-correct sk_FOO_cmp_func
This is a double-pointer and both layers should be const. This matches
OpenSSL 1.1.1, so in addition to being more const-correct, we're more
OpenSSL-compatible.

Update-Note: Anything that defines a comparison function would need to
fix the type signature. I found only one external caller, Envoy, that
defines it. https://github.com/envoyproxy/envoy/pull/25051 fixes it.
(That we hadn't run into the upstream incompatibility suggests this is
just not a feature folks use outside the library much.)

Bumping BORINGSSL_API_VERSION, in case I missed any, and there's some
caller where we can't just use C++14 generic lambdas to smooth it over.

Fixed: 498
Change-Id: I8f07ff42215172aa65ad8819acf69b63d6d8e54c
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56190
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-03-29 00:29:21 +00:00
David Benjamin a925c220c1 Remove EVP_PKEY_ASN1_METHOD and EVP_PKEY_METHOD from public headers
With EVP_PKEY and EVP_PKEY_CTX opaque, these symbols don't appear in any
public APIs anymore. Make them internal, which also opens the door to
renaming them:

- EVP_PKEY_METHOD is more accurately EVP_PKEY_CTX_METHOD
- EVP_PKEY_ASN1_METHOD is more accurately EVP_PKEY_METHOD

Or perhaps the split doesn't mean much and we should fold them together.

Change-Id: I8a0f7c2e07445dc981c7cef697263e59dba7784e
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/57885
Commit-Queue: David Benjamin <davidben@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
2023-03-07 20:32:17 +00:00
David Benjamin 7d2338d000 Remove support for ppc64le.
We no longer have a need to support ppc64le, nor do we have any testing
story.

Update-Note: BoringSSL no longer supports ppc64le.

Change-Id: I016855e40e9a56f96d6d043fb4f970835eabe3b4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56389
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2023-01-27 14:32:30 +00:00
David Benjamin 971b330faf Use the same Deleter across all bssl::UniquePtr<T>.
Template operator() instead of the type. This fixes converting
subclasses with bssl::UniquePtr. std::unique_ptr<T, D> can be converted
to std::unique_ptr<U, E> requires either D == E or for D to be
implicitly convertable to E, along with other conditions. (Notably T*
must be convertible to U*.)

In the real std::unique_ptr, we rely on std::default_delete<T> being
convertable to std::default_delete<U> if T* is convertible to U*. But
rather than write all the SFINAE complexity, I think it suffices to
move the template down a later. This simplifies SSLKeyShare::Create a
little.

Change-Id: I431610f3a69a72dd9def190d3554c89c2d3a4c32
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56385
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
2023-01-26 23:25:27 +00:00
David Benjamin a1dffbfed9 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>
2022-11-14 21:01:23 +00:00
David Benjamin dd81bf7707 Introduce ossl_ssize_t and use it in ASN1_STRING_set.
We have a number of APIs that cannot migrate to size_t because OpenSSL
used negative numbers as some special indicator. This makes it hard to
become size_t-clean.

However, in reality, the largest buffer size is SSIZE_MAX, or, more
accurately PTRDIFF_MAX. But every platform I've ever seen make ptrdiff_t
and size_t the same size. malloc is just obligated to fail allocations
that don't fit in ssize_t. ssize_t itself is not portable (Windows
doesn't have it), but we can define ossl_ssize_t to be ptrdiff_t.
OpenSSL also has an ossl_ssize_t (though they don't use it much), so
we're also improving compatibility.

Start this out with ASN1_STRING_set. It still internally refuses to
construct a string bigger than INT_MAX; the struct can't hold this and
even if we fix the struct, no other code, inside or outside the library,
can tolerate it. But now code which passes in a size_t (including our
own) can do so without overflow.

Bug: 428, 516
Change-Id: I17aa6971733f34dfda7d971882d0f062e92340e9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/54953
Commit-Queue: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Bob Beck <bbe@google.com>
2022-11-14 18:10:26 +00:00
Rebecca Chang Swee Fun b2d3c10cdc Clean up header to reuse __riscv definition
Change-Id: I3f7026b982f8503fd814be6feb99725f8e60b274
Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/54005
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2022-08-24 14:21:04 +00:00
Mao Han 45aadce331 Define NR_getrandom for riscv64
This syscall is required by generatekey in keystore.

Signed-off-by: Liu Cunyuan <liucunyuan.lcy@linux.alibaba.com>
Signed-off-by: Mao Han <han_mao@linux.alibaba.com>
Change-Id: I4dd0534daa6cfa52429e5bf398679fccb7d67e7f
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53765
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Adam Langley <agl@google.com>
2022-08-02 13:10:26 +00:00
Adam Langley 24c01865dc Expose the CTR_DRBG API.
Change-Id: Ie071dcd94d2ae8aa8ee148682f9b0054ed9e3501
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52445
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2022-07-26 21:25:34 +00:00
David Benjamin 0bfc9b32c4 Unexport all low-level policy machinery.
OpenSSL has a large exported API surface for exporting the policy tree
out of an X509_STORE_CTX. As far as I can tell, no one uses any of these
APIs. Remove them.

Update-Note: It is no longer possibly to see the policy tree after an
X.509 verification. As far as we can tell, this feature is unused.

Change-Id: Ieab374774805e90106555ce4e4155f8451ceb5b9
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53327
Reviewed-by: Bob Beck <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2022-07-15 01:48:13 +00:00
David Benjamin 955ef7991e Rewrite SSL_add_file_cert_subjects_to_stack
SSL_load_client_CA_file can just call
SSL_add_file_cert_subjects_to_stack.

SSL_add_file_cert_subjects_to_stack itself is rewritten to use scopers
and also give subquadratic running time. Sorting after every insertion
does not actually help. (It would have been faster to do a linear
search.) Instead, gather the names first, then sort and deduplicate.

Finally, add a SSL_add_bio_cert_subjects_to_stack. This is both to
simplify testing and because Envoy code copied from
SSL_add_file_cert_subjects_to_stack, complete with the quadratic
behavior. It is the only external project that depends on the
STACK_OF(T) comparison function. To simplify making that const-correct,
just export the function they needed anyway.

Bug: 498
Change-Id: I00d13c949a535c0d60873fe4ba2e5604bb585cca
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53007
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2022-06-15 17:31:42 +00:00
Rebecca Chang Swee Fun 4566bb5fe5 Add support for RISC-V 64-bit architecture
Signed-off-by: Rebecca Chang Swee Fun <rebecca.chang@starfivetech.com>
Change-Id: If6424a3b268943a5e2dc847f94b509d4b509df79
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52765
Commit-Queue: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@google.com>
2022-06-08 16:49:50 +00:00
David Benjamin 1530333b25 Remove X509_CRL_METHOD.
This has no callers, and seems to be practically unusable. The only way
to set an X509_CRL_METHOD is X509_CRL_set_default_method, which is not
thread-safe and globally affects the CRL implementation across the
application.

The comment says it's to handle large CRLs, so lots of processes don't
have to store the same CRL in memory. As far as I can tell,
X509_CRL_METHOD cannot be used to help with this. It doesn't swap out
storage of the CRL, just signature verification and lookup into it. But
by the time we call into X509_CRL_METHOD, the CRL has already been
downloaded and the data stored on the X509_CRL structure. (Perhaps this
made more sense before the structure was made opaque?)

Update-Note: APIs relating to X509_CRL_METHOD are removed.
Change-Id: Ia5befa2a0e4f4416c2fb2febecad99fa31c1c6ac
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52687
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
2022-05-24 15:22:39 +00:00