Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade mbedtls version #335

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[workspace]
members = ["mbedtls", "mbedtls-sys", "mbedtls-platform-support"]
resolver = "2"

[profile.test]
opt-level = 3
debug = true
56 changes: 27 additions & 29 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,44 @@ case "$TRAVIS_RUST_VERSION" in
rustup target add --toolchain $TRAVIS_RUST_VERSION $TARGET
printenv

for FEAT in "" "x509," "ssl,"; do
# The SGX target cannot be run under test like a ELF binary
if [ "$TARGET" != "x86_64-fortanix-unknown-sgx" ]; then
# make sure that explicitly providing the default target works
cargo nextest run --features "$FEAT" --target $TARGET --release
cargo nextest run --features "$FEAT"pkcs12 --target $TARGET
cargo nextest run --features "$FEAT"pkcs12_rc2 --target $TARGET
cargo nextest run --features "$FEAT"dsa --target $TARGET

# If AES-NI is supported, test the feature
if [ -n "$AES_NI_SUPPORT" ]; then
cargo nextest run --features "$FEAT"force_aesni_support --target $TARGET
fi
# The SGX target cannot be run under test like a ELF binary
if [ "$TARGET" != "x86_64-fortanix-unknown-sgx" ]; then
# make sure that explicitly providing the default target works
cargo nextest run --release --target $TARGET
cargo nextest run --features rdrand,time,ssl --target $TARGET
cargo nextest run --features ssl --target $TARGET
cargo nextest run --features x509 --target $TARGET
cargo nextest run --features pkcs12 --target $TARGET pkcs12
cargo nextest run --features pkcs12_rc2 --target $TARGET pkcs12
cargo nextest run --features dsa --target $TARGET dsa

# no_std tests only are able to run on x86 platform
if [ "$TARGET" == "x86_64-unknown-linux-gnu" ] || [[ "$TARGET" =~ ^x86_64-pc-windows- ]]; then
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
# If AES-NI is supported, test the feature
if [ -n "$AES_NI_SUPPORT" ]; then
cargo nextest run --features ssl,force_aesni_support --target $TARGET
fi

else
cargo +$TRAVIS_RUST_VERSION test --no-run --features "$FEAT" --target=$TARGET
# no_std tests only are able to run on x86 platform
if [ "$TARGET" == "x86_64-unknown-linux-gnu" ] || [[ "$TARGET" =~ ^x86_64-pc-windows- ]]; then
cargo nextest run --no-default-features --features no_std_deps,rdrand,time,ssl --target $TARGET
cargo nextest run --no-default-features --features 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
done

# 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
cargo nextest run --test async_session --features=async-rt,ssl,legacy_protocols --target $TARGET
cargo nextest run --test async_session --features=async-rt,ssl --target $TARGET
cargo nextest run chrono --features=chrono,ssl,x509 --target $TARGET

# If zlib is installed, test the zlib feature
if [ -n "$ZLIB_INSTALLED" ]; then
cargo nextest run --features zlib --target $TARGET
cargo nextest run --test async_session --features=async-rt,ssl,zlib --target $TARGET
cargo nextest run --test async_session --features=async-rt,ssl,zlib,legacy_protocols --target $TARGET
cargo nextest run --test async_session --features=async-rt,ssl,zlib --target $TARGET
cargo nextest run --features zlib --target $TARGET
fi
else
cargo +$TRAVIS_RUST_VERSION test --no-run --target $TARGET
cargo +$TRAVIS_RUST_VERSION test --no-run --features async-rt,ssl,rdrand --target $TARGET
fi
;;
*)
Expand Down
44 changes: 30 additions & 14 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-alpha.2"
version = "0.12.0-alpha.3"
authors = ["Jethro Beekman <[email protected]>"]
build = "build.rs"
edition = "2018"
Expand All @@ -17,34 +17,43 @@ 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 }
rc2 = { version = "0.8.1", optional = true }
cfg-if = "1.0.0"
tokio = { version = "1.16.1", optional = true }
chrono = { version = "0.4", optional = true }
mbedtls-sys-auto = { version = "2.25.0", path = "../mbedtls-sys", default-features = false, features = [
"trusted_cert_callback",
"threading",
] }
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support" }

[target.x86_64-fortanix-unknown-sgx.dependencies]
rs-libc = "0.2.0"

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

[dependencies.mbedtls-platform-support]
version = "0.1"
path = "../mbedtls-platform-support"
# mbedtls need feature `time` to build when targeting msvc
[target.'cfg(target_env = "msvc")'.dependencies]
mbedtls-sys-auto = { version = "2.25.0", path = "../mbedtls-sys", default-features = false, features = [
"trusted_cert_callback",
"threading",
"time",
] }
mbedtls-platform-support = { version = "0.1", path = "../mbedtls-platform-support", features = [
"time",
] }

[dev-dependencies]
libc = "0.2.0"
Expand All @@ -68,7 +77,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 @@ -82,9 +97,10 @@ 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]]
name = "client"
required-features = ["std", "ssl"]
Expand Down
Loading