Skip to content

Commit

Permalink
fixup! fixup! Support cryptography module
Browse files Browse the repository at this point in the history
  • Loading branch information
InfoHunter committed Jun 14, 2024
1 parent 8169d79 commit b02bbd3
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/modules/crypto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,57 @@
//!
//! This module depends on underlying cryptography library. One crypto adaptors MUST be specified
//! during the configuration, then it's compiled into RustyVault.
//!
//! # Crypto Adaptor Configurations
//!
//! In RustyVault, the real cryptographic operations are done via "crypto_adaptor"s.
//!
//! A crypto adaptor is a module that conveys and translates high level cryptography
//! operations like encryption, signing into the APIs provided by underlying cryptography
//! libraries such as OpenSSL, Tongsuo and so forth.
//!
//! At current stage, only one crypto_adaptor can be enabled at compilation phase and later
//! be used at run-time. "crypto_adaptor"s are configured as 'feature's in the Cargo context.
//!
//! Currently, the supported feature names of crypto adaptors are as follows, you can enable
//! them by adding one '--features crypto_adaptor_name' option when running "cargo build":
//!
//! 1. the OpenSSL adaptor: crypto_adaptor_openssl
//! 2. the Tongsuo adaptor: crypto_adaptor_tongsuo
//!
//! If there is no explicit crypto adpator configured, then the `crypto_adaptor_openssl` is used as
//! the default option.
//!
//! # Enable the Tongsuo adaptor
//!
//! Tongsuo is a variant of OpenSSL but with more features on SMx algorithms and protocols.
//! RustyVault can use SM algorithms only if Tongsuo is built as the crypto adaptor.
//!
//! You need to build and install Tongsuo first into your local environment before building
//! RustyVault with Tongsuo. Check the following link for detailed installation steps:
//! [Tongsuo](https://github.com/Tongsuo-Project/Tongsuo)
//!
//! ~~~text
//! $ export OPENSSL_DIR=/path/to/tongsuo/install/directory
//! $ cargo build --features crypto_adaptor_tongsuo \
//! --no-default-features \
//! --config 'patch.crates-io.openssl.git="https://github.com/Tongsuo-Project/rust-tongsuo.git"'\
//! --config 'patch.crates-io.openssl-sys.git="https://github.com/Tongsuo-Project/rust-tongsuo.git"'
//! ~~~
//!
//! Or you can just uncomment the following lines in Cargo.toml:
//!
//! ~~~text
//! #[patch.crates-io]
//! #openssl = { git = "https://github.com/Tongsuo-Project/rust-tongsuo.git" }
//! #openssl-sys = { git = "https://github.com/Tongsuo-Project/rust-tongsuo.git" }
//! ~~~
//!
//! and then:
//!
//! ~~~text
//! $ cargo build --features crypto_adaptor_tongsuo --no-default-features
//! ~~~

use crate::errors::RvError;
#[cfg(feature = "crypto_adaptor_openssl")]
Expand Down

0 comments on commit b02bbd3

Please sign in to comment.