Skip to content

Commit 8e38e3b

Browse files
Merge pull request #9433 from holtrop/rust-conditional-compilation
Rust wrapper: enable conditional compilation based on C library build options
2 parents 35374a1 + c61ac22 commit 8e38e3b

38 files changed

+1575
-1135
lines changed

wolfcrypt/src/dh.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,7 @@ int wc_DhGenerateParams(WC_RNG *rng, int modSz, DhKey *dh)
32283228
return ret;
32293229
}
32303230

3231+
#endif /* WOLFSSL_KEY_GEN */
32313232

32323233
/* Export raw DH parameters from DhKey structure
32333234
*
@@ -3325,6 +3326,4 @@ int wc_DhExportParamsRaw(DhKey* dh, byte* p, word32* pSz,
33253326
return ret;
33263327
}
33273328

3328-
#endif /* WOLFSSL_KEY_GEN */
3329-
33303329
#endif /* NO_DH */

wolfssl/wolfcrypt/dh.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,12 @@ WOLFSSL_API int wc_DhCheckPrivKey_ex(DhKey* key, const byte* priv,
196196
word32 privSz, const byte* prime, word32 primeSz);
197197
WOLFSSL_API int wc_DhCheckKeyPair(DhKey* key, const byte* pub, word32 pubSz,
198198
const byte* priv, word32 privSz);
199+
#ifdef WOLFSSL_KEY_GEN
199200
WOLFSSL_API int wc_DhGenerateParams(WC_RNG *rng, int modSz, DhKey *dh);
201+
#endif
200202
WOLFSSL_API int wc_DhExportParamsRaw(DhKey* dh, byte* p, word32* pSz,
201203
byte* q, word32* qSz, byte* g, word32* gSz);
202204

203-
204205
#ifdef __cplusplus
205206
} /* extern "C" */
206207
#endif

wolfssl/wolfcrypt/ecc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -913,9 +913,11 @@ int wc_ecc_export_point_der_ex(const int curve_idx, ecc_point* point, byte* out,
913913
WOLFSSL_API
914914
int wc_ecc_export_point_der(const int curve_idx, ecc_point* point,
915915
byte* out, word32* outLen);
916+
#ifdef HAVE_COMP_KEY
916917
WOLFSSL_LOCAL
917918
int wc_ecc_export_point_der_compressed(const int curve_idx, ecc_point* point,
918919
byte* out, word32* outLen);
920+
#endif /* HAVE_COMP_KEY */
919921
#endif /* HAVE_ECC_KEY_EXPORT */
920922

921923

wrapper/rust/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.PHONY: all
22
all:
3-
+$(MAKE) -C wolfssl-sys
43
+$(MAKE) -C wolfssl
54

65
.PHONY: test
@@ -9,5 +8,4 @@ test:
98

109
.PHONY: clean
1110
clean:
12-
+$(MAKE) -C wolfssl-sys clean
1311
+$(MAKE) -C wolfssl clean

wrapper/rust/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ Run tests with:
1717
| Repository Directory | Description |
1818
| --- | --- |
1919
| `/wrapper/rust` | Top level container for all Rust wrapper functionality. |
20-
| `/wrapper/rust/wolfssl` | Top level for the `wolfssl` library crate. This crate contains high-level Rust sources that use the bindings from the `wolfssl-sys` crate. |
20+
| `/wrapper/rust/wolfssl` | Top level for the `wolfssl` library crate. |
2121
| `/wrapper/rust/wolfssl/src` | Source directory for `wolfssl` crate top-level modules. |
2222
| `/wrapper/rust/wolfssl/src/wolfcrypt` | Source directory for submodules of `wolfssl::wolfcrypt` module. |
23-
| `/wrapper/rust/wolfssl-sys` | Top level for the `wolfssl-sys` library crate. This crate contains only automatically generated bindings to the `wolfssl` C library. |

wrapper/rust/include.am

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@
44

55
EXTRA_DIST += wrapper/rust/Makefile
66
EXTRA_DIST += wrapper/rust/README.md
7-
EXTRA_DIST += wrapper/rust/wolfssl-sys/Cargo.lock
8-
EXTRA_DIST += wrapper/rust/wolfssl-sys/Cargo.toml
9-
EXTRA_DIST += wrapper/rust/wolfssl-sys/Makefile
10-
EXTRA_DIST += wrapper/rust/wolfssl-sys/build.rs
11-
EXTRA_DIST += wrapper/rust/wolfssl-sys/headers.h
12-
EXTRA_DIST += wrapper/rust/wolfssl-sys/src/lib.rs
137
EXTRA_DIST += wrapper/rust/wolfssl/Cargo.lock
148
EXTRA_DIST += wrapper/rust/wolfssl/Cargo.toml
159
EXTRA_DIST += wrapper/rust/wolfssl/Makefile
1610
EXTRA_DIST += wrapper/rust/wolfssl/build.rs
11+
EXTRA_DIST += wrapper/rust/wolfssl/headers.h
1712
EXTRA_DIST += wrapper/rust/wolfssl/src/lib.rs
1813
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt.rs
1914
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/aes.rs

wrapper/rust/wolfssl-sys/Cargo.lock

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

wrapper/rust/wolfssl-sys/Cargo.toml

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

0 commit comments

Comments
 (0)