You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-18
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ A Robust Rust Library for CRYSTALS-Kyber Post-Quantum Cryptography.
30
30
31
31
## Overview 📖
32
32
33
-
KyberLib is a robust Rust library designed for CRYSTALS-Kyber Post-Quantum Cryptography, offering strong security guarantees. This library is compatible with `no_std`, making it suitable for embedded devices and avoids memory allocations. Additionally, it contains reference implementations with no unsafe code and provides an optimized AVX2 version by default on x86_64 platforms. You can also compile it to WebAssembly (WASM) using wasm-bindgen.
33
+
KyberLib is a robust Rust library designed for **CRYSTALS-Kyber Post-Quantum Cryptography**, offering strong security guarantees. This library is compatible with `no_std`, making it suitable for embedded devices and avoids memory allocations. Additionally, it contains reference implementations with no unsafe code and provides an optimized AVX2 version by default on x86_64 platforms. You can also compile it to WebAssembly (WASM) using wasm-bindgen.
34
34
35
35
## Features ✨
36
36
@@ -105,6 +105,8 @@ For optimisations on x86 platforms enable the `avx2` feature and the following R
The KyberLib crate provides several macros to simplify common cryptographic operations:
175
177
176
-
-`kyberlib_assert!`: Asserts that a given expression is true. Panics if the assertion fails.
177
-
-`kyberlib_min!`: Returns the minimum of the given values.
178
-
-`kyberlib_max!`: Returns the maximum of the given values.
179
-
-`kyberlib_generate_key_pair!`: Generates a public and private key pair for CCA-secure Kyber key encapsulation mechanism.
180
-
-`kyberlib_encrypt_message!`: Generates cipher text and a shared secret for a given public key.
181
-
-`kyberlib_decrypt_message!`: Generates a shared secret for a given cipher text and private key.
182
-
-`kyberlib_uake_client_init!`: Initiates a Unilaterally Authenticated Key Exchange.
183
-
-`kyberlib_uake_server_receive!`: Handles the output of a `kyberlib_uake_client_init()` request.
184
-
-`kyberlib_uake_client_confirm!`: Decapsulates and authenticates the shared secret from the output of `kyberlib_uake_server_receive()`.
185
-
-`kyberlib_ake_client_init!`: Initiates a Mutually Authenticated Key Exchange.
186
-
-`kyberlib_ake_server_receive!`: Handles and authenticates the output of a `kyberlib_ake_client_init()` request.
187
-
-`kyberlib_ake_client_confirm!`: Decapsulates and authenticates the shared secret from the output of `kyberlib_ake_server_receive()`.
188
-
189
-
See the [macros module documentation](https://docs.rs/kyberlib/latest/kyberlib/macros/index.html) for more details and usage examples.
178
+
-[`kyberlib_generate_key_pair!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_generate_key_pair.html): Generates a public and private key pair for CCA-secure Kyber key encapsulation mechanism.
179
+
180
+
-[`kyberlib_encrypt_message!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_encrypt_message.html): Generates cipher text and a shared secret for a given public key.
181
+
182
+
-[`kyberlib_decrypt_message!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_decrypt_message.html): Generates a shared secret for a given cipher text and private key.
183
+
184
+
-[`kyberlib_uake_client_init!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_client_init.html): Initiates a Unilaterally Authenticated Key Exchange.
185
+
186
+
-[`kyberlib_uake_server_receive!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_server_receive.html): Handles the output of a `kyberlib_uake_client_init()` request.
187
+
188
+
-[`kyberlib_uake_client_confirm!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_client_confirm.html): Decapsulates and authenticates the shared secret from the output of `kyberlib_uake_server_receive()`.
189
+
190
+
-[`kyberlib_ake_client_init!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_ake_client_init.html): Initiates a Mutually Authenticated Key Exchange.
191
+
192
+
-[`kyberlib_ake_server_receive!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_server_receive.html): Handles and authenticates the output of a `kyberlib_ake_client_init()` request.
193
+
194
+
-[`kyberlib_ake_client_confirm!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_ake_client_confirm.html): Decapsulates and authenticates the shared secret from the output of `kyberlib_ake_server_receive()`.
195
+
196
+
See the [macros module documentation](https://docs.rs/kyberlib/latest/kyberlib/index.html#macros) for more details and usage examples.
190
197
191
198
## Errors
192
199
193
200
The KyberLibError enum has two variants:
194
201
195
202
-**InvalidInput** - One or more inputs to a function are incorrectly sized. A possible cause of this is two parties using different security levels while trying to negotiate a key exchange.
203
+
-**InvalidKey** - Error when generating keys.
196
204
-**Decapsulation** - The ciphertext was unable to be authenticated. The shared secret was not decapsulated.
197
-
-**RandomBytesGeneration** - Error trying to fill random bytes (i.e external (hardware) RNG modules can fail).
205
+
-**RandomBytesGeneration** - Error trying to fill random bytes (i.e., external (hardware) RNG modules can fail).
198
206
199
207
## Examples
200
208
@@ -281,7 +289,6 @@ A special thank you goes to the [Rust Reddit][12] community for
281
289
providing a lot of useful suggestions on how to improve this project.
282
290
283
291
[00]: https://kyberlib.com/"KyberLib, A Robust Rust Library for CRYSTALS-Kyber Post-Quantum Cryptography"
Copy file name to clipboardExpand all lines: src/lib.rs
+24-17
Original file line number
Diff line number
Diff line change
@@ -122,27 +122,34 @@
122
122
//!
123
123
//! The KyberLib crate provides several macros to simplify common cryptographic operations:
124
124
//!
125
-
//! - `kyberlib_assert!`: Asserts that a given expression is true. Panics if the assertion fails.
126
-
//! - `kyberlib_min!`: Returns the minimum of the given values.
127
-
//! - `kyberlib_max!`: Returns the maximum of the given values.
128
-
//! - `kyberlib_generate_key_pair!`: Generates a public and private key pair for CCA-secure Kyber key encapsulation mechanism.
129
-
//! - `kyberlib_encrypt_message!`: Generates cipher text and a shared secret for a given public key.
130
-
//! - `kyberlib_decrypt_message!`: Generates a shared secret for a given cipher text and private key.
131
-
//! - `kyberlib_uake_client_init!`: Initiates a Unilaterally Authenticated Key Exchange.
132
-
//! - `kyberlib_uake_server_receive!`: Handles the output of a `kyberlib_uake_client_init()` request.
133
-
//! - `kyberlib_uake_client_confirm!`: Decapsulates and authenticates the shared secret from the output of `kyberlib_uake_server_receive()`.
134
-
//! - `kyberlib_ake_client_init!`: Initiates a Mutually Authenticated Key Exchange.
135
-
//! - `kyberlib_ake_server_receive!`: Handles and authenticates the output of a `kyberlib_ake_client_init()` request.
136
-
//! - `kyberlib_ake_client_confirm!`: Decapsulates and authenticates the shared secret from the output of `kyberlib_ake_server_receive()`.
137
-
//!
138
-
//! See the [macros module documentation](https://docs.rs/kyberlib/latest/kyberlib/macros/index.html) for more details and usage examples.
125
+
//! - [`kyberlib_generate_key_pair!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_generate_key_pair.html): Generates a public and private key pair for CCA-secure Kyber key encapsulation mechanism.
126
+
//!
127
+
//! - [`kyberlib_encrypt_message!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_encrypt_message.html): Generates cipher text and a shared secret for a given public key.
128
+
//!
129
+
//! - [`kyberlib_decrypt_message!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_decrypt_message.html): Generates a shared secret for a given cipher text and private key.
130
+
//!
131
+
//! - [`kyberlib_uake_client_init!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_client_init.html): Initiates a Unilaterally Authenticated Key Exchange.
132
+
//!
133
+
//! - [`kyberlib_uake_server_receive!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_server_receive.html): Handles the output of a `kyberlib_uake_client_init()` request.
134
+
//!
135
+
//! - [`kyberlib_uake_client_confirm!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_client_confirm.html): Decapsulates and authenticates the shared secret from the output of `kyberlib_uake_server_receive()`.
136
+
//!
137
+
//! - [`kyberlib_ake_client_init!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_ake_client_init.html): Initiates a Mutually Authenticated Key Exchange.
138
+
//!
139
+
//! - [`kyberlib_ake_server_receive!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_uake_server_receive.html): Handles and authenticates the output of a `kyberlib_ake_client_init()` request.
140
+
//!
141
+
//! - [`kyberlib_ake_client_confirm!`](https://docs.rs/kyberlib/latest/kyberlib/macro.kyberlib_ake_client_confirm.html): Decapsulates and authenticates the shared secret from the output of `kyberlib_ake_server_receive()`.
142
+
//!
143
+
//! See the [macros module documentation](https://docs.rs/kyberlib/latest/kyberlib/index.html#macros) for more details and usage examples.
139
144
//!
140
145
//! ## Errors
141
146
//!
142
-
//! The [KyberLibError](enum.KyberLibError.html) enum handles errors with two variants:
147
+
//! The [KyberLibError](https://docs.rs/kyberlib/latest/kyberlib/error/enum.KyberLibError.html) enum handles errors with two variants:
143
148
//!
144
-
//! - **InvalidInput**: Occurs when one or more byte inputs to a function are incorrectly sized. This typically happens when two parties use different security levels while attempting to negotiate a key exchange.
145
-
//! - **Decapsulation**: This error indicates that the ciphertext could not be authenticated, and the shared secret was not successfully decapsulated.
149
+
//! - **InvalidInput** - One or more inputs to a function are incorrectly sized. A possible cause of this is two parties using different security levels while trying to negotiate a key exchange.
150
+
//! - **InvalidKey** - Error when generating keys.
151
+
//! - **Decapsulation** - The ciphertext was unable to be authenticated. The shared secret was not decapsulated.
152
+
//! - **RandomBytesGeneration** - Error trying to fill random bytes (i.e., external (hardware) RNG modules can fail).
0 commit comments