Generates "low-level" bindings for Rust using bindgen This is designed to be the minimal infrastructure required to support using BoringSSL in the Rust ecosystem without fear of ABI drift. Bindgen is used to generate Rust bindings in lockstep with the rest of the build. `rust-openssl` can consume these generated bindings with minimal changes. Change-Id: I1dacd36a4131e22a930ebb01da00407e8465ad7e Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/49645 Reviewed-by: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..d8c2c00 --- /dev/null +++ b/rust/src/lib.rs
@@ -0,0 +1,22 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +// populated by cmake +${INCLUDES} + +pub fn ERR_GET_LIB(packed_error: u32) -> i32 { + unsafe { ERR_GET_LIB_RUST(packed_error) } +} + +pub fn ERR_GET_REASON(packed_error: u32) -> i32 { + unsafe { ERR_GET_REASON_RUST(packed_error) } +} + +pub fn ERR_GET_FUNC(packed_error: u32) -> i32 { + unsafe { ERR_GET_FUNC_RUST(packed_error) } +} + +pub fn init() { + unsafe { CRYPTO_library_init(); } +}