diff options
| author | Rusty Wagner <rusty@vector35.com> | 2021-01-25 16:45:06 -0500 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2021-01-27 18:39:42 -0500 |
| commit | 12f916450b444427685688bf34de65e11bf849e2 (patch) | |
| tree | bd13651d872c1fc7ad5933e9a38a77da82235cd3 /rust/src | |
| parent | 51d0f18eb4df16263867ef157b5293bb1b44f77a (diff) | |
Add ABI version verification for plugins
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/lib.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/rust/src/lib.rs b/rust/src/lib.rs index bdef8368..3d287321 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -215,3 +215,25 @@ pub mod logger { pub fn version() -> string::BnString { unsafe { string::BnString::from_raw(binaryninjacore_sys::BNGetVersionString()) } } + +pub fn plugin_abi_version() -> u32 { + binaryninjacore_sys::BN_CURRENT_CORE_ABI_VERSION +} + +pub fn plugin_abi_minimum_version() -> u32 { + binaryninjacore_sys::BN_MINIMUM_CORE_ABI_VERSION +} + +pub fn core_abi_version() -> u32 { + unsafe { binaryninjacore_sys::BNGetCurrentCoreABIVersion() } +} + +pub fn core_abi_minimum_version() -> u32 { + unsafe { binaryninjacore_sys::BNGetMinimumCoreABIVersion() } +} + +// Provide ABI version automatically so that the core can verify binary compatibility +#[cfg(not(feature = "headless"))] +#[no_mangle] +#[allow(non_snake_case)] +pub extern "C" fn CorePluginABIVersion() -> u32 { plugin_abi_version() } |
