@@ -43,7 +43,13 @@ fn copy_wolfssl(dest: &Path) -> std::io::Result<PathBuf> {
4343}
4444
4545const PATCH_DIR : & str = "patches" ;
46- const PATCHES : & [ & str ] = & [ "disable-falcon-dilithium.patch" ] ;
46+ const PATCHES : & [ & str ] = & [
47+ "include-private-key-fields-for-kyber.patch" ,
48+ "make-kyber-mlkem-available.patch" ,
49+ "fix-kyber-mlkem-benchmark.patch" ,
50+ "fix-mlkem-get-curve-name.patch" ,
51+ "fix-kyber-get-curve-name.patch" ,
52+ ] ;
4753
4854/**
4955 * Apply patch to wolfssl-src
@@ -90,6 +96,8 @@ fn build_wolfssl(wolfssl_src: &Path) -> PathBuf {
9096 . disable_shared ( )
9197 // Disable sys ca certificate store
9298 . disable ( "sys-ca-certs" , None )
99+ // Disable dilithium
100+ . disable ( "dilithium" , None )
93101 // Enable AES bitsliced implementation (cache attack safe)
94102 . enable ( "aes-bitsliced" , None )
95103 // Enable Curve25519
@@ -118,7 +126,7 @@ fn build_wolfssl(wolfssl_src: &Path) -> PathBuf {
118126 . enable ( "supportedcurves" , None )
119127 // Enable TLS/1.3
120128 . enable ( "tls13" , None )
121- // Enable liboqs , etc
129+ // Enable kyber , etc
122130 . enable ( "experimental" , None )
123131 // CFLAGS
124132 . cflag ( "-g" )
@@ -137,21 +145,10 @@ fn build_wolfssl(wolfssl_src: &Path) -> PathBuf {
137145 }
138146
139147 if cfg ! ( feature = "postquantum" ) {
140- // Post Quantum support is provided by liboqs
141- if let Some ( include) = std:: env:: var_os ( "DEP_OQS_ROOT" ) {
142- let oqs_path = Path :: new ( & include) ;
143- conf. cflag ( format ! (
144- "-I{}" ,
145- oqs_path. join( "build/include/" ) . to_str( ) . unwrap( )
146- ) ) ;
147- conf. ldflag ( format ! (
148- "-L{}" ,
149- oqs_path. join( "build/lib/" ) . to_str( ) . unwrap( )
150- ) ) ;
151- conf. with ( "liboqs" , None ) ;
152- } else {
153- panic ! ( "Post Quantum requested but liboqs appears to be missing?" ) ;
154- }
148+ // Enable Kyber
149+ conf. enable ( "kyber" , Some ( "all,original" ) )
150+ // SHA3 is needed for using WolfSSL's implementation of Kyber/ML-KEM
151+ . enable ( "sha3" , None ) ;
155152 }
156153
157154 match build_target:: target_arch ( ) . unwrap ( ) {
@@ -291,10 +288,6 @@ fn main() -> std::io::Result<()> {
291288 // Tell cargo to tell rustc to link in WolfSSL
292289 println ! ( "cargo:rustc-link-lib=static=wolfssl" ) ;
293290
294- if cfg ! ( feature = "postquantum" ) {
295- println ! ( "cargo:rustc-link-lib=static=oqs" ) ;
296- }
297-
298291 println ! (
299292 "cargo:rustc-link-search=native={}" ,
300293 wolfssl_install_dir. join( "lib" ) . to_str( ) . unwrap( )
0 commit comments