Skip to content

Commit c73a47b

Browse files
committed
address review comments
* no devcontainer files * fix ML-KEM-768 reference * fix cargo fmt * fix cargo doc * try --test-threads=1 for MacOS to see test if it helps
1 parent 3b9c892 commit c73a47b

File tree

5 files changed

+17
-33
lines changed

5 files changed

+17
-33
lines changed

.devcontainer/devcontainer.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: ilammy/setup-nasm@72793074d3c8cdda771dba85f6deafe00623038b # 1.5.2
3333

3434
- name: Run tests
35-
run: cargo test --workspace --verbose --all-features --no-fail-fast
35+
run: cargo test --workspace --verbose --all-features --no-fail-fast ${{ runner.os == 'macOS' && '-- --test-threads=1' || '' }}
3636

3737
miri:
3838
name: Miri

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The `cryprot` crates implement several **cryp**tographic **prot**ocols and utili
1111
| [`cryprot-net`] | Networking abstractions built atop [s2n-quic](https://docs.rs/s2n-quic/latest/s2n_quic/). | [![crates.io](https://img.shields.io/crates/v/cryprot-net)](https://crates.io/crates/cryprot-net) | [![docs.rs](https://img.shields.io/docsrs/cryprot-net)](https://docs.rs/cryprot-net) |
1212
| [`cryprot-pprf`] | Distributed PPRF implementation used in Silent OT [[BCG+19]](https://eprint.iacr.org/2019/1159), based on [libOTe](https://github.com/osu-crypto/libOTe). | [![crates.io](https://img.shields.io/crates/v/cryprot-pprf)](https://crates.io/crates/cryprot-pprf) | [![docs.rs](https://img.shields.io/docsrs/cryprot-pprf)](https://docs.rs/cryprot-pprf) |
1313
| [`cryprot-codes`] | Expand-convolute linear code [[RRT23]](https://eprint.iacr.org/2023/882), based on [libOTe](https://github.com/osu-crypto/libOTe), used in Silent OT. | [![crates.io](https://img.shields.io/crates/v/cryprot-codes)](https://crates.io/crates/cryprot-codes) | [![docs.rs](https://img.shields.io/docsrs/cryprot-codes)](https://docs.rs/cryprot-codes) |
14-
| [`cryprot-ot`] | Oblivious transfer implementations:<br>• Base OT: "Simplest OT" [[CO15]](https://eprint.iacr.org/2015/267)<br>• Base OT (post-quantum, optional): [ML-KEM-768](https://crates.io/crates/ml-kem) based OT [[FIPS 203]](https://csrc.nist.gov/pubs/fips/203/final)<br>• OT extensions: [[IKNP03]](https://www.iacr.org/archive/crypto2003/27290145/27290145.pdf)<br>• Malicious OT extension: [[KOS15]](https://eprint.iacr.org/2015/546.pdf)<br>• Silent OT extension: [[BCG+19]](https://eprint.iacr.org/2019/1159) Silent OT using [[RRT23]](https://eprint.iacr.org/2023/882) code and optional [[YWL+20]](https://dl.acm.org/doi/pdf/10.1145/3372297.3417276) consistency check for malicious security. | [![crates.io](https://img.shields.io/crates/v/cryprot-ot)](https://crates.io/crates/cryprot-ot) | [![docs.rs](https://img.shields.io/docsrs/cryprot-ot)](https://docs.rs/cryprot-ot) |
14+
| [`cryprot-ot`] | Oblivious transfer implementations:<br>• Base OT: "Simplest OT" [[CO15]](https://eprint.iacr.org/2015/267)<br>• Base OT (post-quantum, optional): [ML-KEM](https://crates.io/crates/ml-kem) based OT [[FIPS 203]](https://csrc.nist.gov/pubs/fips/203/final)<br>• OT extensions: [[IKNP03]](https://www.iacr.org/archive/crypto2003/27290145/27290145.pdf)<br>• Malicious OT extension: [[KOS15]](https://eprint.iacr.org/2015/546.pdf)<br>• Silent OT extension: [[BCG+19]](https://eprint.iacr.org/2019/1159) Silent OT using [[RRT23]](https://eprint.iacr.org/2023/882) code and optional [[YWL+20]](https://dl.acm.org/doi/pdf/10.1145/3372297.3417276) consistency check for malicious security. | [![crates.io](https://img.shields.io/crates/v/cryprot-ot)](https://crates.io/crates/cryprot-ot) | [![docs.rs](https://img.shields.io/docsrs/cryprot-ot)](https://docs.rs/cryprot-ot) |
1515

1616
Documentation for the latest main branch state is available [here](https://robinhundt.github.io/CryProt/cryprot_ot/).
1717
## Platform Support

cryprot-ot/src/lib.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#![warn(clippy::unwrap_used)]
22
//! CryProt-OT implements several [oblivious transfer](https://en.wikipedia.org/wiki/Oblivious_transfer) protocols.
33
//!
4-
//! - base OT: "Simplest OT" [[CO15](https://eprint.iacr.org/2015/267)] (classical security)
5-
//! - post-quantum base OT: ML-KEM-768 based OT [[MR19](https://eprint.iacr.org/2019/706)] (post-quantum security)
4+
//! - base OT: "Simplest OT" [[CO15](https://eprint.iacr.org/2015/267)]
5+
//! (classical security)
6+
//! - post-quantum base OT: ML-KEM-768 based OT [[MR19](https://eprint.iacr.org/2019/706)]
7+
//! (post-quantum security)
68
//! - semi-honest OT extension: optimized [[IKNP03](https://www.iacr.org/archive/crypto2003/27290145/27290145.pdf)]
79
//! protocol
810
//! - malicious OT extension: optimized [[KOS15](https://eprint.iacr.org/2015/546.pdf)]
@@ -19,9 +21,9 @@
1921
//! Enable the `ml-kem-base-ot` feature to use ML-KEM-based OT for the base OT
2022
//! protocol, providing post-quantum security:
2123
//!
22-
//! This replaces the classical "Simplest OT" with an ML-KEM-based construction following
23-
//! FIPS 203 at https://csrc.nist.gov/pubs/fips/203/final, similar to libOTe's `ENABLE_MR_KYBER` option.
24-
//! We use the ML-KEN crate https://crates.io/crates/ml-kem.
24+
//! This replaces the classical "Simplest OT" with an ML-KEM-based construction
25+
//! following FIPS 203 at <https://csrc.nist.gov/pubs/fips/203/final>, similar to libOTe's `ENABLE_MR_KYBER` option.
26+
//! We use the ML-KEM crate <https://crates.io/crates/ml-kem>.
2527
//!
2628
//! ## Benchmarks
2729
//! We continously run the benchmark suite in CI witht the results publicly
@@ -80,7 +82,8 @@ pub type BaseOt = mlkem_ot::MlKemOt;
8082

8183
/// Base OT implementation used by extension protocols.
8284
///
83-
/// When the `ml-kem-base-ot` feature is not enabled, use [`simplest_ot::SimplestOt`].
85+
/// When the `ml-kem-base-ot` feature is not enabled, use
86+
/// [`simplest_ot::SimplestOt`].
8487
#[cfg(not(feature = "ml-kem-base-ot"))]
8588
pub type BaseOt = simplest_ot::SimplestOt;
8689

cryprot-ot/src/mlkem_ot.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
//! Post-quantum base OT using ML-KEM.
22
3-
// ML-KEM variant: change to MlKem512/MlKem512Params or MlKem768/MlKem768Params for different security levels.
4-
use ml_kem::{MlKem1024 as MlKem, MlKem1024Params as MlKemParams};
5-
63
use std::io;
74

85
use cryprot_core::{Block, buf::Buf, rand_compat::RngCompat, random_oracle::RandomOracle};
96
use cryprot_net::{Connection, ConnectionError};
107
use futures::{SinkExt, StreamExt};
8+
// ML-KEM variant: change to MlKem512/MlKem512Params or MlKem768/MlKem768Params
9+
// for different security levels.
1110
use ml_kem::{
12-
Ciphertext as MlKemCiphertext, EncodedSizeUser, KemCore, SharedKey,
11+
Ciphertext as MlKemCiphertext, EncodedSizeUser, KemCore, MlKem1024 as MlKem,
12+
MlKem1024Params as MlKemParams, SharedKey,
1313
array::typenum::Unsigned,
1414
kem::{Decapsulate, DecapsulationKey, Encapsulate, EncapsulationKey as MlKemEncapsulationKey},
1515
};
@@ -249,7 +249,8 @@ fn encapsulate(ek: &EncapKeyBytes, rng: &mut StdRng) -> (CtBytes, SharedKey<MlKe
249249
)
250250
}
251251

252-
// Derive an OT key from the ML-KEM shared key using a random oracle XOF, extracting a Block-sized (128-bit) output.
252+
// Derive an OT key from the ML-KEM shared key using a random oracle XOF,
253+
// extracting a Block-sized (128-bit) output.
253254
fn hash(key: &SharedKey<MlKem>, tweak: usize) -> Block {
254255
let mut ro = RandomOracle::new();
255256
ro.update(HASH_DOMAIN_SEPARATOR);

0 commit comments

Comments
 (0)