Skip to content

Commit 6ecb2cb

Browse files
authored
feat: Update to liboqs 0.12.0 (#272)
* Bump liboqs version and update algorithm list Signed-off-by: Spencer Wilson <[email protected]> * Update wrappers Signed-off-by: Spencer Wilson <[email protected]> * Update liboqs submodule to 0.12.0 Signed-off-by: Spencer Wilson <[email protected]> * Exclude SIG_STFL from build Signed-off-by: Spencer Wilson <[email protected]> * Additionally run CI against liboqs main Signed-off-by: Spencer Wilson <[email protected]> * Add context string signature APIs Signed-off-by: Spencer Wilson <[email protected]> * Update CHANGELOG.md Signed-off-by: Spencer Wilson <[email protected]> --------- Signed-off-by: Spencer Wilson <[email protected]>
1 parent bba29e9 commit 6ecb2cb

File tree

12 files changed

+237
-33
lines changed

12 files changed

+237
-33
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
- stable
1616
- beta
1717
- nightly
18+
update-liboqs:
19+
- true
20+
- false
1821
env:
1922
# 20 MiB stack
2023
RUST_MIN_STACK: 20971520
@@ -24,6 +27,10 @@ jobs:
2427
with:
2528
submodules: true
2629

30+
- name: Update liboqs submodule
31+
if: matrix.update-liboqs
32+
run: git submodule update --remote
33+
2734
- name: Set stack size
2835
if: startsWith(matrix.os, 'windows')
2936
run: echo "RUSTFLAGS=-C link-arg=/STACK:20971520" >> $env:GITHUB_ENV

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## v0.10.0 (2024-12-17)
2+
3+
- Sync with liboqs 0.12.0.
4+
- New algorithms: ML-KEM (FIPS 203), ML-DSA (FIPS 204), CROSS (NIST Additional Signatures Round 1), and MAYO (NIST Additional Signatures Round 1).
5+
- Updated algorithms: HQC (NIST Round 4), Falcon (Round 3, including "padded" variants).
6+
- Not included from liboqs: stateful signature algorithms LMS and XMSS.
7+
- New API for signing and verifying with a context string.
8+
19
## oqs-sys v0.9.1
210

311
* Fix pkg-config version detection (#246)

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Update your `Cargo.toml` and include `oqs`:
3737

3838
```toml
3939
[dependencies]
40-
oqs = "0.9.0"
40+
oqs = "0.10.0"
4141
```
4242

4343
`oqs-sys` can be specified equivalently.
@@ -101,13 +101,14 @@ tests.
101101
- `frodokem`
102102
- `hqc`
103103
- `kyber`
104+
- `ml_kem`
104105
- `ntruprime`
105-
- `saber`
106106
- `sigs` (default): Compile with all signature schemes enabled
107+
- `cross`
107108
- `dilithium`
108109
- `falcon`
109-
- `picnic`
110-
- `rainbow`
110+
- `mayo`
111+
- `ml_dsa`
111112
- `sphincs`: SPHINCS<sup>+</sup>
112113

113114
## Running

oqs-sys/Cargo.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oqs-sys"
3-
version = "0.9.1+liboqs-0.9.0"
3+
version = "0.10.0+liboqs-0.12.0"
44
authors = ["Thom Wiggers <[email protected]>"]
55
edition = "2021"
66
links = "oqs"
@@ -30,17 +30,21 @@ docs = []
3030
non_portable = []
3131
vendored = []
3232
# algorithms: KEMs
33-
kems = ["classic_mceliece", "frodokem", "hqc", "kyber", "ntruprime"]
33+
kems = ["classic_mceliece", "frodokem", "hqc", "kyber", "ml_kem", "ntruprime"]
3434
bike = [] # BIKE is enabled by build.rs on non-windows targets
3535
classic_mceliece = []
3636
frodokem = []
3737
hqc = []
3838
kyber = []
39+
ml_kem = []
3940
ntruprime = []
4041
# algorithms: Signature schemes
41-
sigs = ["dilithium", "falcon", "sphincs"]
42+
sigs = ["cross", "dilithium", "falcon", "mayo", "ml_dsa", "sphincs"]
43+
cross = []
4244
dilithium = []
4345
falcon = []
46+
mayo = []
47+
ml_dsa = []
4448
sphincs = []
4549

4650
[package.metadata.docs.rs]

oqs-sys/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# FFI Rust binding to [Open Quantum Safe][oqs]'s [liboqs][]
22

33
[![crates.io](https://img.shields.io/crates/v/oqs-sys)](https://crates.io/crates/oqs-sys)
4-
[![crates.io/docs](https://img.shields.io/docsrs/oqs-sys)](https://docs.rs/oqs/0.7.1/oqs-sys/)
4+
[![crates.io/docs](https://img.shields.io/docsrs/oqs-sys)](https://docs.rs/oqs/latest/oqs-sys/)
55

66
This crate provides the unsafe `ffi` bindings to [liboqs][].
77

@@ -16,10 +16,14 @@ This crate provides the unsafe `ffi` bindings to [liboqs][].
1616
* `frodokem`
1717
* `hqc`
1818
* `kyber`
19+
* `ml_kem`
1920
* `ntruprime`
2021
* `sigs` (default): Compile with all signature schemes enabled
22+
* `cross`
2123
* `dilithium`
2224
* `falcon`
25+
* `mayo`
26+
* `ml_dsa`
2327
* `sphincs`: SPHINCS+
2428

2529
[oqs]: https://openquantumsafe.org

oqs-sys/build.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::path::{Path, PathBuf};
22

3-
fn generate_bindings(includedir: &Path, headerfile: &str, filter: &str) {
3+
fn generate_bindings(includedir: &Path, headerfile: &str, allow_filter: &str, block_filter: &str) {
44
let out_path = PathBuf::from(std::env::var("OUT_DIR").unwrap());
55
bindgen::Builder::default()
66
.clang_arg(format!("-I{}", includedir.display()))
@@ -19,11 +19,14 @@ fn generate_bindings(includedir: &Path, headerfile: &str, filter: &str) {
1919
// Don't generate docs unless enabled
2020
// Otherwise it breaks tests
2121
.generate_comments(cfg!(feature = "docs"))
22-
// Whitelist OQS stuff
22+
// Allowlist/blocklist OQS stuff
2323
.allowlist_recursively(false)
24-
.allowlist_type(filter)
25-
.allowlist_function(filter)
26-
.allowlist_var(filter)
24+
.allowlist_type(allow_filter)
25+
.allowlist_function(allow_filter)
26+
.allowlist_var(allow_filter)
27+
.blocklist_type(block_filter)
28+
.blocklist_function(block_filter)
29+
.allowlist_var(block_filter)
2730
// Use core and libc
2831
.use_core()
2932
.ctypes_prefix("::libc")
@@ -68,11 +71,15 @@ fn build_from_source() -> PathBuf {
6871
algorithm_feature!("KEM", "frodokem");
6972
algorithm_feature!("KEM", "hqc");
7073
algorithm_feature!("KEM", "kyber");
74+
algorithm_feature!("KEM", "ml_kem");
7175
algorithm_feature!("KEM", "ntruprime");
7276

7377
// signature schemes
78+
algorithm_feature!("SIG", "cross");
7479
algorithm_feature!("SIG", "dilithium");
7580
algorithm_feature!("SIG", "falcon");
81+
algorithm_feature!("SIG", "mayo");
82+
algorithm_feature!("SIG", "ml_dsa");
7683
algorithm_feature!("SIG", "sphincs");
7784

7885
if cfg!(windows) {
@@ -166,12 +173,14 @@ fn main() {
166173
bindgen::clang_version();
167174

168175
let includedir = probe_includedir();
169-
let gen_bindings = |file, filter| generate_bindings(&includedir, file, filter);
176+
let gen_bindings = |file, allow_filter, block_filter| {
177+
generate_bindings(&includedir, file, allow_filter, block_filter)
178+
};
170179

171-
gen_bindings("common", "OQS_.*");
172-
gen_bindings("rand", "OQS_(randombytes|RAND)_.*");
173-
gen_bindings("kem", "OQS_KEM.*");
174-
gen_bindings("sig", "OQS_SIG.*");
180+
gen_bindings("common", "OQS_.*", "");
181+
gen_bindings("rand", "OQS_(randombytes|RAND)_.*", "");
182+
gen_bindings("kem", "OQS_KEM.*", "");
183+
gen_bindings("sig", "OQS_SIG.*", "OQS_SIG_STFL.*");
175184

176185
// https://docs.rs/build-deps/0.1.4/build_deps/fn.rerun_if_changed_paths.html
177186
build_deps::rerun_if_changed_paths("liboqs/src/**/*").unwrap();

oqs-sys/liboqs

Submodule liboqs updated 2651 files

oqs/Cargo.toml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "oqs"
3-
version = "0.9.0"
3+
version = "0.10.0"
44
authors = ["Thom Wiggers <[email protected]>"]
55
edition = "2021"
66
description = "A Rusty interface to Open-Quantum-Safe's liboqs"
@@ -16,7 +16,7 @@ serde = { version = "1.0", optional = true, default-features = false, features =
1616

1717
[dependencies.oqs-sys]
1818
path = "../oqs-sys"
19-
version = "0.9.0"
19+
version = "0.10.0"
2020
default-features = false
2121

2222
[features]
@@ -26,15 +26,19 @@ non_portable = ["oqs-sys/non_portable"]
2626
vendored = ["oqs-sys/vendored"]
2727

2828
# algorithms: KEMs
29-
kems = ["oqs-sys/kems", "classic_mceliece", "frodokem", "hqc", "kyber", "ntruprime"]
29+
kems = ["oqs-sys/kems", "classic_mceliece", "frodokem", "hqc", "kyber", "ml_kem", "ntruprime"]
3030
bike = ["oqs-sys/bike"] # not supported on Windows or 32-bit ARM
3131
classic_mceliece = ["oqs-sys/classic_mceliece"]
3232
frodokem = ["oqs-sys/frodokem"]
3333
hqc = ["oqs-sys/hqc"]
3434
kyber = ["oqs-sys/kyber"]
35+
ml_kem = ["oqs-sys/ml_kem"]
3536
ntruprime = ["oqs-sys/ntruprime"]
3637
# algorithms: Signature schemes
37-
sigs = ["oqs-sys/sigs", "dilithium", "falcon", "sphincs"]
38+
sigs = ["oqs-sys/sigs", "cross", "dilithium", "falcon", "mayo", "ml_dsa", "sphincs"]
39+
cross = ["oqs-sys/cross"]
3840
dilithium = ["oqs-sys/dilithium"]
3941
falcon = ["oqs-sys/falcon"]
42+
mayo = ["oqs-sys/mayo"]
43+
ml_dsa = ["oqs-sys/ml_dsa"]
4044
sphincs = ["oqs-sys/sphincs"]

oqs/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Bindings to Open-Quantum-Safe's [liboqs][]
22

33
[![crates.io](https://img.shields.io/crates/v/oqs)](https://crates.io/crates/oqs)
4-
[![crates.io/docs](https://img.shields.io/docsrs/oqs)](https://docs.rs/oqs/0.7.1/oqs/)
4+
[![crates.io/docs](https://img.shields.io/docsrs/oqs)](https://docs.rs/oqs/latest/oqs/)
55

66
This crate provides convenience wrappers to access the functionality provided by [liboqs][].
77
For the ``ffi`` interface bindings, see ``oqs-sys``.
@@ -21,8 +21,12 @@ For the ``ffi`` interface bindings, see ``oqs-sys``.
2121
* `frodokem`
2222
* `hqc`
2323
* `kyber`
24+
* `ml_kem`
2425
* `ntruprime`
2526
* `sigs` (default): Compile with all signature schemes enabled
27+
* `cross`
2628
* `dilithium`
2729
* `falcon`
30+
* `mayo`
31+
* `ml_dsa`
2832
* `sphincs`: SPHINCS+

oqs/src/kem.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,9 @@ implement_kems! {
133133
("kyber") Kyber512: OQS_KEM_alg_kyber_512,
134134
("kyber") Kyber768: OQS_KEM_alg_kyber_768,
135135
("kyber") Kyber1024: OQS_KEM_alg_kyber_1024,
136+
("ml_kem") MlKem512: OQS_KEM_alg_ml_kem_512,
137+
("ml_kem") MlKem768: OQS_KEM_alg_ml_kem_768,
138+
("ml_kem") MlKem1024: OQS_KEM_alg_ml_kem_1024,
136139
("ntruprime") NtruPrimeSntrup761: OQS_KEM_alg_ntruprime_sntrup761,
137140
("frodokem") FrodoKem640Aes: OQS_KEM_alg_frodokem_640_aes,
138141
("frodokem") FrodoKem640Shake: OQS_KEM_alg_frodokem_640_shake,
@@ -177,10 +180,10 @@ impl std::fmt::Display for Algorithm {
177180
///
178181
/// # Example
179182
/// ```rust
180-
/// # if !cfg!(feature = "kyber") { return; }
183+
/// # if !cfg!(feature = "ml_kem") { return; }
181184
/// use oqs;
182185
/// oqs::init();
183-
/// let kem = oqs::kem::Kem::new(oqs::kem::Algorithm::Kyber512).unwrap();
186+
/// let kem = oqs::kem::Kem::new(oqs::kem::Algorithm::MlKem512).unwrap();
184187
/// let (pk, sk) = kem.keypair().unwrap();
185188
/// let (ct, ss) = kem.encapsulate(&pk).unwrap();
186189
/// let ss2 = kem.decapsulate(&sk, &ct).unwrap();

0 commit comments

Comments
 (0)