diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 00000000..0e6921c9 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,35 @@ +name: Nightly Checks + +on: + schedule: + # Every night at midnight + - cron: '0 0 * * *' + +jobs: + dependencies: + name: Check for unused dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install latest Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + - name: Install cargo udeps + run: cargo install cargo-udeps --locked + - name: Execute cargo udeps + run: cargo +nightly udeps + + audit: + name: Check for crates with security vulnerabilities + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install latest Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + - name: Install cargo audit + run: cargo install cargo-audit + - name: Execute cargo audit + run: cargo audit diff --git a/Cargo.lock b/Cargo.lock index 376066ab..336ff47e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,20 +1,5 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" - [[package]] name = "aho-corasick" version = "0.7.13" @@ -39,15 +24,6 @@ version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b602bfe940d21c130f3895acd65221e8a61270debe89d628b9cb4e3ccb8569b" -[[package]] -name = "arbitrary" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb544f1057eaaff4b34f8c4dcf56fc3cd04debd291998405d135017a7c3c0f4" -dependencies = [ - "derive_arbitrary", -] - [[package]] name = "arc-swap" version = "0.4.7" @@ -73,32 +49,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "backtrace" -version = "0.3.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.10.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "base64" @@ -118,9 +71,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.54.1" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4d49b80beb70d76cdac92f5681e666f9a697c737c4f4117a67229a0386dc736" +checksum = "66c0bb6167449588ff70803f4127f0684f9063097eca5016f37eb52b92c2cf36" dependencies = [ "bitflags", "cexpr", @@ -179,17 +132,6 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" -[[package]] -name = "cargo_toml" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed092b004819e731a68f8a99afb6e07ddb9160810beafbe9d68b952ff09c73a" -dependencies = [ - "serde", - "serde_derive", - "toml 0.5.6", -] - [[package]] name = "cc" version = "1.0.59" @@ -274,17 +216,6 @@ dependencies = [ "syn", ] -[[package]] -name = "derive_arbitrary" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b43185d3e7ce7dcd44a23ca761ec026359753ebf480283a571e6463853d2ef" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "digest" version = "0.9.0" @@ -333,40 +264,12 @@ dependencies = [ "termcolor", ] -[[package]] -name = "failure" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32e9bd16cc02eae7db7ef620b392808b89f6a5e16bb3497d159c6b92a0f4f86" -dependencies = [ - "backtrace", - "failure_derive", -] - -[[package]] -name = "failure_derive" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4da3c766cd7a0db8242e326e9e4e081edd567072893ed320008189715366a4" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - [[package]] name = "fixedbitset" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "generic-array" version = "0.14.4" @@ -379,21 +282,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", ] -[[package]] -name = "gimli" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" - [[package]] name = "glob" version = "0.3.0" @@ -402,12 +299,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" [[package]] name = "hashbrown" -version = "0.8.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b62f79061a0bc2e046024cb7ba44b08419ed238ecbd9adbd787434b9e8c25" -dependencies = [ - "autocfg 1.0.0", -] +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" [[package]] name = "heck" @@ -439,17 +333,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70b8bcb948d9f63a35f0527cde7ca4f4794e817451eaebd47a3c92ef6905c129" -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - [[package]] name = "humantime" version = "1.3.0" @@ -461,11 +344,11 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b45e59b16c76b11bf9738fd5d38879d3bd28ad292d7b313608becb17ae2df9" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "hashbrown", ] @@ -478,17 +361,11 @@ dependencies = [ "either", ] -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - [[package]] name = "js-sys" -version = "0.3.44" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7e2c92a4804dd459b86c339278d0fe87cf93757fae222c3fa3ae75458bc73" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ "wasm-bindgen", ] @@ -510,9 +387,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.76" +version = "0.2.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" [[package]] name = "libloading" @@ -557,20 +434,11 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" -[[package]] -name = "miniz_oxide" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" -dependencies = [ - "adler", -] - [[package]] name = "multimap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" +checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" [[package]] name = "nom" @@ -584,11 +452,11 @@ dependencies = [ [[package]] name = "num" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" +checksum = "ab3e176191bc4faad357e3122c4747aa098ac880e88b168f106386128736cf4a" dependencies = [ - "num-bigint", + "num-bigint 0.3.0", "num-complex", "num-integer", "num-iter", @@ -602,7 +470,18 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f3fc75e3697059fb1bc465e3d8cca6cf92f56854f201158b3f9c77d5a3cfa0" +dependencies = [ + "autocfg 1.0.1", "num-integer", "num-traits", ] @@ -628,11 +507,10 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" +checksum = "b05ad05bd8977050b171b3f6b48175fea6e0565b7981059b486075e1026a9fb5" dependencies = [ - "autocfg 1.0.0", "num-traits", ] @@ -653,7 +531,7 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-traits", ] @@ -663,19 +541,19 @@ version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", "num-integer", "num-traits", ] [[package]] name = "num-rational" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c000134b5dbf44adc5cb772486d335293351644b801551abe8f75c84cfa4aef" +checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" dependencies = [ - "autocfg 1.0.0", - "num-bigint", + "autocfg 1.0.1", + "num-bigint 0.3.0", "num-integer", "num-traits", ] @@ -686,7 +564,7 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ - "autocfg 1.0.0", + "autocfg 1.0.1", ] [[package]] @@ -699,12 +577,6 @@ dependencies = [ "libc", ] -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - [[package]] name = "oid" version = "0.1.1" @@ -728,11 +600,10 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "parsec-interface" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006e9052de199ff866fa1bf6cdd41f37d118cb299ccea7ad2498ef0ff66e6abc" +checksum = "275562850cb6ba82ce17d840cef8279f9649441bc596262e7dd92983e77257b6" dependencies = [ - "arbitrary", "bincode", "derivative", "log", @@ -752,10 +623,8 @@ dependencies = [ name = "parsec-service" version = "0.4.0" dependencies = [ - "base64 0.10.1", + "base64", "bincode", - "bindgen", - "cargo_toml", "derivative", "env_logger", "hex", @@ -763,23 +632,21 @@ dependencies = [ "libc", "log", "parsec-interface", - "picky", - "picky-asn1 0.3.0", + "picky-asn1", "picky-asn1-der", - "picky-asn1-x509 0.3.2", + "picky-asn1-x509", "pkcs11", "psa-crypto", "rand", "ring", - "rsa 0.3.0", + "rsa", "sd-notify", "serde", "sha2", "signal-hook", - "std-semaphore", "structopt", "threadpool", - "toml 0.4.10", + "toml", "tss-esapi", "users", "uuid", @@ -799,7 +666,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59698ea79df9bf77104aefd39cc3ec990cb9693fb59c3b0a70ddf2646fdffb4b" dependencies = [ - "base64 0.12.3", + "base64", "once_cell", "regex", ] @@ -814,38 +681,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "picky" -version = "5.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b99e7ddea4cc93ce732ccbc714eb8f600b24ac33fa818f37fc38e68e08937e9" -dependencies = [ - "base64 0.12.3", - "http", - "oid", - "picky-asn1 0.2.2", - "picky-asn1-der", - "picky-asn1-x509 0.1.0", - "rand", - "rsa 0.2.0", - "serde", - "serde_json", - "sha-1", - "sha2", - "thiserror", -] - -[[package]] -name = "picky-asn1" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faabc00f1580e19b64a9329c6cedeec00a4f877b6845e744a25c6ca616a6a901" -dependencies = [ - "oid", - "serde", - "serde_bytes", -] - [[package]] name = "picky-asn1" version = "0.3.0" @@ -859,49 +694,36 @@ dependencies = [ [[package]] name = "picky-asn1-der" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1870d13b5ce802665d715a6a0b551ad48f27d0f5689a5951697cf00cab64f09a" +checksum = "233e556fc14cd42f38290ecd53f23a9fe047df2837d3d7494d27872b40a64bca" dependencies = [ - "picky-asn1 0.2.2", + "picky-asn1", "serde", "serde_bytes", ] -[[package]] -name = "picky-asn1-x509" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969171630cdf5c269611dfffdc1e6d749365fc4059b86fe3620d8afa3ddce4e6" -dependencies = [ - "base64 0.12.3", - "oid", - "picky-asn1 0.2.2", - "picky-asn1-der", - "serde", -] - [[package]] name = "picky-asn1-x509" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d79146ca2d1a8fdbe9f2653a04cc8914acd9e5702b052c08100d99f629b626bf" dependencies = [ - "base64 0.12.3", + "base64", "oid", - "picky-asn1 0.3.0", + "picky-asn1", "picky-asn1-der", "serde", ] [[package]] name = "pkcs11" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45712272d3a9d9a26471f6bee1596574d38df0136dd7eb163ed736913dc1f6bf" +checksum = "3aca6d67e4c8613bfe455599d0233d00735f85df2001f6bfd9bb7ac0496b10af" dependencies = [ "libloading", - "num-bigint", + "num-bigint 0.2.6", ] [[package]] @@ -942,9 +764,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.19" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" +checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" dependencies = [ "unicode-xid", ] @@ -1002,9 +824,9 @@ dependencies = [ [[package]] name = "psa-crypto" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d80d471f8c332a6e65537c530f10f5f2f8588b06ceb79408eb82e0b92015726" +checksum = "cb8cd6b7efe9e3853f86c82f89763a070df8b7caf8c289bf0074acbf8470fd11" dependencies = [ "log", "psa-crypto-sys", @@ -1138,24 +960,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rsa" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed8692d8e0ea3baae03f0f32ecfc13a6c6f1f85fcd6d9fdefcdf364e70f4df9" -dependencies = [ - "byteorder", - "failure", - "lazy_static", - "num-bigint-dig", - "num-integer", - "num-iter", - "num-traits", - "rand", - "subtle", - "zeroize", -] - [[package]] name = "rsa" version = "0.3.0" @@ -1178,12 +982,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - [[package]] name = "rustc-hash" version = "1.1.0" @@ -1199,12 +997,6 @@ dependencies = [ "semver", ] -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - [[package]] name = "same-file" version = "1.0.6" @@ -1222,9 +1014,9 @@ checksum = "aef40838bbb143707f8309b1e92e6ba3225287592968ba6f6e3b6de4a9816486" [[package]] name = "secrecy" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9182278ed645df3477a9c27bfee0621c621aa16f6972635f7f795dae3d81070f" +checksum = "0673d6a6449f5e7d12a1caf424fd9363e2af3a4953023ed455e3c4beef4597c0" dependencies = [ "serde", "zeroize", @@ -1274,30 +1066,6 @@ dependencies = [ "syn", ] -[[package]] -name = "serde_json" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164eacbdb13512ec2745fb09d51fd5b22b0d65ed294a1dcf7285a360c80a675c" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha-1" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" -dependencies = [ - "block-buffer", - "cfg-if", - "cpuid-bool", - "digest", - "opaque-debug", -] - [[package]] name = "sha2" version = "0.9.1" @@ -1344,7 +1112,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" dependencies = [ "chrono", - "num-bigint", + "num-bigint 0.2.6", "num-traits", ] @@ -1366,12 +1134,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "std-semaphore" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ae9eec00137a8eed469fb4148acd9fc6ac8c3f9b110f52cd34698c8b5bfa0e" - [[package]] name = "strsim" version = "0.8.0" @@ -1380,9 +1142,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "structopt" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5472fb24d7e80ae84a7801b7978f95a19ec32cb1876faea59ab711eb901976" +checksum = "6cc388d94ffabf39b5ed5fadddc40147cb21e605f53db6f8f36a625d27489ac5" dependencies = [ "clap", "lazy_static", @@ -1391,9 +1153,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0eb37335aeeebe51be42e2dc07f031163fbabfa6ac67d7ea68b5c2f68d5f99" +checksum = "5e2513111825077552a6751dfad9e11ce0fba07d7276a3943a037d7e93e64c5f" dependencies = [ "heck", "proc-macro-error", @@ -1404,15 +1166,15 @@ dependencies = [ [[package]] name = "subtle" -version = "2.2.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" +checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e69abc24912995b3038597a7a593be5053eb0fb44f3cc5beec0deb421790c1f4" +checksum = "963f7d3cc59b59b9325165add223142bbf1df27655d07789f109896d353d8350" dependencies = [ "proc-macro2", "quote", @@ -1503,23 +1265,15 @@ dependencies = [ [[package]] name = "time" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" dependencies = [ "libc", + "wasi 0.10.0+wasi-snapshot-preview1", "winapi", ] -[[package]] -name = "toml" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -dependencies = [ - "serde", -] - [[package]] name = "toml" version = "0.5.6" @@ -1591,9 +1345,9 @@ dependencies = [ [[package]] name = "uuid" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90dbc611eb48397705a6b0f6e917da23ae517e4d127123d2cf7674206627d32a" +checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" [[package]] name = "vec_map" @@ -1630,11 +1384,17 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasm-bindgen" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1642,9 +1402,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc71e4c5efa60fb9e74160e89b93353bc24059999c0ae0fb03affc39770310b0" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", @@ -1657,9 +1417,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c57cefa5fa80e2ba15641578b44d36e7a64279bc5ed43c6dbaf329457a2ed2" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1667,9 +1427,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2", "quote", @@ -1680,15 +1440,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b162580e34310e5931c4b792560108b10fd14d64915d7fff8ff00180e70092" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "web-sys" -version = "0.3.44" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 49c34575..eaf50547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,55 +18,46 @@ name = "parsec" path = "src/bin/main.rs" [dependencies] -parsec-interface = "0.20.0" -rand = { version = "0.7.2", features = ["small_rng"] } -base64 = "0.10.1" -uuid = "0.7.4" -threadpool = "1.7.1" -std-semaphore = "0.1.0" -signal-hook = "0.1.10" -sd-notify = { version = "0.1.1" } -toml = "0.4.2" -serde = { version = "1.0", features = ["derive"] } +parsec-interface = "0.20.2" +rand = { version = "0.7.3", features = ["small_rng"], optional = true } +base64 = "0.12.3" +uuid = "0.8.1" +threadpool = "1.8.1" +signal-hook = "0.1.16" +sd-notify = "0.1.1" +toml = "0.5.6" +serde = { version = "1.0.115", features = ["derive"] } env_logger = "0.7.1" -log = { version = "0.4.8", features = ["serde"] } -pkcs11 = { version = "0.4.0", optional = true } -picky-asn1-der = { version = "0.2.2", optional = true } +log = { version = "0.4.11", features = ["serde"] } +pkcs11 = { version = "0.5.0", optional = true } +picky-asn1-der = { version = "0.2.4", optional = true } picky-asn1 = { version = "0.3.0", optional = true } tss-esapi = { version = "4.0.9-alpha.1", optional = true } -bincode = "1.1.4" -structopt = "0.3.5" +bincode = "1.3.1" +structopt = "0.3.17" derivative = "2.1.1" version = "3.0.0" -hex = "0.4.2" -picky = "5.0.0" -psa-crypto = { version = "0.5.0" , default-features = false, features = ["operations"], optional = true } +hex = { version = "0.4.2", optional = true } +psa-crypto = { version = "0.5.1", default-features = false, features = ["operations"], optional = true } zeroize = { version = "1.1.0", features = ["zeroize_derive"] } picky-asn1-x509 = { version = "0.3.2", optional = true } users = "0.10.0" -libc = "0.2.72" +libc = "0.2.77" [dev-dependencies] -ring = "0.16.12" +ring = "0.16.15" lazy_static = "1.4.0" rsa = "0.3.0" rand = "0.7.3" sha2 = "0.9.1" -[build-dependencies] -bindgen = "0.54.0" -cargo_toml = "0.7.0" -toml = "0.4.2" -serde = { version = "1.0", features = ["derive"] } - [package.metadata.docs.rs] -features = ["docs"] +features = ["pkcs11-provider", "tpm-provider", "tss-esapi/docs", "mbed-crypto-provider"] [features] default = [] no-parsec-user-and-clients-group = [] mbed-crypto-provider = ["psa-crypto"] -pkcs11-provider = ["pkcs11", "picky-asn1-der", "picky-asn1", "picky-asn1-x509", "psa-crypto"] -tpm-provider = ["tss-esapi", "picky-asn1-der", "picky-asn1", "picky-asn1-x509"] +pkcs11-provider = ["pkcs11", "picky-asn1-der", "picky-asn1", "picky-asn1-x509", "psa-crypto", "rand"] +tpm-provider = ["tss-esapi", "picky-asn1-der", "picky-asn1", "picky-asn1-x509", "hex"] all-providers = ["tpm-provider", "pkcs11-provider", "mbed-crypto-provider"] -docs = ["pkcs11-provider", "tpm-provider", "tss-esapi/docs", "mbed-crypto-provider"] diff --git a/README.md b/README.md index b3c3a131..5a38552f 100644 --- a/README.md +++ b/README.md @@ -81,39 +81,3 @@ need any ideas 🙂! # License The software is provided under Apache-2.0. Contributions to this project are accepted under the same license. - -This project uses the following third party crates: -* serde (MIT and Apache-2.0) -* bindgen (BSD-3-Clause) -* cargo\_toml (Apache-2.0) -* toml (MIT and Apache-2.0) -* rand (MIT and Apache-2.0) -* base64 (MIT and Apache-2.0) -* uuid (MIT and Apache-2.0) -* threadpool (MIT and Apache-2.0) -* std-semaphore (MIT and Apache-2.0) -* num\_cpus (MIT and Apache-2.0) -* signal-hook (MIT and Apache-2.0) -* sd-notify (MIT and Apache-2.0) -* log (MIT and Apache-2.0) -* env\_logger (MIT and Apache-2.0) -* pkcs11 (Apache-2.0) -* picky-asn1-der (MIT and Apache-2.0) -* picky-asn1 (MIT and Apache-2.0) -* picky-asn1-x509 (MIT and Apache-2.0) -* bincode (MIT) -* structopt (MIT and Apache-2.0) -* derivative (MIT and Apache-2.0) -* arbitrary (MIT and Apache-2.0) -* libfuzzer-sys (MIT, Apache-2.0 and NCSA) -* flexi_logger (MIT and Apache-2.0) -* lazy_static (MIT and Apache-2.0) -* version (MIT and Apache-2.0) -* sha2 (MIT and Apache-2.0) -* hex (MIT and Apache-2.0) -* picky (MIT and Apache-2.0) -* users (MIT) -* libc (MIT and Apache-2.0) - -This project uses the following third party libraries: -* [**Mbed Crypto**](https://github.com/ARMmbed/mbed-crypto) (Apache-2.0) diff --git a/e2e_tests/Cargo.toml b/e2e_tests/Cargo.toml index 04ce48ca..212317a2 100644 --- a/e2e_tests/Cargo.toml +++ b/e2e_tests/Cargo.toml @@ -13,20 +13,20 @@ edition = "2018" publish = false [dependencies] -num_cpus = "1.13.0" -picky-asn1-der = "0.2.2" -picky-asn1 = "0.2.1" -serde = { version = "1.0", features = ["derive"] } -sha2 = "0.9.1" +serde = { version = "1.0.115", features = ["derive"] } parsec-client = { version = "0.9.0", features = ["testing"] } -log = "0.4.8" +log = "0.4.11" rand = "0.7.3" [dev-dependencies] env_logger = "0.7.1" rsa = "0.3.0" -picky-asn1-x509 = "0.1.0" +picky-asn1-x509 = "0.3.2" base64 = "0.12.3" +num_cpus = "1.13.0" +picky-asn1-der = "0.2.4" +picky-asn1 = "0.3.0" +sha2 = "0.9.1" [features] mbed-crypto-provider = [] diff --git a/e2e_tests/provider_cfg/mbed-crypto/Dockerfile b/e2e_tests/provider_cfg/mbed-crypto/Dockerfile index d8f1ff98..fd9cf1f3 100644 --- a/e2e_tests/provider_cfg/mbed-crypto/Dockerfile +++ b/e2e_tests/provider_cfg/mbed-crypto/Dockerfile @@ -8,10 +8,6 @@ RUN apt-get update && \ apt-get install -y pkg-config libssl-dev WORKDIR /tmp -RUN wget https://github.com/ARMmbed/mbed-crypto/archive/mbedcrypto-2.0.0.tar.gz -RUN tar xf mbedcrypto-2.0.0.tar.gz -RUN cd mbed-crypto-mbedcrypto-2.0.0 \ - && make # Install Rust toolchain RUN curl https://sh.rustup.rs -sSf | bash -s -- -y diff --git a/e2e_tests/tests/per_provider/normal_tests/aead.rs b/e2e_tests/tests/per_provider/normal_tests/aead.rs index 415a215e..1d5945f2 100644 --- a/e2e_tests/tests/per_provider/normal_tests/aead.rs +++ b/e2e_tests/tests/per_provider/normal_tests/aead.rs @@ -15,7 +15,9 @@ const ADDITIONAL_DATA: [u8; 32] = [ 0xa2, 0x01, 0xcc, 0xe4, 0x9f, 0x19, 0x99, 0x7d, 0x19, 0x20, 0x6d, 0x8c, 0x8a, 0x34, 0x39, 0x51, ]; const PLAINTEXT: [u8; 24] = [ - 0x45, 0x35, 0xd1, 0x2b, 0x43, 0x77, 0x92, 0x8a, 0x7c, 0x0a, 0x61, 0xc9, 0xf8, 0x25, 0xa4, 0x86, 0x71, 0xea, 0x05, 0x91, 0x07, 0x48, 0xc8, 0xef]; + 0x45, 0x35, 0xd1, 0x2b, 0x43, 0x77, 0x92, 0x8a, 0x7c, 0x0a, 0x61, 0xc9, 0xf8, 0x25, 0xa4, 0x86, + 0x71, 0xea, 0x05, 0x91, 0x07, 0x48, 0xc8, 0xef, +]; const CIPHERTEXT: [u8; 40] = [ 0x26, 0xc5, 0x69, 0x61, 0xc0, 0x35, 0xa7, 0xe4, 0x52, 0xcc, 0xe6, 0x1b, 0xc6, 0xee, 0x22, 0x0d, @@ -23,10 +25,12 @@ const CIPHERTEXT: [u8; 40] = [ 0xb0, 0x6d, 0x43, 0x13, 0xf0, 0xdb, 0x9b, 0xe9, ]; -const EXPECTED_DECRYPT: [u8; 56] = [ 0x45, 0x35, 0xd1, 0x2b, 0x43, 0x77, 0x92, 0x8a, 0x7c, 0xa, 0x61, - 0xc9, 0xf8, 0x25, 0xa4, 0x86, 0x71, 0xea, 0x5, 0x91, 0x7, 0x48, 0xc8, 0xef, 0x94, 0x7f, 0xdb, 0x1, - 0x32, 0xd7, 0x23, 0x76, 0x87, 0xfb, 0xb2, 0x42, 0x52, 0x23, 0xfa, 0x34, 0xd5, 0xbe, 0x8a, 0xdd, - 0xd0, 0xb3, 0xb, 0xaa, 0x26, 0x83, 0x8c, 0xf4, 0x18, 0x67, 0x9, 0xf2]; +const EXPECTED_DECRYPT: [u8; 56] = [ + 0x45, 0x35, 0xd1, 0x2b, 0x43, 0x77, 0x92, 0x8a, 0x7c, 0xa, 0x61, 0xc9, 0xf8, 0x25, 0xa4, 0x86, + 0x71, 0xea, 0x5, 0x91, 0x7, 0x48, 0xc8, 0xef, 0x94, 0x7f, 0xdb, 0x1, 0x32, 0xd7, 0x23, 0x76, + 0x87, 0xfb, 0xb2, 0x42, 0x52, 0x23, 0xfa, 0x34, 0xd5, 0xbe, 0x8a, 0xdd, 0xd0, 0xb3, 0xb, 0xaa, + 0x26, 0x83, 0x8c, 0xf4, 0x18, 0x67, 0x9, 0xf2, +]; const RANDOM_DATA: [u8; 32] = [ 0xfb, 0x1a, 0x02, 0xa3, 0xe4, 0xd8, 0x5f, 0xa4, 0x8c, 0x2b, 0x5c, 0x1f, 0x57, 0xdd, 0x3a, 0x7d, diff --git a/e2e_tests/tests/per_provider/normal_tests/import_key.rs b/e2e_tests/tests/per_provider/normal_tests/import_key.rs index 00ad1432..d9eb02aa 100644 --- a/e2e_tests/tests/per_provider/normal_tests/import_key.rs +++ b/e2e_tests/tests/per_provider/normal_tests/import_key.rs @@ -73,8 +73,8 @@ fn check_format_import1() -> Result<()> { let key_name = String::from("check_format_import"); let public_key = RSAPublicKey { - modulus: IntegerAsn1::from_unsigned_bytes_be(example_modulus_1024()), - public_exponent: IntegerAsn1::from_unsigned_bytes_be(vec![0x01, 0x00, 0x01]), + modulus: IntegerAsn1::from_bytes_be_unsigned(example_modulus_1024()), + public_exponent: IntegerAsn1::from_bytes_be_unsigned(vec![0x01, 0x00, 0x01]), }; client.import_rsa_public_key(key_name, picky_asn1_der::to_vec(&public_key).unwrap())?; @@ -90,8 +90,8 @@ fn check_format_import2() -> Result<()> { let key_name = String::from("check_format_import2"); let public_key = RSAPublicKey { - modulus: IntegerAsn1::from_unsigned_bytes_be(example_modulus_1024()), - public_exponent: IntegerAsn1::from_unsigned_bytes_be(vec![0x01, 0x00, 0x01]), + modulus: IntegerAsn1::from_bytes_be_unsigned(example_modulus_1024()), + public_exponent: IntegerAsn1::from_bytes_be_unsigned(vec![0x01, 0x00, 0x01]), }; let attributes = Attributes { @@ -136,8 +136,8 @@ fn check_format_import3() -> Result<()> { let key_name = String::from("check_format_import3"); let public_key = RSAPublicKey { - modulus: IntegerAsn1::from_unsigned_bytes_be(vec![0xDE; 1024]), - public_exponent: IntegerAsn1::from_unsigned_bytes_be(vec![0x01, 0x00, 0x01]), + modulus: IntegerAsn1::from_bytes_be_unsigned(vec![0xDE; 1024]), + public_exponent: IntegerAsn1::from_bytes_be_unsigned(vec![0x01, 0x00, 0x01]), }; let attributes = Attributes { @@ -184,8 +184,8 @@ fn failed_imported_key_should_be_removed() -> Result<()> { let key_name = String::from("failed_imported_key_should_be_removed"); let public_key = RSAPublicKey { - modulus: IntegerAsn1::from_unsigned_bytes_be(example_modulus_1024()), - public_exponent: IntegerAsn1::from_unsigned_bytes_be(vec![0x01, 0x00, 0x01]), + modulus: IntegerAsn1::from_bytes_be_unsigned(example_modulus_1024()), + public_exponent: IntegerAsn1::from_bytes_be_unsigned(vec![0x01, 0x00, 0x01]), }; let attributes = Attributes { diff --git a/e2e_tests/tests/per_provider/normal_tests/key_agreement.rs b/e2e_tests/tests/per_provider/normal_tests/key_agreement.rs index ea7e5c41..e8e5ba32 100644 --- a/e2e_tests/tests/per_provider/normal_tests/key_agreement.rs +++ b/e2e_tests/tests/per_provider/normal_tests/key_agreement.rs @@ -22,19 +22,23 @@ const EXPECTED_OUTPUT_SECPR1: [u8; 32] = [ 0x2f, 0xef, 0x8e, 0x9e, 0xce, 0x7d, 0xce, 0x03, 0x81, 0x24, 0x64, 0xd0, 0x4b, 0x94, 0x42, 0xde, ]; -const OUR_KEY_DATA_BRAINPOOL_R1: [u8; 32] = [0x81, 0xdb, 0x1e, 0xe1, 0x00, 0x15, 0x0f, 0xf2, - 0xea, 0x33, 0x8d, 0x70, 0x82, 0x71, 0xbe, 0x38, 0x30, 0x0c, 0xb5, 0x42, 0x41, 0xd7, 0x99, 0x50, - 0xf7, 0x7b, 0x06, 0x30, 0x39, 0x80, 0x4f, 0x1d]; +const OUR_KEY_DATA_BRAINPOOL_R1: [u8; 32] = [ + 0x81, 0xdb, 0x1e, 0xe1, 0x00, 0x15, 0x0f, 0xf2, 0xea, 0x33, 0x8d, 0x70, 0x82, 0x71, 0xbe, 0x38, + 0x30, 0x0c, 0xb5, 0x42, 0x41, 0xd7, 0x99, 0x50, 0xf7, 0x7b, 0x06, 0x30, 0x39, 0x80, 0x4f, 0x1d, +]; -const PEER_PUBLIC_KEY_BRAINPOOL_R1: [u8; 65] = [0x04, 0x8d, 0x2d, 0x68, 0x8c, 0x6c, 0xf9, 0x3e, - 0x11, 0x60, 0xad, 0x04, 0xcc, 0x44, 0x29, 0x11, 0x7d, 0xc2, 0xc4, 0x18, 0x25, 0xe1, 0xe9, 0xfc, - 0xa0, 0xad, 0xdd, 0x34, 0xe6, 0xf1, 0xb3, 0x9f, 0x7b, 0x99, 0x0c, 0x57, 0x52, 0x08, 0x12, 0xbe, - 0x51, 0x26, 0x41, 0xe4, 0x70, 0x34, 0x83, 0x21, 0x06, 0xbc, 0x7d, 0x3e, 0x8d, 0xd0, 0xe4, 0xc7, - 0xf1, 0x13, 0x6d, 0x70, 0x06, 0x54, 0x7c, 0xec, 0x6a]; +const PEER_PUBLIC_KEY_BRAINPOOL_R1: [u8; 65] = [ + 0x04, 0x8d, 0x2d, 0x68, 0x8c, 0x6c, 0xf9, 0x3e, 0x11, 0x60, 0xad, 0x04, 0xcc, 0x44, 0x29, 0x11, + 0x7d, 0xc2, 0xc4, 0x18, 0x25, 0xe1, 0xe9, 0xfc, 0xa0, 0xad, 0xdd, 0x34, 0xe6, 0xf1, 0xb3, 0x9f, + 0x7b, 0x99, 0x0c, 0x57, 0x52, 0x08, 0x12, 0xbe, 0x51, 0x26, 0x41, 0xe4, 0x70, 0x34, 0x83, 0x21, + 0x06, 0xbc, 0x7d, 0x3e, 0x8d, 0xd0, 0xe4, 0xc7, 0xf1, 0x13, 0x6d, 0x70, 0x06, 0x54, 0x7c, 0xec, + 0x6a, +]; -const EXPECTED_OUTPUT_BRAINPOOL_R1: [u8; 32] = [0x89, 0xaf, 0xc3, 0x9d, 0x41, 0xd3, 0xb3, 0x27, 0x81, - 0x4b, 0x80, 0x94, 0x0b, 0x04, 0x25, 0x90, 0xf9, 0x65, 0x56, 0xec, 0x91, 0xe6, 0xae, 0x79, 0x39, - 0xbc, 0xe3, 0x1f, 0x3a, 0x18, 0xbf, 0x2b]; +const EXPECTED_OUTPUT_BRAINPOOL_R1: [u8; 32] = [ + 0x89, 0xaf, 0xc3, 0x9d, 0x41, 0xd3, 0xb3, 0x27, 0x81, 0x4b, 0x80, 0x94, 0x0b, 0x04, 0x25, 0x90, + 0xf9, 0x65, 0x56, 0xec, 0x91, 0xe6, 0xae, 0x79, 0x39, 0xbc, 0xe3, 0x1f, 0x3a, 0x18, 0xbf, 0x2b, +]; #[test] fn simple_raw_key_agreement() { @@ -49,7 +53,11 @@ fn simple_raw_key_agreement() { .generate_ecc_pair_secp_r1_key(key_name.clone()) .unwrap(); let _shared_secret = client - .raw_key_agreement(RawKeyAgreement::Ecdh, key_name.clone(), &PEER_PUBLIC_KEY_SECPR1) + .raw_key_agreement( + RawKeyAgreement::Ecdh, + key_name.clone(), + &PEER_PUBLIC_KEY_SECPR1, + ) .unwrap(); } @@ -66,7 +74,11 @@ fn raw_key_agreement_secpr1() { .import_ecc_pair_secp_r1_key(key_name.clone(), OUR_KEY_DATA_SECPR1.to_vec()) .unwrap(); let shared_secret = client - .raw_key_agreement(RawKeyAgreement::Ecdh, key_name.clone(), &PEER_PUBLIC_KEY_SECPR1) + .raw_key_agreement( + RawKeyAgreement::Ecdh, + key_name.clone(), + &PEER_PUBLIC_KEY_SECPR1, + ) .unwrap(); assert_eq!(&EXPECTED_OUTPUT_SECPR1, shared_secret.as_slice()); @@ -85,7 +97,11 @@ fn raw_key_agreement_brainpoolpr1() { .import_ecc_pair_brainpoolpr1_key(key_name.clone(), OUR_KEY_DATA_BRAINPOOL_R1.to_vec()) .unwrap(); let shared_secret = client - .raw_key_agreement(RawKeyAgreement::Ecdh, key_name.clone(), &PEER_PUBLIC_KEY_BRAINPOOL_R1) + .raw_key_agreement( + RawKeyAgreement::Ecdh, + key_name.clone(), + &PEER_PUBLIC_KEY_BRAINPOOL_R1, + ) .unwrap(); assert_eq!(&EXPECTED_OUTPUT_BRAINPOOL_R1, shared_secret.as_slice()); diff --git a/src/providers/pkcs11_provider/key_management.rs b/src/providers/pkcs11_provider/key_management.rs index 65f552c0..c535e04c 100644 --- a/src/providers/pkcs11_provider/key_management.rs +++ b/src/providers/pkcs11_provider/key_management.rs @@ -117,8 +117,9 @@ impl Pkcs11Provider { } let key_id = self.create_key_id(key_triple.clone(), key_attributes)?; + let modulus_bits = key_attributes.bits as u64; let (mech, mut pub_template, mut priv_template, mut allowed_mechanism) = - utils::parsec_to_pkcs11_params(key_attributes, &key_id)?; + utils::parsec_to_pkcs11_params(key_attributes, &key_id, &modulus_bits)?; pub_template.push(utils::mech_type_to_allowed_mech_attribute( &mut allowed_mechanism, @@ -247,7 +248,7 @@ impl Pkcs11Provider { // ulValueLen. let mut allowed_mechanisms_attribute = CK_ATTRIBUTE::new(pkcs11::types::CKA_ALLOWED_MECHANISMS); - allowed_mechanisms_attribute.ulValueLen = mem::size_of_val(&allowed_mechanisms); + allowed_mechanisms_attribute.ulValueLen = mem::size_of_val(&allowed_mechanisms) as u64; allowed_mechanisms_attribute.pValue = &allowed_mechanisms as *const pkcs11::types::CK_MECHANISM_TYPE as pkcs11::types::CK_VOID_PTR; @@ -327,8 +328,8 @@ impl Pkcs11Provider { let mut modulus: Vec = Vec::new(); let mut public_exponent: Vec = Vec::new(); - modulus.resize(modulus_len, 0); - public_exponent.resize(public_exponent_len, 0); + modulus.resize(modulus_len as usize, 0); + public_exponent.resize(public_exponent_len as usize, 0); let mut extract_attrs: Vec = Vec::new(); extract_attrs @@ -349,8 +350,14 @@ impl Pkcs11Provider { format_error!("Error when extracting attribute", rv); Err(utils::rv_to_response_status(rv)) } else { - let modulus = attrs[0].get_bytes(); - let public_exponent = attrs[1].get_bytes(); + let modulus = attrs[0].get_bytes().map_err(|err| { + format_error!("Error getting bytes from modulus attribute", err); + ResponseStatus::PsaErrorCommunicationFailure + })?; + let public_exponent = attrs[1].get_bytes().map_err(|err| { + format_error!("Error getting bytes from public exponent attribute", err); + ResponseStatus::PsaErrorCommunicationFailure + })?; // To produce a valid ASN.1 RSAPublicKey structure, 0x00 is put in front of the positive // integer if highest significant bit is one, to differentiate it from a negative number. diff --git a/src/providers/pkcs11_provider/mod.rs b/src/providers/pkcs11_provider/mod.rs index 1c94b9fb..46c838dd 100644 --- a/src/providers/pkcs11_provider/mod.rs +++ b/src/providers/pkcs11_provider/mod.rs @@ -92,7 +92,7 @@ impl Pkcs11Provider { local_ids: RwLock::new(HashSet::new()), logged_sessions_counter: Mutex::new(0), backend, - slot_number, + slot_number: slot_number as CK_SLOT_ID, user_pin, temp_mutex: Mutex::new(()), software_public_operations, diff --git a/src/providers/pkcs11_provider/utils.rs b/src/providers/pkcs11_provider/utils.rs index 4f3f671a..2a7127be 100644 --- a/src/providers/pkcs11_provider/utils.rs +++ b/src/providers/pkcs11_provider/utils.rs @@ -48,7 +48,7 @@ impl From for CK_MECHANISM_TYPE { pub fn mech_type_to_allowed_mech_attribute(mech_type: &mut CK_MECHANISM_TYPE) -> CK_ATTRIBUTE { let param: CK_MECHANISM_TYPE_PTR = mech_type; let mut allowed_mechanisms_attr = CK_ATTRIBUTE::new(CKA_ALLOWED_MECHANISMS); - allowed_mechanisms_attr.ulValueLen = ::std::mem::size_of::(); + allowed_mechanisms_attr.ulValueLen = ::std::mem::size_of::() as u64; allowed_mechanisms_attr.pValue = param as CK_VOID_PTR; allowed_mechanisms_attr } @@ -85,7 +85,7 @@ impl CkRsaPkcsPssParams { CK_RSA_PKCS_PSS_PARAMS { hashAlg: self.hash_alg.into(), mgf: self.mgf.into(), - sLen: self.s_len, + sLen: self.s_len as u64, } } } @@ -109,7 +109,7 @@ impl CkRsaPkcsOaepParams { } else { self.source_data.as_mut_ptr() as CK_VOID_PTR }, - ulSourceDataLen: self.source_data.len(), + ulSourceDataLen: self.source_data.len() as u64, } } } @@ -245,7 +245,7 @@ impl CkMechanism { CK_MECHANISM { mechanism: self.mech_type().into(), pParameter: p_params as CK_VOID_PTR, - ulParameterLen: len, + ulParameterLen: len as u64, }, Some(CParams::CkmRsaPkcsPssParams(params)), ) @@ -264,7 +264,7 @@ impl CkMechanism { CK_MECHANISM { mechanism: self.mech_type().into(), pParameter: p_params as CK_VOID_PTR, - ulParameterLen: len, + ulParameterLen: len as u64, }, Some(CParams::CkmRsaPkcsOaepParams(params)), ) @@ -290,6 +290,10 @@ pub fn to_response_status(error: Error) -> ResponseStatus { ResponseStatus::PsaErrorCommunicationFailure } Error::Pkcs11(ck_rv) => rv_to_response_status(ck_rv), + Error::UnavailableInformation => { + error!("Conversion of UnavailableInformation to PsaErrorCommunicationFailure"); + ResponseStatus::PsaErrorCommunicationFailure + } } } @@ -535,6 +539,7 @@ impl Drop for Session<'_> { pub fn parsec_to_pkcs11_params( attributes: Attributes, key_id: &[u8], + modulus_bits: &u64, ) -> Result<( CK_MECHANISM, Vec, @@ -558,7 +563,7 @@ pub fn parsec_to_pkcs11_params( pub_template.push(CK_ATTRIBUTE::new(CKA_TOKEN).with_bool(&CK_TRUE)); pub_template.push(CK_ATTRIBUTE::new(CKA_PRIVATE).with_bool(&CK_FALSE)); pub_template.push(CK_ATTRIBUTE::new(CKA_PUBLIC_EXPONENT).with_bytes(&PUBLIC_EXPONENT)); - pub_template.push(CK_ATTRIBUTE::new(CKA_MODULUS_BITS).with_ck_ulong(&attributes.bits)); + pub_template.push(CK_ATTRIBUTE::new(CKA_MODULUS_BITS).with_ck_ulong(modulus_bits)); key_pair_usage_flags_to_pkcs11_attributes( attributes.policy.usage_flags,