18 releases (11 stable)

Uses old Rust 2015

1.3.2 Jun 11, 2022
1.3.1 Feb 17, 2022
1.3.0 Dec 8, 2021
1.2.0 Sep 26, 2021
0.1.0 Mar 31, 2018

⚠️ Issues reported

#623 in Cryptography

Download history 704/week @ 2024-07-22 459/week @ 2024-07-29 534/week @ 2024-08-05 347/week @ 2024-08-12 473/week @ 2024-08-19 351/week @ 2024-08-26 610/week @ 2024-09-02 440/week @ 2024-09-09 94/week @ 2024-09-16 241/week @ 2024-09-23 121/week @ 2024-09-30 80/week @ 2024-10-07 92/week @ 2024-10-14 43/week @ 2024-10-21 50/week @ 2024-10-28 97/week @ 2024-11-04

284 downloads per month
Used in 4 crates (via olm-rs)

Apache-2.0

1.5MB
28K SLoC

C++ 10K SLoC // 0.1% comments C 7.5K SLoC // 0.2% comments Java 3K SLoC // 0.3% comments Objective-C 2K SLoC // 0.1% comments Python 2K SLoC // 0.4% comments JavaScript 2K SLoC // 0.1% comments Rust 2K SLoC // 0.0% comments GDB Script 120 SLoC Shell 106 SLoC // 0.2% comments TypeScript 103 SLoC // 0.1% comments Batch 93 SLoC Swift 48 SLoC INI 30 SLoC GNU Style Assembly 7 SLoC Forge Config 7 SLoC

Contains (Windows DLL, 130KB) olm/lib/ed25519/ed25519_32.dll, (Windows DLL, 115KB) olm/lib/ed25519/ed25519_64.dll, (JAR file, 54KB) gradle-wrapper.jar

olm-sys: Low Level Bindings For Olm

This is an intermediate crate that exposes the C API of libolm to Rust. If you want to start building things with libolm from Rust, check out olm-rs.

Supported Platforms

  • Android
  • Linux
  • macOS
  • Windows
  • FreeBSD
  • WebAssembly

Building

This library can either be built by statically or dynamically linking against libolm:

Static

This is the default and requires no further action. libolm is built locally and then linked against statically.

Build dependencies

  • libstdc++/libc++
  • cmake (requires v3.12)
  • GNU make or a compatible variant (WebAssembly only)
  • Emscripten (WebAssembly only)

Dynamic

For linking against libolm dynamically, first make sure that you have the library in your link path. Then build this library with the OLM_LINK_VARIANT environment variable set to dylib.

For example, building your project using olm-sys as a dependency would look like this:

$ OLM_LINK_VARIANT=dylib cargo build

Cross compiling for Android

To enable cross compilation for Android set the environment variable ANDROID_NDK to the location of your NDK installation, for example:

$ ANRDOID_NDK=/home/user/Android/Sdk/ndk/22.0.7026061/

The linker needs to be set to an target specific one as well, for example for aarch64-linux-android set this into your cargo config:

[target.aarch64-linux-android]
ar = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/ar"
linker = "/home/user/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android30-clang"

After both of these are set, compilation should work as usual using cargo:

$ ANDROID_NDK=~/Android/Sdk/ndk/22.0.7026061 cargo build --target aarch64-linux-android

Cross compiling for iOS

To enable cross compilation for iOS, set the environment variable IOS_SDK_PATH to the iOS SDK location by running:

$ export IOS_SDK_PATH=`xcrun --show-sdk-path --sdk iphoneos`

Dependencies