Giter Site home page Giter Site logo

landhb / linux-keyutils Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 4.0 66 KB

Rust interface to the Linux key-management facility. Provides a safe interface around the raw system calls allowing user-space programs to perform key manipulation.

Rust 100.00%
ffi keyring keyutils linux rust-ffi rust-ffi-wrappers

linux-keyutils's Introduction

linux-keyutils

cargo-badge-lib docs-badge-lib license-badge rust-version-badge build codecov

Rust interface to the Linux key-management facility. Provides a safe interface around the raw system calls allowing user-space programs to perform key manipulation.

There is a good cloudflare blog discussing why it should be used.

Basic Usage

To use linux-keyutils, first add this to your Cargo.toml:

[dependencies]
linux-keyutils = "0.2"

For more information please view the full documentation. There is also a small example program in the examples directory.

Features

  • #![no_std] by default.
  • For std programs KeyError implements std::error::Error when the std feature of this crate enabled.
  • Small footprint, the library only relies on the libc and bitflags crates.

License

Licensed under either of the following at your discretion:

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.

linux-keyutils's People

Contributors

landhb avatar vorpalblade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

linux-keyutils's Issues

Doesn't compile on some 32-bit Linux platforms

For example on i686-unknown-linux-musl

error[E0308]: mismatched types
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/linux-keyutils-0.2.2/src/keyring.rs:31:13
   |
31 |             u64::from(create)
   |             ^^^^^^^^^^^^^^^^^ expected `u32`, found `u64`
   |
  ::: /root/.cargo/registry/src/github.com-1ecc6299db9ec823/linux-keyutils-0.2.2/src/ffi/mod.rs:13:9
   |
13 |         $crate::ffi::keyctl_impl($op, $a2, $a3, 0, 0)
   |         ------------------------ arguments to this function are incorrect
   |
note: function defined here
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/linux-keyutils-0.2.2/src/ffi/functions.rs:64:15
   |
64 | pub(crate) fn keyctl_impl(
   |               ^^^^^^^^^^^
...
67 |     arg3: libc::c_ulong,
   |     -------------------


error[E0277]: the trait bound `types::KeySerialId: From<u32>` is not satisfied
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/linux-keyutils-0.2.2/src/keyring.rs:33:10
   |
33 |         .try_into()
   |          ^^^^^^^^ the trait `From<u32>` is not implemented for `types::KeySerialId`
   |
   = note: required for `u32` to implement `Into<types::KeySerialId>`
   = note: required for `types::KeySerialId` to implement `TryFrom<u32>`
   = note: required for `u32` to implement `TryInto<types::KeySerialId>`


error[E0277]: the trait bound `types::KeySerialId: From<u32>` is not satisfied
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/linux-keyutils-0.2.2/src/keyring.rs:63:10
   |
63 |         .try_into()
   |          ^^^^^^^^ the trait `From<u32>` is not implemented for `types::KeySerialId`
   |
   = note: required for `u32` to implement `Into<types::KeySerialId>`
   = note: required for `types::KeySerialId` to implement `TryFrom<u32>`
   = note: required for `u32` to implement `TryInto<types::KeySerialId>`


error[E0277]: the trait bound `types::KeySerialId: From<u32>` is not satisfied
   --> /root/.cargo/registry/src/github.com-1ecc[629](https://github.com/PyO3/maturin/actions/runs/4268683584/jobs/7431347988#step:4:630)9db9ec823/linux-keyutils-0.2.2/src/keyring.rs:121:10
    |
121 |         .try_into()
    |          ^^^^^^^^ the trait `From<u32>` is not implemented for `types::KeySerialId`
    |
    = note: required for `u32` to implement `Into<types::KeySerialId>`
    = note: required for `types::KeySerialId` to implement `TryFrom<u32>`
    = note: required for `u32` to implement `TryInto<types::KeySerialId>`


error: aborting due to 4 previous errors


Some errors have detailed explanations: E0277, E0308.

For more information about an error, try `rustc --explain E0277`.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.