Skip to main content

Crate scram_rs

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.

  • with_async - insludes async code

  • with_capi - includes 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_hashing_sha1::ScramSha1Ring;
pub use scram_hashing_sha1::ScramSha1RustNative;
pub use scram_hashing_sha2::ScramSha256Ring;
pub use scram_hashing_sha2::ScramSha256RustNative;
pub use scram_hashing_sha3_5::ScramSha3_512RustNative;
pub use scram_hashing_sha5::ScramSha512Ring;
pub use scram_hashing_sha5::ScramSha512RustNative;
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§

scram
A common items for the whole crate which is related to SCRAM.
scram_async
Async code client/server.
scram_auth
A helpers for auth.
scram_cb
A common code for channel binding protocol.
scram_cbh
Channel binding helper for sync code.
scram_common
A common code which is not related to SCRAM.
scram_dyn
A dynamic instancing for sync client/server.
scram_error
Crate’s error alias.
scram_hashing
A hashing algorithms.
scram_hashing_sha1
SHA1
scram_hashing_sha2
SHA256
scram_hashing_sha5
SHA512
scram_hashing_sha3_5
SHA3-512
scram_sync
Sync code client/server.
scram_sync_client
Sync client.
scram_sync_server
Sync server.

Macros§

HELPER_ERROR_CLIENT
Use this macro in functions of trais ScramCbHelper, crate::scram_async::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, crate::scram_async::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, crate::scram_async::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, crate::scram_async::AsyncScramCbHelper on server side in order to indicate that this type of channel bind is not supported!
scram_error
scram_error_map
scram_ierror
scram_ierror_map

Attribute Macros§

async_trait