Add re-exports for making inline functions available This CL adds a re-export for `CBS_init` and `CBS_len`, since these are declared as `OPENSSL_INLINE` and are thus unavailable currently since inline support is not yet merged. It also changes the existing wrappers for inline functions to re-exports too. Note: this is required to land the boringssl update in AOSP. Test: m checkbuild Change-Id: Ic6e2927d7a79b788a4ed0380cf27b3557b6f6f64 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/68327 Reviewed-by: David Benjamin <davidben@google.com> Reviewed-by: Matthew Maurer <mmaurer@google.com> Commit-Queue: Ellen Arteca <emarteca@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/rust/bssl-sys/rust_wrapper.c b/rust/bssl-sys/rust_wrapper.c index d5419a9..d77bc34 100644 --- a/rust/bssl-sys/rust_wrapper.c +++ b/rust/bssl-sys/rust_wrapper.c
@@ -26,3 +26,11 @@ int ERR_GET_FUNC_RUST(uint32_t packed_error) { return ERR_GET_FUNC(packed_error); } + +void CBS_init_RUST(CBS *cbs, const uint8_t *data, size_t len) { + CBS_init(cbs, data, len); +} + +size_t CBS_len_RUST(const CBS *cbs) { + return CBS_len(cbs); +}
diff --git a/rust/bssl-sys/rust_wrapper.h b/rust/bssl-sys/rust_wrapper.h index 55d5a6f..060bf7e 100644 --- a/rust/bssl-sys/rust_wrapper.h +++ b/rust/bssl-sys/rust_wrapper.h
@@ -16,6 +16,7 @@ #define OPENSSL_HEADER_RUST_WRAPPER_H #include <openssl/err.h> +#include <openssl/bytestring.h> #if defined(__cplusplus) extern "C" { @@ -30,7 +31,8 @@ int ERR_GET_LIB_RUST(uint32_t packed_error); int ERR_GET_REASON_RUST(uint32_t packed_error); int ERR_GET_FUNC_RUST(uint32_t packed_error); - +void CBS_init_RUST(CBS *cbs, const uint8_t *data, size_t len); +size_t CBS_len_RUST(const CBS *cbs); #if defined(__cplusplus) } // extern C
diff --git a/rust/bssl-sys/src/lib.rs b/rust/bssl-sys/src/lib.rs index e7f5fc4..1d43e14 100644 --- a/rust/bssl-sys/src/lib.rs +++ b/rust/bssl-sys/src/lib.rs
@@ -48,22 +48,11 @@ // TODO(crbug.com/boringssl/596): Remove these wrappers. #[cfg(unsupported_inline_wrappers)] -pub fn ERR_GET_LIB(packed_error: u32) -> i32 { - // Safety: This is safe for all inputs. bindgen conservatively marks everything unsafe. - unsafe { ERR_GET_LIB_RUST(packed_error) } -} - -#[cfg(unsupported_inline_wrappers)] -pub fn ERR_GET_REASON(packed_error: u32) -> i32 { - // Safety: This is safe for all inputs. bindgen conservatively marks everything unsafe. - unsafe { ERR_GET_REASON_RUST(packed_error) } -} - -#[cfg(unsupported_inline_wrappers)] -pub fn ERR_GET_FUNC(packed_error: u32) -> i32 { - // Safety: This is safe for all inputs. bindgen conservatively marks everything unsafe. - unsafe { ERR_GET_FUNC_RUST(packed_error) } -} +pub use { ERR_GET_LIB_RUST as ERR_GET_LIB, + ERR_GET_REASON_RUST as ERR_GET_REASON, + ERR_GET_FUNC_RUST as ERR_GET_FUNC, + CBS_init_RUST as CBS_init, + CBS_len_RUST as CBS_len }; pub fn init() { // Safety: `CRYPTO_library_init` may be called multiple times and concurrently.