commit | 2d4f1b85f270fe6fc15dfd39a40015f52972ea2e | [log] [tgz] |
---|---|---|
author | David Benjamin <davidben@google.com> | Mon May 23 14:56:15 2022 -0400 |
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | Wed May 25 16:48:39 2022 +0000 |
tree | 513845885b7b094dd664ae9c5224339833a0534b | |
parent | 1530333b25589ee4d4d52b10e78ee55dd82f6dcd [diff] |
Use the correct function types in X509V3_EXT_METHODs. While C allows function pointer casts, it is UB to call a function with a different type than its actual type signature. That is, even though `void f(int *)` and `void g(void *)` have the same ABI, it is UB to cast `f` to a `void(*)(void *)` and then call it through that pointer. Clang CFI will try to enforce this rule. The recent CL to call X509_print in tests revealed that all the i2? and ?2i callbacks in X509V3_EXT_METHODs were implemented with functions of the wrong type, out of some combination of missing consts and void* turned into T*. This CL fixes this. Where the function wasn't exported, or had no callers, I just fixed the function itself. Where it had extension callers, I added a wrapper function with a void* type. I'm not positive whether the wrappers are the right call. On the one hand, keeping the exported functions as-is is more type-safe and more OpenSSL-compatible. However, most (but not all) uses of these are in other code defining X509V3_EXT_METHODs themselves, so the void* signature is more correct for them too. And the functions have a type signature meant for X509V3_EXT_METHOD, complete with method pointer. I've gone with leaving the exported ones as-is for now. Probably the right answer anyway is to migrate the external callers, of either type signature. Change-Id: Ib8f2995cbd890221eaa9ac864a7e553cb6711901 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/52686 Commit-Queue: Bob Beck <bbe@google.com> Reviewed-by: Bob Beck <bbe@google.com>
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:
There are other files in this directory which might be helpful: