aboutsummaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
authorEllen Arteca <emarteca@google.com>2024-05-08 22:15:14 +0000
committerBoringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>2024-05-09 19:58:46 +0000
commit4d50a595b49a2e7b7017060a4d402c4ee9fe28a2 (patch)
tree0d34d8ecea82438c71f6da90f2683be04e41f1ab /rust
parentd34f540e57394de22a1599c3c5d852519d388d6c (diff)
downloadboringssl-4d50a595b49a2e7b7017060a4d402c4ee9fe28a2.zip
boringssl-4d50a595b49a2e7b7017060a4d402c4ee9fe28a2.tar.gz
boringssl-4d50a595b49a2e7b7017060a4d402c4ee9fe28a2.tar.bz2
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>
Diffstat (limited to 'rust')
-rw-r--r--rust/bssl-sys/rust_wrapper.c8
-rw-r--r--rust/bssl-sys/rust_wrapper.h4
-rw-r--r--rust/bssl-sys/src/lib.rs21
3 files changed, 16 insertions, 17 deletions
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_REASON_RUST(uint32_t packed_error) {
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 @@ extern "C" {
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 @@ pub const XN_FLAG_ONELINE: c_ulong = bindgen::XN_FLAG_ONELINE as c_ulong;
// 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.