Crate scram_rs

Source
Expand description

Scram-RS (Sync and Async)

Provides a SASL SCRAM:

  • SHA1
  • SHA256
  • SHA512
  • -PLUS

Features:

  • default: “std”, “use_ring”

  • use_ring - adds crate: ring as an alternative hashing and other crypto functions.

  • exclude_sha1 - if enabled excludes the SHA1.

  • std - when set uses std lib, if removed, a no_std + alloc A program which includes this crate is based on standart library i.e std. For non-std an alloc crate is exported. Enabled by default. If CAPI was NOT excluded, and std was excluded, the crate will not be able to allocate memory in heap. For this reason, the set_allocator() should be called before using this crate in C program.

  • without_async - excludes the async code

  • without_capi - do not build CAPI code.

  • xor_without_u128 - do not use the u128 type while performing XOR of arrays

For default crypto crates: scram-rs = { version = “0.13”, default-features = true}

For ring crypto crates: scram-rs = { version = “0.13”, default-features = false, features = [“use_ring”]}

§scram_sha256_server() sync tests (DEBUG) on AMD Ryzen 5 7600X 6-Core Processor 5453 MHz

iterationrust-nativeuse_ring
130.481112ms7.813466ms

§scram_sha256_works() async tests (DEBUG)

iterationrust-nativeuse_ring
130.935835ms7.913466ms

For usage see ./examples/ For C usage see ./tests/

Files:

  • scram.rs contains client/server sync and async protocol handler
  • scram_sync.rs a synchronious realization of the protocol handler
  • scram_async.rs an asynchronious realization of the protocol handler
  • scram_parser.rs a scram message parser
  • scram_state.rs a global state of the protocol handler
  • scram_hashing.rs contains all supported hashers implementation
  • scram_error.rs error reporting code
  • scram_common.rs a common code
  • scram_cb.rs a channel bind code
  • scram_auth.rs a authentification callbacks and interface

Re-exports§

pub use scram_cb::ChannelBindType;
pub use scram_common::ScramTypes;
pub use scram::*;
pub use scram_auth::*;
pub use scram_common::*;
pub use scram_hashing::*;
pub use scram_error::*;
pub use scram_cbh::*;
pub use scram_dyn::*;

Modules§

c_api
In order to use the C_API, the scramrs.h file should be included in the C-file.
scram
scram_async
scram_auth
scram_cb
scram_cbh
scram_common
scram_dyn
scram_error
scram_hashing
scram_parser
scram_state
scram_sync
scram_sync_client
scram_sync_server

Macros§

HELPER_ERROR_CLIENT
Use this macro in functions of trais ScramCbHelper, AsyncScramCbHelper on client side in order to indicate that the data is not possible to retrive
HELPER_ERROR_SERVER
Use this macro in functions of trais ScramCbHelper, AsyncScramCbHelper on server side in order to indicate that the data is not possible to retrive
HELPER_UNSUP_CLIENT
Use this macro in functions of trais ScramCbHelper, AsyncScramCbHelper on client side in order to indicate that this type of channel bind is not supported!
HELPER_UNSUP_SERVER
Use this macro in functions of trais ScramCbHelper, AsyncScramCbHelper on server side in order to indicate that this type of channel bind is not supported!
capi_scram_err
capi_scram_err_map
capi_scram_err_res
scram_error
scram_error_map
scram_ierror
scram_ierror_map

Attribute Macros§

async_trait