From 69b1bf4da9ef3f41c8ea0388bc45c80409878b4b Mon Sep 17 00:00:00 2001 From: Fethbita Date: Mon, 7 Oct 2024 19:18:20 +0300 Subject: [PATCH] Initial version of CI/CD (#5) Adds 2 workflows, 1 for creating a Rust docker image, 1 for running build, tests, audit, msrv check and linting. --- .cargo/config.toml | 3 + .github/workflows/docker-image.yml | 31 ++++ .github/workflows/rust.yml | 27 ++++ Cargo.lock | 237 +++++++++++++---------------- Cargo.toml | 12 +- Dockerfile | 23 +++ examples/read_emrtd.rs | 1 + src/lib.rs | 5 +- 8 files changed, 198 insertions(+), 141 deletions(-) create mode 100644 .cargo/config.toml create mode 100644 .github/workflows/docker-image.yml create mode 100644 .github/workflows/rust.yml create mode 100644 Dockerfile diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..af40dd9 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[build] +rustflags = ["-C", "target-feature=-crt-static"] +rustdocflags = ["-C", "target-feature=-crt-static"] diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..a989b92 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,31 @@ +name: Build and Push Docker Image +on: + push: + paths: ['Dockerfile', '.github/workflows/docker-image.yml'] +env: + CONTAINER_REGISTRY: ${{ vars.CONTAINER_REGISTRY }} + CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_IMAGE_NAME }} +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Login to container registry + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 + with: + registry: ${{ env.CONTAINER_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - if: github.ref_name == github.event.repository.default_branch + name: Build and push + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + with: + push: true + tags: ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_IMAGE_NAME }}:${{ github.sha }} + - if: github.ref_name != github.event.repository.default_branch + name: Build and push + uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 + with: + push: true + tags: ${{ env.CONTAINER_REGISTRY }}/${{ env.CONTAINER_IMAGE_NAME }}:${{ github.sha }} diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml new file mode 100644 index 0000000..0eb85b0 --- /dev/null +++ b/.github/workflows/rust.yml @@ -0,0 +1,27 @@ +name: Rust +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] +env: + CARGO_TERM_COLOR: always +jobs: + build: + runs-on: ubuntu-latest + container: + image: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_NAME }}:latest + steps: + - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 #v4.2.0 + - name: Build + run: cargo build --all-features --verbose + - name: Run tests + run: cargo test --all-features --verbose + - name: Audit + run: cargo audit + - name: Check rust version in Cargo.toml + run: cargo msrv verify -- cargo check --all-features --tests + - name: Lint + run: cargo clippy -- -D warnings + - name: Build release + run: cargo build --release --verbose diff --git a/Cargo.lock b/Cargo.lock index 279b7b6..20f220a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "aes" version = "0.8.4" @@ -30,30 +15,15 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.73" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" @@ -63,9 +33,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitvec" @@ -81,9 +51,9 @@ dependencies = [ [[package]] name = "bitvec-nom2" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4863ce31b7ff8812568eaffe956024c824d845a1f9f08c329706166c357cae53" +checksum = "d988fcc40055ceaa85edc55875a08f8abd29018582647fd82ad6128dba14a5f0" dependencies = [ "bitvec", "nom", @@ -107,11 +77,17 @@ dependencies = [ "generic-array", ] +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" [[package]] name = "cbc" @@ -124,9 +100,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.99" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c51067fd44124faa7f870b4b1c969379ad32b2ba805aa959430ceaa384f695" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -161,21 +140,21 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "const_panic" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" +checksum = "013b6c2c3a14d678f38cd23994b02da3a1a1b6a5d1eedddfe63a5a5f11b13a81" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -252,9 +231,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "emrtd" @@ -321,12 +300,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - [[package]] name = "heck" version = "0.4.1" @@ -358,12 +331,6 @@ dependencies = [ "either", ] -[[package]] -name = "jzon" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ab85f84ca42c5ec520e6f3c9966ba1fd62909ce260f8837e248857d2560509" - [[package]] name = "konst" version = "0.3.9" @@ -386,27 +353,27 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.155" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" @@ -414,15 +381,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87dfd01fe195c66b572b37921ad8803d010623c0aca821bea2302239d155cdae" -dependencies = [ - "adler", -] - [[package]] name = "nom" version = "7.1.3" @@ -445,9 +403,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ "num-integer", "num-traits", @@ -471,28 +429,19 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.36.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" -version = "1.19.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -509,23 +458,23 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] name = "openssl-src" -version = "300.3.1+3.3.1" +version = "300.3.2+3.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" +checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -567,30 +516,33 @@ checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro2" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22244ce15aa966053a896d1accb3a6e68469b97c7f33f284b99f0d576879fc23" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -633,9 +585,9 @@ dependencies = [ [[package]] name = "rasn" -version = "0.14.0" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39df916fdbba892afb9a7e91f4117c58ba36b14a236aa45bfa12fcf623641051" +checksum = "18a659e5423da2252a602b220c3c58165a3b6b2fa8c88abf04b7118e7013f27d" dependencies = [ "arrayvec", "bitvec", @@ -643,7 +595,6 @@ dependencies = [ "bytes", "chrono", "either", - "jzon", "konst", "nom", "num-bigint", @@ -656,9 +607,9 @@ dependencies = [ [[package]] name = "rasn-cms" -version = "0.14.0" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64dab1e050200fd6275ab8b8c4fe7f4a5fb61704e164a06a65a871fde6f4ea46" +checksum = "d0bfcbdb2c996bcfc36081134abc69a2628246628ff748996289784c0c4e5e24" dependencies = [ "rasn", "rasn-pkix", @@ -666,9 +617,9 @@ dependencies = [ [[package]] name = "rasn-derive" -version = "0.14.0" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e81213825a788a1afeab661c7ecdbaf55c06cefca003a4f1dd14d1d9d854d55" +checksum = "3935c98446174a7d802b4ac0f369daf7e8af8acdefe35e7d6e67f20b46d1c530" dependencies = [ "either", "itertools", @@ -681,9 +632,9 @@ dependencies = [ [[package]] name = "rasn-pkix" -version = "0.14.0" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3057c6097bf90ad2eb670bda73836eef3b79bbeda40f07f551bcb6d219b5813" +checksum = "095ebade18d4180e11e3f01076397debccf082cae702bfc6dda70b878b5b7770" dependencies = [ "rasn", ] @@ -708,12 +659,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "sha1" version = "0.10.6" @@ -755,6 +700,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "smallvec" version = "1.13.2" @@ -767,7 +718,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" dependencies = [ - "backtrace", "doc-comment", "snafu-derive", ] @@ -797,9 +747,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.66" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -841,7 +791,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.66", + "syn 2.0.79", ] [[package]] @@ -902,15 +852,15 @@ checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "uuid" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" dependencies = [ "getrandom", ] @@ -929,9 +879,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -969,3 +919,24 @@ checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" dependencies = [ "tap", ] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] diff --git a/Cargo.toml b/Cargo.toml index aec5bdb..701ae49 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "emrtd" version = "0.0.2" authors = ["Burak Can Kus"] edition = "2021" -rust-version = "1.66.1" +rust-version = "1.75.0" description = "A library that can read an eMRTD and do security checks." readme = "README.md" repository = "https://github.com/Fethbita/emrtd" @@ -22,13 +22,13 @@ tracing = "0.1.40" tracing-subscriber = "0.3.18" sha1-checked = "0.10.0" sha2 = "0.10.8" -constant_time_eq = "0.3.0" +constant_time_eq = "0.3.1" rand = { version = "0.8.5", features = ["getrandom"] } -openssl = { version = "0.10.64", features = ["vendored"], optional = true } -rasn = { version = "0.14.0", optional = true} -rasn-cms = { version = "0.14.0", optional = true} -rasn-pkix = { version = "0.14.0", optional = true} +openssl = { version = "0.10.66", features = ["vendored"], optional = true } +rasn = { version = "0.16.6", optional = true} +rasn-cms = { version = "0.16.6", optional = true} +rasn-pkix = { version = "0.16.6", optional = true} [dev-dependencies] hex-literal = "0.4.1" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5850478 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Base image with Rust and Alpine +FROM rust:1.81-alpine3.20 AS builder + +# Install system dependencies and tools needed for Rust and your project +RUN apk update && \ + apk add --no-cache \ + # For pcsc dependency + pcsc-lite-dev \ + # For tracing-attributes dependency (needs crti.o) + musl-dev \ + # For OpenSSL dependency + pkgconf \ + openssl-dev \ + gcc \ + make \ + perl-dev \ + # For cargo-msrv + openssl-libs-static && \ + # Install clippy + rustup component add clippy && \ + # Install cargo-audit and cargo-msrv + cargo install --version 0.20.1 cargo-audit && \ + cargo install --version 0.15.1 cargo-msrv diff --git a/examples/read_emrtd.rs b/examples/read_emrtd.rs index 20b4032..c4e3284 100644 --- a/examples/read_emrtd.rs +++ b/examples/read_emrtd.rs @@ -89,6 +89,7 @@ fn main() -> Result<(), EmrtdError> { let ef_sod = sm_object.read_data_from_ef(true)?; info!("Data from the EF.SOD: {}", bytes2hex(&ef_sod)); + #[cfg(feature = "passive_auth")] let result; #[cfg(feature = "passive_auth")] { diff --git a/src/lib.rs b/src/lib.rs index 945a248..739daff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -112,6 +112,7 @@ //! let ef_sod = sm_object.read_data_from_ef(true)?; //! info!("Data from the EF.SOD: {}", bytes2hex(&ef_sod)); //! +//! #[cfg(feature = "passive_auth")] //! let result; //! #[cfg(feature = "passive_auth")] //! { @@ -2884,7 +2885,7 @@ impl EmrtdComms { } let padded_header = padding_method_2(&apdu.get_command_header(), pad_len)?; - let n = padding_method_2(&[&ssc, (&*padded_header), &payload].concat(), pad_len)?; + let n = padding_method_2(&[ssc, (&*padded_header), &payload].concat(), pad_len)?; let cc = compute_mac(ks_mac, &n, mac_alg)?; let do8e = [b"\x8E", (&*int2asn1len(cc.len())), &cc].concat(); @@ -3024,7 +3025,7 @@ impl EmrtdComms { let k = padding_method_2( &[ - &ssc, + ssc, do85.unwrap_or_default(), do87.unwrap_or_default(), do99.unwrap_or_default(),