Use X509_PURPOSE_get_id instead of struct access#2115
Use X509_PURPOSE_get_id instead of struct access#2115alex merged 2 commits intorust-openssl:masterfrom
Conversation
The accessor was added at the same version as the struct, so better to just use it. As with X509_PURPOSE_get_by_sname, it was const-corrected later on.
|
Yeah, we should really keep the struct definition as-is to preserve back compat. If you want, we could make it opaque for future open/boring/libre releases though. |
|
We will never, ever support using the handwritten bindings with BoringSSL because of memory safety, so I can just put it back. Though you all really should rethink the stability expectations there. |
|
On Sat, Dec 02, 2023 at 01:53:35PM -0800, Steven Fackler wrote:
Yeah, we should really keep the struct definition as-is to preserve back compat. If you want, we could make it opaque for future open/boring/libre releases though.
I think this is the least that should be done. The xstandard[] table
containing the standard purposes is static but not const in all three
libraries (I plan on changing that in libre).
X509_PURPOSE_get0() returns a pointer to it (or worse application
configured global mutable state if someone called X509_PURPOSE_add()),
so X509PurposeRef::from_idx() exposes a pointer to global mutable state
to Rust.
|
Oh, the entire X509PurposeRef API should be removed. It makes no sense in the first place. This is just the usual issue where binding APIs without thinking through use cases leads to problems. The only thing one can do with That means the only APIs here that made sense were the built-in |
BoringSSL will be doing that too. Note that, similar to #2113, it may run into a design flaw in foreign-types. From talking with @alex, it sounds like that crate uses exclusively I think I'll also just remove the APIs that |
The accessor was added at the same version as the struct, so better to just use it. As with X509_PURPOSE_get_by_sname, it was const-corrected later on.