diff --git a/.github/workflows/publish-crates.yml b/.github/workflows/publish-crates.yml new file mode 100644 index 000000000..e82cd3366 --- /dev/null +++ b/.github/workflows/publish-crates.yml @@ -0,0 +1,56 @@ +name: Publish Crates + +on: + release: + types: [created] + workflow_dispatch: + inputs: + crate_name: + description: 'Name of crate to be published' + required: true + type: string +permissions: + contents: read + +jobs: + crate_publish: + environment: "publish to crates.io" + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + profile: minimal + - name: Install build dependencies + run: | + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" | sudo tee -a /etc/apt/sources.list + sudo apt-get update + sudo apt-get install -y clang-11 cmake + if [ -f mbedtls-sys/vendor/scripts/basic.requirements.txt ]; then + sudo apt-get install -y python3-pip + python3 -m pip install -r mbedtls-sys/vendor/scripts/basic.requirements.txt + fi + - name: Get name of crate to be published + run: | + if [[ -z "${{ inputs.crate_name }}" ]]; then + # Extract the crate name from the GITHUB_REF environment variable + # GITHUB_REF contains the GitHub reference (e.g., refs/tags/mbedtls-sys-auto_v3.5.0) associated with the event + export CRATE_NAME=$(python3 -c "print('$GITHUB_REF'.split('/')[2].rsplit('_v', 1)[0])") + else + export CRATE_NAME="${{ inputs.crate_name }}" + fi + echo "CRATE_NAME=$CRATE_NAME" >> $GITHUB_ENV + - name: Publish crate to crates.io + run: | + echo "Publishing crate: $CRATE_NAME" + cargo publish --locked --token ${CARGO_REGISTRY_TOKEN} --package "$CRATE_NAME" + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + RUSTFLAGS: "-A ambiguous_glob_reexports" + RUST_BACKTRACE: "1" + PYTHONDONTWRITEBYTECODE: "1" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..9197a5355 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,105 @@ +name: CI + +on: + push: + branches: + - 'v0.*' + - staging + - trying + pull_request: + branches: + - master + - 'v0.*' + merge_group: + +env: + RUST_BACKTRACE: 1 + CARGO_TERM_COLOR: always + CARGO_INCREMENTAL: 0 + CARGO_NET_RETRY: 10 + +jobs: + test: + name: Test + strategy: + matrix: + include: + - rust: stable + target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + - rust: stable + target: x86_64-fortanix-unknown-sgx + os: ubuntu-20.04 + - rust: stable + target: x86_64-pc-windows-msvc + os: windows-latest + - rust: stable + target: x86_64-pc-windows-msvc + os: windows-latest + - rust: stable + target: x86_64-pc-windows-msvc + os: windows-2019 + - rust: stable + target: aarch64-unknown-linux-musl + os: ubuntu-20.04 + - rust: beta + target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + - rust: nightly + target: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install qemu-user for aarch64 target + if: matrix.target == 'aarch64-unknown-linux-musl' + run: | + sudo apt-get update + sudo apt-get install -y qemu-user + + - name: Install clang-11 on windows-2019 + if: matrix.os == 'windows-2019' + uses: KyleMayes/install-llvm-action@v1 + with: + version: "11.0" + + - name: Set LIBCLANG_PATH on windows-2019 + if: matrix.os == 'windows-2019' + run: echo "LIBCLANG_PATH='C:\Program Files\LLVM\bin'" >> "$GITHUB_ENV" + + - name: Cache Dependencies + uses: Swatinem/rust-cache@988c164c3d0e93c4dbab36aaf5bbeb77425b2894 + with: + key: ${{ matrix.rust }} + + - name: Setup Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} + override: true + + - name: Run tests + run: | + ./ci_tools.sh + ./ci.sh + env: + TRAVIS_RUST_VERSION: ${{ matrix.rust }} + TARGET: ${{ matrix.target }} + ZLIB_INSTALLED: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }} + AES_NI_SUPPORT: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && 'true' || '' }} + shell: bash + + ci-success: + name: ci + if: always() + needs: + - test + runs-on: ubuntu-20.04 + steps: + - run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}' + - name: Done + run: exit 0 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2914142ce..000000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -branches: - only: - # This is where pull requests from "bors r+" are built. - - staging - # This is where pull requests from "bors try" are built. - - trying - # Not really necessary, just to get a green badge on “master” - - master -language: rust -os: linux -dist: focal -addons: - apt: - sources: - - sourceline: "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main" - key_url: "https://apt.llvm.org/llvm-snapshot.gpg.key" - packages: - - clang-11 - - cmake - - qemu-user -before_script: - - printenv - - whereis clang && clang --version - # remove clang-16 path from PATH - - export PATH=$(echo $PATH | sed -e 's|:/usr/local/clang-16.0.0/bin||') - # setup clang-11 as default clang - - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-11 100 - - whereis clang && clang --version -rust: - - stable -env: - global: - - RUST_BACKTRACE=1 -jobs: - include: - - env: TARGET=x86_64-fortanix-unknown-sgx - rust: stable - - env: TARGET=aarch64-unknown-linux-musl - rust: stable - - env: TARGET=x86_64-unknown-linux-gnu ZLIB_INSTALLED=true AES_NI_SUPPORT=true - rust: nightly - - env: TARGET=x86_64-unknown-linux-gnu ZLIB_INSTALLED=true AES_NI_SUPPORT=true - rust: beta - - env: TARGET=x86_64-unknown-linux-gnu ZLIB_INSTALLED=true AES_NI_SUPPORT=true - rust: stable -script: - - ./ct.sh diff --git a/Cargo.lock b/Cargo.lock index 7ae5c7c17..671804358 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,24 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" -dependencies = [ - "memchr", -] - -[[package]] -name = "ansi_term" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" -dependencies = [ - "winapi", -] - [[package]] name = "async-stream" version = "0.3.4" @@ -37,22 +19,11 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4655ae1a7b0cdf149156f780c5bf3f1352bc53cbd9e0a361a7ef7b22947e965" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", + "proc-macro2 1.0.66", + "quote 1.0.33", "syn 1.0.64", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "0.1.6" @@ -77,24 +48,24 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.58.0" +version = "0.65.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d2549a1ca679efa833b9d88a424955109722c9fd95418b95414c19fd6f4bda" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" dependencies = [ - "bitflags", + "bitflags 1.2.0", "cexpr", "clang-sys", - "clap", - "env_logger", "lazy_static", "lazycell", "log 0.4.8", "peeking_take_while", - "proc-macro2 1.0.24", - "quote 1.0.9", + "prettyplease", + "proc-macro2 1.0.66", + "quote 1.0.33", "regex", "rustc-hash", "shlex", + "syn 2.0.32", "which", ] @@ -110,6 +81,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "block-padding" version = "0.3.2" @@ -142,15 +119,18 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.67" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cexpr" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ "nom", ] @@ -200,26 +180,11 @@ dependencies = [ "libloading", ] -[[package]] -name = "clap" -version = "2.33.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" -dependencies = [ - "ansi_term", - "atty", - "bitflags", - "strsim", - "textwrap", - "unicode-width", - "vec_map", -] - [[package]] name = "cmake" -version = "0.1.42" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fb25b677f8bf1eb325017cb6bb8452f87969db0fedb4f757b297bee78a7c62" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] @@ -235,16 +200,30 @@ dependencies = [ ] [[package]] -name = "env_logger" -version = "0.8.3" +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "atty", - "humantime", - "log 0.4.8", - "regex", - "termcolor", + "cc", + "libc", ] [[package]] @@ -307,8 +286,8 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", + "proc-macro2 1.0.66", + "quote 1.0.33", "syn 1.0.64", ] @@ -374,16 +353,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" [[package]] -name = "httparse" -version = "1.3.4" +name = "home" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys", +] [[package]] -name = "humantime" -version = "2.1.0" +name = "httparse" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "hyper" @@ -445,9 +427,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -471,6 +453,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linux-raw-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" + [[package]] name = "log" version = "0.3.9" @@ -497,11 +485,11 @@ checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" [[package]] name = "mbedtls" -version = "0.9.2" +version = "0.9.3" dependencies = [ "async-stream", "bit-vec", - "bitflags", + "bitflags 1.2.0", "byteorder", "cbc", "cc", @@ -528,7 +516,7 @@ dependencies = [ [[package]] name = "mbedtls-platform-support" -version = "0.1.0" +version = "0.1.1" dependencies = [ "cc", "cfg-if 1.0.0", @@ -539,7 +527,7 @@ dependencies = [ [[package]] name = "mbedtls-sys-auto" -version = "2.28.3" +version = "2.28.3+patch1" dependencies = [ "bindgen", "cc", @@ -548,7 +536,7 @@ dependencies = [ "lazy_static", "libc", "libz-sys", - "quote 1.0.9", + "quote 1.0.33", "syn 1.0.64", ] @@ -567,6 +555,12 @@ dependencies = [ "log 0.3.9", ] +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "mio" version = "0.7.14" @@ -591,12 +585,12 @@ dependencies = [ [[package]] name = "nom" -version = "5.1.2" +version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", - "version_check 0.9.2", + "minimal-lexical", ] [[package]] @@ -684,6 +678,16 @@ version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2 1.0.66", + "syn 2.0.32", +] + [[package]] name = "proc-macro2" version = "0.4.30" @@ -695,11 +699,11 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ - "unicode-xid 0.2.1", + "unicode-ident", ] [[package]] @@ -713,11 +717,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.9" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ - "proc-macro2 1.0.24", + "proc-macro2 1.0.66", ] [[package]] @@ -774,21 +778,18 @@ checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" [[package]] name = "regex" -version = "1.4.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", - "thread_local", ] [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "rs-libc" @@ -805,6 +806,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustix" +version = "0.38.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "safemem" version = "0.3.3" @@ -869,12 +883,6 @@ version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f" -[[package]] -name = "strsim" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" - [[package]] name = "syn" version = "0.14.9" @@ -892,37 +900,20 @@ version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", + "proc-macro2 1.0.66", + "quote 1.0.33", "unicode-xid 0.2.1", ] [[package]] -name = "termcolor" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "textwrap" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" -dependencies = [ - "unicode-width", -] - -[[package]] -name = "thread_local" -version = "1.1.7" +name = "syn" +version = "2.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" dependencies = [ - "cfg-if 1.0.0", - "once_cell", + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-ident", ] [[package]] @@ -973,8 +964,8 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", + "proc-macro2 1.0.66", + "quote 1.0.33", "syn 1.0.64", ] @@ -996,8 +987,8 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" dependencies = [ - "proc-macro2 1.0.24", - "quote 1.0.9", + "proc-macro2 1.0.66", + "quote 1.0.33", "syn 1.0.64", ] @@ -1046,6 +1037,12 @@ dependencies = [ "matches", ] +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + [[package]] name = "unicode-normalization" version = "0.1.16" @@ -1055,12 +1052,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" - [[package]] name = "unicode-xid" version = "0.1.0" @@ -1090,12 +1081,6 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33dd455d0f96e90a75803cfeb7f948768c08d70a6de9a8d2362461935698bf95" -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - [[package]] name = "version_check" version = "0.1.5" @@ -1110,11 +1095,14 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "which" -version = "3.0.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240a31163872f7e8e49f35b42b58485e35355b07eb009d9f3686733541339a69" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" dependencies = [ - "libc", + "either", + "home", + "once_cell", + "rustix", ] [[package]] @@ -1134,19 +1122,76 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] -name = "winapi-util" -version = "0.1.5" +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "winapi", + "windows-targets", ] [[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "yasna" diff --git a/bors.toml b/bors.toml index 9db31cca7..1818af776 100644 --- a/bors.toml +++ b/bors.toml @@ -1,4 +1,4 @@ status = [ - "continuous-integration/travis-ci/push", + "ci", ] -timeout_sec = 36000 # ten hours +timeout_sec = 3600 # 1 hours diff --git a/ci.sh b/ci.sh new file mode 100755 index 000000000..021c73311 --- /dev/null +++ b/ci.sh @@ -0,0 +1,64 @@ +#!/bin/bash +set -ex +cd "$(dirname "$0")" + +repo_root=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) + +if [ -z $TRAVIS_RUST_VERSION ]; then + echo "Expected TRAVIS_RUST_VERSION to be set in env" + exit 1 +fi + +# Test logic start from here +export CFLAGS_x86_64_fortanix_unknown_sgx="-isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" +export CC_x86_64_fortanix_unknown_sgx=clang-11 +export CC_aarch64_unknown_linux_musl=/tmp/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc +export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/tmp/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc +export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER=qemu-aarch64 + +cd "${repo_root}/mbedtls" +case "$TRAVIS_RUST_VERSION" in + stable|beta|nightly) + # Install the rust toolchain + rustup default $TRAVIS_RUST_VERSION + rustup target add --toolchain $TRAVIS_RUST_VERSION $TARGET + printenv + + # 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 --target $TARGET --release + cargo nextest run --features pkcs12 --target $TARGET + cargo nextest run --features pkcs12_rc2 --target $TARGET + cargo nextest run --features dsa --target $TARGET + cargo nextest run --test async_session --features=async-rt --target $TARGET + cargo nextest run --test async_session --features=async-rt,legacy_protocols --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,zlib --target $TARGET + cargo nextest run --test async_session --features=async-rt,zlib,legacy_protocols --target $TARGET + fi + + # If AES-NI is supported, test the feature + if [ -n "$AES_NI_SUPPORT" ]; then + cargo nextest run --features force_aesni_support --target $TARGET + fi + + # 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 --target $TARGET + cargo nextest run --no-default-features --features no_std_deps --target $TARGET + fi + + else + cargo +$TRAVIS_RUST_VERSION test --no-run --target=$TARGET + fi + ;; + *) + # Default case: If TRAVIS_RUST_VERSION does not match any of the above + echo "Unknown version $TRAVIS_RUST_VERSION" + exit 1 + ;; +esac diff --git a/ci_tools.sh b/ci_tools.sh new file mode 100755 index 000000000..b74b41624 --- /dev/null +++ b/ci_tools.sh @@ -0,0 +1,82 @@ +#!/bin/bash +set -ex +cd "$(dirname "$0")" + +repo_root=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) + +# Setup dependencies and tools + +# checks if a file has a specific sha512 hash +check_sha512() { + local hash="$1" + local file="$2" + local platform=$(uname) + case $platform in + Linux) + sha512sum -c <<< "$hash *$file" + ;; + Darwin) + shasum -a 512 -c <<< "$hash *$file" + ;; + MINGW64_NT-*) + sha512sum -c <<< "$hash *$file" + ;; + *) + echo "Unsupported platform '$platfom'" + exit 1 + ;; + esac +} + +# function for downloading pre-built `cargo-nextest` on various platforms +download_cargo_nextest() { + local platform="$1" + local cargo_nextest_hash="$2" + local url="$3" + echo "Check if need to download pre-built $platform 'cargo-nextest'" + if ! check_sha512 "${cargo_nextest_hash}" "${CARGO_HOME:-$HOME/.cargo}/bin/cargo-nextest"; then + case $platform in + MINGW64-*) + curl -LsSf "$url" -o temp.zip && unzip -d "${CARGO_HOME:-$HOME/.cargo}/bin" temp.zip && rm temp.zip + ;; + *) + curl -LsSf "$url" | tar zxf - -C "${CARGO_HOME:-$HOME/.cargo}/bin" + ;; + esac + check_sha512 "${cargo_nextest_hash}" "${CARGO_HOME:-$HOME/.cargo}/bin/cargo-nextest" + fi +} + +aarch64_cross_toolchain_hash=c8ee0e7fd58f5ec6811e3cec5fcdd8fc47cb2b49fb50e9d7717696ddb69c812547b5f389558f62dfbf9db7d6ad808a5a515cc466b8ea3e9ab3daeb20ba1adf33 +# save to directory that will be cached +aarch64_cross_toolchain_save_path=${repo_root}/target/aarch64-linux-musl-cross.tgz +mkdir -p ${repo_root}/target +if [ "$TARGET" == "aarch64-unknown-linux-musl" ]; then + if ! check_sha512 ${aarch64_cross_toolchain_hash} ${aarch64_cross_toolchain_save_path}; then + wget https://more.musl.cc/10-20210301/x86_64-linux-musl/aarch64-linux-musl-cross.tgz -O ${aarch64_cross_toolchain_save_path} + check_sha512 ${aarch64_cross_toolchain_hash} ${aarch64_cross_toolchain_save_path} + fi + tar -xf ${aarch64_cross_toolchain_save_path} -C /tmp; +fi + +# download pre-built `cargo-nextest` +kernel=$(uname) +architecture=$(uname -m) +case "$kernel-$architecture" in + Linux-x86_64 | Linux-amd64) + download_cargo_nextest "amd64" "d22ce5799f3056807fd0cd8223a290c7153a5f084d5ab931fce755c2cabd33f79c0f75542eb724fe07a7ca083f415ec1f84edc46584b06df43d97a0ff91018da" "https://get.nexte.st/0.9.52/linux" + ;; + Linux-arm64) + download_cargo_nextest "arm64" "cff3297c84560de8693e7f887fcf6cf33ab0036e27a9debf2b0a0832094555335f34dc30d0f9d1128ce8472dcb4594a3cf33be2357b19dcc94269b58090cc1a9" "https://get.nexte.st/0.9.52/linux-arm" + ;; + Darwin-x86_64) + download_cargo_nextest "Darwin-amd64" "0bb8b77ce019de3d06ee6b7382d830ed67309f187781e0de3866a0635879b494c7db48d55eee7553cfaa0bfca59abd8f8540a6d81ed703f06f9c81514d20073d" "https://get.nexte.st/0.9.52/mac" + ;; + MINGW64_NT-*-x86_64) + download_cargo_nextest "MINGW64-amd64" "3ffd504a4ef0b4b5e988457e6c525e62bd030d46b8f303f1c4e83a9a8ba89aef34bb239e23f391d1dddb75bea6ff074499153b2c71b06338a05d74916408de9c" "https://get.nexte.st/0.9.52/windows" + ;; + *) + echo "Unknown platform '$kernel-$architecture'" + exit 1 + ;; +esac diff --git a/ct.sh b/ct.sh deleted file mode 100755 index e636f4398..000000000 --- a/ct.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -set -ex -cd "$(dirname "$0")" - -cd "./mbedtls" - -if [ -z $TRAVIS_RUST_VERSION ]; then - echo "Expected TRAVIS_RUST_VERSION to be set in env" - exit 1 -fi - -if [ "$TARGET" == "aarch64-unknown-linux-musl" ]; then - wget https://more.musl.cc/10-20210301/x86_64-linux-musl/aarch64-linux-musl-cross.tgz -O /tmp/aarch64-linux-musl-cross.tgz - echo "c8ee0e7fd58f5ec6811e3cec5fcdd8fc47cb2b49fb50e9d7717696ddb69c812547b5f389558f62dfbf9db7d6ad808a5a515cc466b8ea3e9ab3daeb20ba1adf33 /tmp/aarch64-linux-musl-cross.tgz" | sha512sum -c - tar -xf /tmp/aarch64-linux-musl-cross.tgz -C /tmp; -fi - -export CFLAGS_x86_64_fortanix_unknown_sgx="-isystem/usr/include/x86_64-linux-gnu -mlvi-hardening -mllvm -x86-experimental-lvi-inline-asm-hardening" -export CC_x86_64_fortanix_unknown_sgx=clang-11 -export CC_aarch64_unknown_linux_musl=/tmp/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc -export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/tmp/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc -export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUNNER=qemu-aarch64 - -if [ "$TRAVIS_RUST_VERSION" == "stable" ] || [ "$TRAVIS_RUST_VERSION" == "beta" ] || [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then - # Install the rust toolchain - rustup default $TRAVIS_RUST_VERSION - rustup target add --toolchain $TRAVIS_RUST_VERSION $TARGET - - # 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 test --target $TARGET --release - cargo test --features pkcs12 --target $TARGET - cargo test --features pkcs12_rc2 --target $TARGET - cargo test --features dsa --target $TARGET - cargo test --test async_session --features=async-rt --target $TARGET - cargo test --test async_session --features=async-rt,legacy_protocols --target $TARGET - - # If zlib is installed, test the zlib feature - if [ -n "$ZLIB_INSTALLED" ]; then - cargo test --features zlib --target $TARGET - cargo test --test async_session --features=async-rt,zlib --target $TARGET - cargo test --test async_session --features=async-rt,zlib,legacy_protocols --target $TARGET - fi - - # If AES-NI is supported, test the feature - if [ -n "$AES_NI_SUPPORT" ]; then - cargo test --features force_aesni_support --target $TARGET - fi - - # no_std tests only are able to run on x86 platform - if [ "$TARGET" == "x86_64-unknown-linux-gnu" ]; then - cargo test --no-default-features --features no_std_deps,rdrand,time --target $TARGET - cargo test --no-default-features --features no_std_deps,rdrand --target $TARGET - fi - else - cargo +$TRAVIS_RUST_VERSION test --no-run --target=$TARGET - fi - -else - echo "Unknown version $TRAVIS_RUST_VERSION" - exit 1 -fi diff --git a/mbedtls-platform-support/Cargo.toml b/mbedtls-platform-support/Cargo.toml index d449bd066..dcb7825bf 100644 --- a/mbedtls-platform-support/Cargo.toml +++ b/mbedtls-platform-support/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mbedtls-platform-support" -version = "0.1.0" +version = "0.1.1" authors = ["Yuxiang Cao "] build = "build.rs" edition = "2018" diff --git a/mbedtls-platform-support/src/rust_printf.c b/mbedtls-platform-support/src/rust_printf.c index c3b2ac93c..d11d02e44 100644 --- a/mbedtls-platform-support/src/rust_printf.c +++ b/mbedtls-platform-support/src/rust_printf.c @@ -8,6 +8,12 @@ #include #include +#ifdef _WIN32 +#define alloca _alloca +#include +#else +#include +#endif extern void mbedtls_log(const char* msg); @@ -22,7 +28,7 @@ extern int mbedtls_printf(const char *fmt, ...) { return -1; n++; - char p[n]; + char *p = alloca(n); va_start(ap,fmt); n=vsnprintf(p,n,fmt,ap); diff --git a/mbedtls-platform-support/src/self_test.rs b/mbedtls-platform-support/src/self_test.rs index 659b5ea69..37bb5ffb0 100644 --- a/mbedtls-platform-support/src/self_test.rs +++ b/mbedtls-platform-support/src/self_test.rs @@ -40,18 +40,17 @@ cfg_if::cfg_if! { } } } -cfg_if::cfg_if! { - if #[cfg(any(not(feature = "std"), target_env = "sgx"))] { - #[allow(non_upper_case_globals)] - static mut rand_f: Option c_int> = None; - // needs to be pub for global visiblity - #[doc(hidden)] - #[no_mangle] - pub unsafe extern "C" fn rand() -> c_int { - rand_f.expect("Called self-test rand without enabling self-test")() - } - } +#[cfg(any(not(feature = "std"), target_env = "sgx"))] +#[allow(non_upper_case_globals)] +static mut rand_f: Option c_int> = None; + +// needs to be pub for global visiblity +#[cfg(all(any(not(feature = "std"), target_env = "sgx"), not(target_env = "msvc")))] +#[doc(hidden)] +#[no_mangle] +pub unsafe extern "C" fn rand() -> c_int { + rand_f.expect("Called self-test rand without enabling self-test")() } /// Set callback functions to enable the MbedTLS self tests. diff --git a/mbedtls-sys/Cargo.toml b/mbedtls-sys/Cargo.toml index 9a8f40975..449a7eae9 100644 --- a/mbedtls-sys/Cargo.toml +++ b/mbedtls-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mbedtls-sys-auto" -version = "2.28.3" +version = "2.28.3+patch1" authors = ["Jethro Beekman "] build = "build/build.rs" license = "Apache-2.0 OR GPL-2.0-or-later" @@ -26,8 +26,11 @@ libc = { version = "0.2.0", optional = true } [target.'cfg(unix)'.dependencies] libc = { version = "0.2.0" } +[target.'cfg(windows)'.dependencies] +libc = { version = "0.2.0" } + [build-dependencies] -bindgen = "0.58.0" +bindgen = { version = "0.65.1" } cmake = "0.1.17" cc = "1.0.45" lazy_static = "1.4" diff --git a/mbedtls-sys/build/bindgen.rs b/mbedtls-sys/build/bindgen.rs index 7fd2fe2f6..ba246637f 100644 --- a/mbedtls-sys/build/bindgen.rs +++ b/mbedtls-sys/build/bindgen.rs @@ -88,12 +88,13 @@ impl super::BuildConfig { } let mut cc = cc::Build::new(); - cc.include(&self.mbedtls_include) - .flag(&format!( - "-DMBEDTLS_CONFIG_FILE=\"{}\"", - self.config_h.to_str().expect("config.h UTF-8 error") - )); - + if cc.get_compiler().is_like_msvc() { + cc.flag("--driver-mode=cl"); + } + cc.include(&self.mbedtls_include).define( + "MBEDTLS_CONFIG_FILE", + Some(format!(r#""{}""#, self.config_h.to_str().expect("config.h UTF-8 error")).as_str()), + ); for cflag in &self.cflags { cc.flag(cflag); } @@ -125,6 +126,7 @@ impl super::BuildConfig { .allowlist_var("^(?i)mbedtls_.*") .allowlist_recursively(false) .blocklist_type("^mbedtls_time_t$") + .blocklist_item("^(?i)mbedtls_.*vsnprintf") .use_core() .ctypes_prefix("::types::raw_types") .parse_callbacks(Box::new(MbedtlsParseCallbacks)) @@ -135,7 +137,6 @@ impl super::BuildConfig { .derive_default(true) .prepend_enum_name(false) .translate_enum_integer_types(true) - .rustfmt_bindings(false) .raw_line("#![allow(dead_code, deref_nullptr, non_snake_case, non_camel_case_types, non_upper_case_globals, invalid_value)]") .generate() .expect("bindgen error") diff --git a/mbedtls-sys/build/cmake.rs b/mbedtls-sys/build/cmake.rs index 91e6e815f..0d0545343 100644 --- a/mbedtls-sys/build/cmake.rs +++ b/mbedtls-sys/build/cmake.rs @@ -17,7 +17,9 @@ impl super::BuildConfig { )) .define("ENABLE_PROGRAMS", "OFF") .define("ENABLE_TESTING", "OFF") - .build_target("lib"); + // This is turn off on windows by default + .define("GEN_FILES", "ON") + .build_target("install"); for cflag in &self.cflags { cmk.cflag(cflag); } @@ -40,16 +42,7 @@ impl super::BuildConfig { let mut dst = cmk.build(); - dst.push("build"); - dst.push("library"); - println!( - "cargo:rustc-link-search=native={}", - dst.to_str().expect("link-search UTF-8 error") - ); - - assert!(dst.pop()); - dst.push("crypto"); - dst.push("library"); + dst.push("lib"); println!( "cargo:rustc-link-search=native={}", dst.to_str().expect("link-search UTF-8 error") diff --git a/mbedtls-sys/build/features.rs b/mbedtls-sys/build/features.rs index f024033b9..5b3048752 100644 --- a/mbedtls-sys/build/features.rs +++ b/mbedtls-sys/build/features.rs @@ -45,14 +45,14 @@ impl Features { } } if let Some(components) = self.with_feature("std") { - if env_have_target_cfg("family", "unix") { + if env_have_target_cfg("family", "unix") || env_have_target_cfg("family", "windows") { components.insert("net"); components.insert("fs"); components.insert("entropy"); } } if let Some(components) = self.with_feature("time") { - if !have_custom_gmtime_r && env_have_target_cfg("family", "unix") { + if !have_custom_gmtime_r && (env_have_target_cfg("family", "unix") || env_have_target_cfg("family", "windows")) { components.insert("libc"); } else { components.insert("custom"); diff --git a/mbedtls-sys/src/types.rs b/mbedtls-sys/src/types.rs index 84fd46e5d..8672febd7 100644 --- a/mbedtls-sys/src/types.rs +++ b/mbedtls-sys/src/types.rs @@ -76,7 +76,7 @@ pub mod raw_types { } } -#[cfg(unix)] +#[cfg(any(unix, windows))] extern crate libc; #[cfg(std_component = "fs")] diff --git a/mbedtls/Cargo.toml b/mbedtls/Cargo.toml index 61ca28004..6b1be9129 100644 --- a/mbedtls/Cargo.toml +++ b/mbedtls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "mbedtls" -version = "0.9.2" +version = "0.9.3" authors = ["Jethro Beekman "] build = "build.rs" edition = "2018" diff --git a/mbedtls/src/pk/mod.rs b/mbedtls/src/pk/mod.rs index b71daffef..e91f63281 100644 --- a/mbedtls/src/pk/mod.rs +++ b/mbedtls/src/pk/mod.rs @@ -41,9 +41,9 @@ pub use crate::ecp::EcGroup; pub use dhparam::Dhm; // SHA-256("Fortanix")[:4] -const CUSTOM_PK_TYPE: pk_type_t = 0x8b205408 as pk_type_t; +const CUSTOM_PK_TYPE: pk_type_t = 0x8b205408u32 as pk_type_t; -const RAW_RSA_DECRYPT : i32 = 1040451858; +const RAW_RSA_DECRYPT: i32 = 1040451858; define!( #[c_ty(pk_type_t)] @@ -116,7 +116,7 @@ unsafe extern "C" fn free_custom_pk_ctx(p: *mut c_void) { let _ = Box::from_raw(p as *mut CustomPkContext); } -extern "C" fn custom_pk_can_do(_t: u32) -> i32 { +unsafe extern "C" fn custom_pk_can_do(_t: pk_type_t) -> types::raw_types::c_int { 0 } diff --git a/mbedtls/tests/support/mod.rs b/mbedtls/tests/support/mod.rs index 243c1ee6b..ba4607f6b 100644 --- a/mbedtls/tests/support/mod.rs +++ b/mbedtls/tests/support/mod.rs @@ -9,6 +9,7 @@ #![allow(dead_code)] pub mod entropy; pub mod keys; +#[cfg(unix)] #[cfg(sys_std_component = "net")] pub mod net; pub mod rand;