Skip to content

Commit

Permalink
Fix windows build (#337)
Browse files Browse the repository at this point in the history
* add CI for windows build with only `std` feature
* fix windows build
* bump version
  • Loading branch information
Taowyoo authored Dec 12, 2023
1 parent 590419a commit cc49440
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,19 @@ case "$TRAVIS_RUST_VERSION" in
cargo nextest run --no-default-features --features "$FEAT"no_std_deps,rdrand,time --target $TARGET
cargo nextest run --no-default-features --features "$FEAT"no_std_deps --target $TARGET
fi
if [ "$TARGET" == "x86_64-apple-darwin" ]; then
cargo nextest run --no-default-features --features no_std_deps --target $TARGET
fi

else
cargo +$TRAVIS_RUST_VERSION test --no-run --features "$FEAT" --target=$TARGET
fi
done

if [ "$TARGET" == "x86_64-apple-darwin" ]; then
cargo nextest run --no-default-features --features no_std_deps --target $TARGET
fi
# special case: mbedtls should compile successfully on windows only with `std` feature
if [[ "$TARGET" =~ ^x86_64-pc-windows- ]]; then
cargo nextest run --no-default-features --features std --target $TARGET
fi

# The SGX target cannot be run under test like a ELF binary
if [ "$TARGET" != "x86_64-fortanix-unknown-sgx" ]; then
cargo nextest run --test async_session --features=async-rt,ssl --target $TARGET
Expand Down
49 changes: 30 additions & 19 deletions mbedtls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "mbedtls"
# We jumped from v0.9 to v0.12 because v0.10 and v0.11 were based on mbedtls 3.X, which
# we decided not to support.
version = "0.12.0"
version = "0.12.1"
authors = ["Jethro Beekman <[email protected]>"]
build = "build.rs"
edition = "2018"
Expand All @@ -17,14 +17,17 @@ environment."""
readme = "../README.md"
repository = "https://github.com/fortanix/rust-mbedtls"
documentation = "https://docs.rs/mbedtls/"
keywords = ["MbedTLS","mbed","TLS","SSL","cryptography"]
keywords = ["MbedTLS", "mbed", "TLS", "SSL", "cryptography"]

[dependencies]
bitflags = "1"
serde = { version = "1.0.7", default-features = false, features = ["alloc"] }
serde_derive = "1.0.7"
byteorder = { version = "1.0.0", default-features = false }
yasna = { version = "0.2", optional = true, features = ["num-bigint", "bit-vec"] }
yasna = { version = "0.2", optional = true, features = [
"num-bigint",
"bit-vec",
] }
num-bigint = { version = "0.2", optional = true }
bit-vec = { version = "0.5", optional = true }
cbc = { version = "0.1.2", optional = true }
Expand All @@ -33,18 +36,15 @@ cfg-if = "1.0.0"
tokio = { version = "1.16.1", optional = true }
chrono = { version = "0.4", optional = true }

[target.x86_64-fortanix-unknown-sgx.dependencies]
rs-libc = "0.2.0"
mbedtls-sys-auto = { path = "../mbedtls-sys", version = "2.25.0", default-features = false, features = [
"trusted_cert_callback",
"threading",
] }

[dependencies.mbedtls-sys-auto]
version = "2.25.0"
default-features = false
features = ["trusted_cert_callback", "threading"]
path = "../mbedtls-sys"
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support" }

[dependencies.mbedtls-platform-support]
version = "0.1"
path = "../mbedtls-platform-support"
[target.x86_64-fortanix-unknown-sgx.dependencies]
rs-libc = "0.2.0"

[dev-dependencies]
libc = "0.2.0"
Expand All @@ -62,10 +62,15 @@ pin-project-lite = "0.2"
cc = "1.0"

# feature 'time` is necessary under windows
[target.'cfg(target_os = "windows")'.mbedtls-platform-support]
version = "0.1"
path = "../mbedtls-platform-support"
features = ["time"]
[target.'cfg(target_env = "msvc")'.dependencies]
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support", features = [
"time",
] }
mbedtls-sys-auto = { path = "../mbedtls-sys", version = "2.25.0", default-features = false, features = [
"trusted_cert_callback",
"threading",
"time",
] }

[features]
# Features are documented in the README
Expand All @@ -74,7 +79,13 @@ x509 = []
ssl = ["x509"]

default = ["std", "aesni", "time", "padlock"]
std = ["byteorder/std", "mbedtls-sys-auto/std", "serde/std", "yasna", "mbedtls-platform-support/std"]
std = [
"byteorder/std",
"mbedtls-sys-auto/std",
"serde/std",
"yasna",
"mbedtls-platform-support/std",
]
debug = ["mbedtls-sys-auto/debug"]
no_std_deps = ["mbedtls-platform-support/spin", "serde/alloc"]
force_aesni_support = ["mbedtls-platform-support/force_aesni_support", "aesni"]
Expand All @@ -88,7 +99,7 @@ dsa = ["std", "yasna", "num-bigint", "bit-vec"]
pkcs12 = ["std", "yasna", "x509"]
pkcs12_rc2 = ["pkcs12", "rc2", "cbc"]
legacy_protocols = ["mbedtls-sys-auto/legacy_protocols", "ssl"]
async = ["std", "tokio","tokio/net","tokio/io-util", "tokio/macros"]
async = ["std", "tokio", "tokio/net", "tokio/io-util", "tokio/macros"]
async-rt = ["async", "tokio/rt", "tokio/sync", "tokio/rt-multi-thread"]

[[example]]
Expand Down

0 comments on commit cc49440

Please sign in to comment.