diff --git a/Cargo.lock b/Cargo.lock index d0232fee..84dab6e6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,26 +4,20 @@ version = 3 [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - [[package]] name = "bindgen" -version = "0.72.0" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.4.2", + "bitflags", "cexpr", "clang-sys", "itertools", @@ -34,20 +28,14 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.50", + "syn", ] [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" [[package]] name = "cexpr" @@ -60,15 +48,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -79,12 +67,11 @@ dependencies = [ name = "cryptoki" version = "0.10.0" dependencies = [ - "bitflags 1.3.2", + "bitflags", "cryptoki-sys", "hex", "libloading", "log", - "num-traits", "paste", "secrecy", "serial_test", @@ -101,83 +88,144 @@ dependencies = [ [[package]] name = "either" -version = "1.10.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] -name = "glob" -version = "0.3.1" +name = "futures" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] [[package]] -name = "hex" -version = "0.4.3" +name = "futures-channel" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] [[package]] -name = "instant" -version = "0.1.12" +name = "futures-core" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ - "cfg-if", + "futures-core", + "futures-task", + "futures-util", ] [[package]] -name = "itertools" -version = "0.12.1" +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-sink" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", ] [[package]] -name = "lazy_static" -version = "1.4.0" +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] [[package]] name = "libc" -version = "0.2.153" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libloading" -version = "0.8.6" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets", + "windows-link", ] [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.20" +version = "0.4.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" [[package]] name = "minimal-lexical" @@ -196,87 +244,94 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.18" +name = "once_cell" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" -dependencies = [ - "autocfg", -] +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "parking_lot" -version = "0.11.2" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ - "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.8.6" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", - "instant", "libc", "redox_syscall", "smallvec", - "winapi", + "windows-link", ] [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "prettyplease" +name = "pin-project-lite" version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.50", + "syn", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "ce25767e7b499d1b604768e7cde645d14cc8584231ea6b295e9c9eb22c02e1d1" dependencies = [ "proc-macro2", ] [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -286,9 +341,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -297,9 +352,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "rustc-hash" @@ -307,12 +362,27 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" +[[package]] +name = "scc" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] + [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sdd" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" + [[package]] name = "secrecy" version = "0.10.3" @@ -325,44 +395,56 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.197" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.50", + "syn", ] [[package]] name = "serial_test" -version = "0.5.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d" +checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" dependencies = [ - "lazy_static", + "futures", + "log", + "once_cell", "parking_lot", + "scc", "serial_test_derive", ] [[package]] name = "serial_test_derive" -version = "0.5.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5" +checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] @@ -372,27 +454,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "smallvec" -version = "1.13.1" +name = "slab" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] -name = "syn" -version = "1.0.109" +name = "smallvec" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "syn" -version = "2.0.50" +version = "2.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" +checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917" dependencies = [ "proc-macro2", "quote", @@ -407,91 +484,18 @@ checksum = "614b328ff036a4ef882c61570f72918f7e9c5bee1da33f8e7f91e01daee7e56c" [[package]] name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06" [[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -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" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/cryptoki-sys/Cargo.toml b/cryptoki-sys/Cargo.toml index 1a1b1f21..687d61ef 100644 --- a/cryptoki-sys/Cargo.toml +++ b/cryptoki-sys/Cargo.toml @@ -13,10 +13,10 @@ documentation = "https://docs.rs/crate/cryptoki-sys" rust-version = "1.77" [build-dependencies] -bindgen = { version = "0.72.0", optional = true } +bindgen = { version = "0.72.1", optional = true } [dependencies] -libloading = "0.8.6" +libloading = "0.8.9" [features] generate-bindings = ["bindgen"] diff --git a/cryptoki/Cargo.toml b/cryptoki/Cargo.toml index fcf1d1ca..167e6bbf 100644 --- a/cryptoki/Cargo.toml +++ b/cryptoki/Cargo.toml @@ -13,17 +13,16 @@ documentation = "https://docs.rs/crate/cryptoki" rust-version = "1.77" [dependencies] -bitflags = "1.3" -libloading = "0.8.6" -log = "0.4.14" +bitflags = "2.10.0" +libloading = "0.8.9" +log = "0.4.28" cryptoki-sys = { path = "../cryptoki-sys", version = "0.4.0" } -paste = "1.0.6" +paste = "1.0.15" secrecy = "0.10.3" [dev-dependencies] -num-traits = "0.2.14" hex = "0.4.3" -serial_test = "0.5.1" +serial_test = "3.2.0" testresult = "0.4.1" [features] diff --git a/cryptoki/src/context/mod.rs b/cryptoki/src/context/mod.rs index 8a3ad076..388cc4b7 100644 --- a/cryptoki/src/context/mod.rs +++ b/cryptoki/src/context/mod.rs @@ -93,8 +93,8 @@ impl Pkcs11Impl { impl Drop for Pkcs11Impl { fn drop(&mut self) { - if let Err(e) = self.finalize() { - error!("Failed to finalize: {}", e); + if let Err(err) = self.finalize() { + error!("Failed to finalize: {err}"); } } } diff --git a/cryptoki/src/error/rv.rs b/cryptoki/src/error/rv.rs index 14a0e8df..d14a42c0 100644 --- a/cryptoki/src/error/rv.rs +++ b/cryptoki/src/error/rv.rs @@ -120,8 +120,7 @@ impl From for Rv { CKR_VENDOR_DEFINED..=CK_ULONG::MAX => Rv::Error(RvError::VendorDefined(ck_rv)), other => { error!( - "Can not find a corresponding error for {}, converting to UnknownErrorCode.", - other + "Can not find a corresponding error for {other}, converting to UnknownErrorCode." ); Rv::Error(RvError::UnknownErrorCode(other)) } diff --git a/cryptoki/src/mechanism/mechanism_info.rs b/cryptoki/src/mechanism/mechanism_info.rs index f708679f..b72e6341 100644 --- a/cryptoki/src/mechanism/mechanism_info.rs +++ b/cryptoki/src/mechanism/mechanism_info.rs @@ -7,6 +7,7 @@ use cryptoki_sys::*; use std::fmt::{Debug, Formatter}; bitflags! { + #[derive(Debug, Clone, Copy)] struct MechanismInfoFlags: CK_FLAGS { const HW = CKF_HW; const ENCRYPT = CKF_ENCRYPT; @@ -25,7 +26,6 @@ bitflags! { const EC_F_P = CKF_EC_F_P; const EC_F_2M = CKF_EC_F_2M; const EC_ECPARAMETERS = CKF_EC_ECPARAMETERS; - const EC_NAMEDCURVE = CKF_EC_NAMEDCURVE; const EC_OID = CKF_EC_OID; const EC_UNCOMPRESS = CKF_EC_UNCOMPRESS; const EC_COMPRESS = CKF_EC_COMPRESS; @@ -37,6 +37,12 @@ bitflags! { } } +impl MechanismInfoFlags { + /// `CKF_EC_NAMEDCURVE` is deprecated with `PKCS#11 3.00`. It is replaced by [`CKF_EC_OID`](MechanismInfoFlags::EC_OID). + #[deprecated = "use `EC_OID` instead"] + pub const EC_NAMEDCURVE: Self = Self::from_bits_retain(CKF_EC_NAMEDCURVE); +} + /// Information about a particular mechanism #[derive(Debug, Clone, Copy)] pub struct MechanismInfo { @@ -201,6 +207,7 @@ impl MechanismInfo { /// [`ec_from_named_curve`](Self::ec_from_named_curve) must be `true` #[deprecated = "use `ec_from_oid` instead"] pub fn ec_from_named_curve(&self) -> bool { + #[allow(deprecated)] self.flags.contains(MechanismInfoFlags::EC_NAMEDCURVE) } @@ -302,15 +309,25 @@ impl From for MechanismInfo { #[cfg(test)] mod test { use super::{MechanismInfo, MechanismInfoFlags}; + use cryptoki_sys::CK_FLAGS; + + #[test] + fn deprecated_flags() { + let ec_oid_bits: CK_FLAGS = MechanismInfoFlags::EC_OID.bits(); + #[allow(deprecated)] + let ec_namedcurve_bits: CK_FLAGS = MechanismInfoFlags::EC_NAMEDCURVE.bits(); + assert_eq!(ec_oid_bits, ec_namedcurve_bits); + } #[test] fn debug_flags_all() { - let expected = "\ -HW | ENCRYPT | DECRYPT | DIGEST | SIGN | SIGN_RECOVER | VERIFY | \ -VERIFY_RECOVER | GENERATE | GENERATE_KEY_PAIR | WRAP | UNWRAP | DERIVE | \ -EXTENSION | EC_F_P | EC_F_2M | EC_ECPARAMETERS | EC_NAMEDCURVE | \ -EC_OID | EC_UNCOMPRESS | EC_COMPRESS | MESSAGE_ENCRYPT | MESSAGE_DECRYPT | \ -MULTI_MESSAGE | ENCAPSULATE | DECAPSULATE"; + let expected = "MechanismInfoFlags( + HW | ENCRYPT | DECRYPT | DIGEST | SIGN | SIGN_RECOVER | VERIFY | \ + VERIFY_RECOVER | GENERATE | GENERATE_KEY_PAIR | WRAP | UNWRAP | DERIVE | \ + EXTENSION | EC_F_P | EC_F_2M | EC_ECPARAMETERS | EC_OID | EC_UNCOMPRESS | \ + EC_COMPRESS | MESSAGE_ENCRYPT | MESSAGE_DECRYPT | MULTI_MESSAGE | ENCAPSULATE | \ + DECAPSULATE, +)"; let all = MechanismInfoFlags::all(); let observed = format!("{all:#?}"); println!("{observed}"); @@ -327,7 +344,9 @@ MULTI_MESSAGE | ENCAPSULATE | DECAPSULATE"; let expected = r#"MechanismInfo { min_key_size: 16, max_key_size: 4096, - flags: (empty), + flags: MechanismInfoFlags( + 0x0, + ), }"#; let observed = format!("{info:#?}"); assert_eq!(observed, expected); diff --git a/cryptoki/src/mechanism/mod.rs b/cryptoki/src/mechanism/mod.rs index e4b823ae..41497c76 100644 --- a/cryptoki/src/mechanism/mod.rs +++ b/cryptoki/src/mechanism/mod.rs @@ -1020,7 +1020,7 @@ impl TryFrom for MechanismType { CKM_HASH_SLH_DSA_SHA3_512 => Ok(MechanismType::HASH_SLH_DSA_SHA3_512), CKM_HASH_SLH_DSA_SHAKE128 => Ok(MechanismType::HASH_SLH_DSA_SHAKE128), other => { - error!("Mechanism type {} is not supported.", other); + error!("Mechanism type {other} is not supported."); Err(Error::NotSupported) } } diff --git a/cryptoki/src/mechanism/rsa.rs b/cryptoki/src/mechanism/rsa.rs index 30717070..b37419f3 100644 --- a/cryptoki/src/mechanism/rsa.rs +++ b/cryptoki/src/mechanism/rsa.rs @@ -66,10 +66,7 @@ impl TryFrom for PkcsMgfType { CKG_MGF1_SHA384 => Ok(PkcsMgfType::MGF1_SHA384), CKG_MGF1_SHA512 => Ok(PkcsMgfType::MGF1_SHA512), other => { - error!( - "Mask Generation Function type {} is not one of the valid values.", - other - ); + error!("Mask Generation Function type {other} is not one of the valid values."); Err(Error::InvalidValue) } } diff --git a/cryptoki/src/object.rs b/cryptoki/src/object.rs index 8ec7e11e..463a1007 100644 --- a/cryptoki/src/object.rs +++ b/cryptoki/src/object.rs @@ -501,7 +501,7 @@ impl TryFrom for AttributeType { CKA_WRAP_WITH_TRUSTED => Ok(AttributeType::WrapWithTrusted), CKA_VENDOR_DEFINED..=CK_ULONG::MAX => Ok(AttributeType::VendorDefined(attribute_type)), attr_type => { - error!("Attribute type {} not supported.", attr_type); + error!("Attribute type {attr_type} not supported."); Err(Error::NotSupported) } } @@ -1347,7 +1347,7 @@ impl TryFrom for MlKemParameterSetType { CKP_ML_KEM_768 => Ok(MlKemParameterSetType::ML_KEM_768), CKP_ML_KEM_1024 => Ok(MlKemParameterSetType::ML_KEM_1024), _ => { - error!("ML-KEM parameter set {} is not supported.", val); + error!("ML-KEM parameter set {val} is not supported."); Err(Error::NotSupported) } } @@ -1414,7 +1414,7 @@ impl TryFrom for MlDsaParameterSetType { CKP_ML_DSA_65 => Ok(MlDsaParameterSetType::ML_DSA_65), CKP_ML_DSA_87 => Ok(MlDsaParameterSetType::ML_DSA_87), _ => { - error!("ML-DSA parameter set {} is not supported.", val); + error!("ML-DSA parameter set {val} is not supported."); Err(Error::NotSupported) } } @@ -1657,7 +1657,7 @@ impl TryFrom for ObjectClass { CKO_VALIDATION => Ok(ObjectClass::VALIDATION), _ => { - error!("Object class {} is not supported.", object_class); + error!("Object class {object_class} is not supported."); Err(Error::NotSupported) } } @@ -1957,7 +1957,7 @@ impl TryFrom for KeyType { CKK_SLH_DSA => Ok(KeyType::SLH_DSA), CKK_VENDOR_DEFINED..=CK_ULONG::MAX => KeyType::new_vendor_defined(key_type), _ => { - error!("Key type {} is not supported.", key_type); + error!("Key type {key_type} is not supported."); Err(Error::NotSupported) } } @@ -2033,7 +2033,7 @@ impl TryFrom for CertificateType { CKC_X_509_ATTR_CERT => Ok(CertificateType::X_509_ATTR), CKC_WTLS => Ok(CertificateType::WTLS), _ => { - error!("Certificate type {} is not supported.", certificate_type); + error!("Certificate type {certificate_type} is not supported."); Err(Error::NotSupported) } } diff --git a/cryptoki/src/session/object_management.rs b/cryptoki/src/session/object_management.rs index e5cf7582..13034867 100644 --- a/cryptoki/src/session/object_management.rs +++ b/cryptoki/src/session/object_management.rs @@ -197,8 +197,8 @@ impl Drop for ObjectHandleIterator<'_> { if let Some(f) = get_pkcs11_func!(self.session.client(), C_FindObjectsFinal) { // swallow the return value, as we can't do anything about it, // but log the error - if let Rv::Error(error) = Rv::from(unsafe { f(self.session.handle()) }) { - log::error!("C_FindObjectsFinal() failed with error: {:?}", error); + if let Rv::Error(err) = Rv::from(unsafe { f(self.session.handle()) }) { + log::error!("C_FindObjectsFinal() failed with error: {err:?}"); } } else { // bark but pass if C_FindObjectsFinal() is not implemented diff --git a/cryptoki/src/session/session_info.rs b/cryptoki/src/session/session_info.rs index b8981c68..abd5dc4c 100644 --- a/cryptoki/src/session/session_info.rs +++ b/cryptoki/src/session/session_info.rs @@ -11,6 +11,7 @@ use std::fmt::Debug; bitflags! { /// Collection of flags defined for [`CK_SESSION_INFO`] + #[derive(Debug, Clone, Copy)] struct SessionInfoFlags: CK_FLAGS { const RW_SESSION = CKF_RW_SESSION; const SERIAL_SESSION = CKF_SERIAL_SESSION; @@ -109,7 +110,9 @@ mod test { #[test] fn debug_flags_all() { - let expected = "RW_SESSION | SERIAL_SESSION"; + let expected = "SessionInfoFlags( + RW_SESSION | SERIAL_SESSION, +)"; let all = SessionInfoFlags::all(); let observed = format!("{all:#?}"); assert_eq!(observed, expected); @@ -128,7 +131,9 @@ mod test { slot_id: 100, }, state: RoPublic, - flags: (empty), + flags: SessionInfoFlags( + 0x0, + ), device_error: 0, }"#; let observed = format!("{info:#?}"); diff --git a/cryptoki/src/session/session_management.rs b/cryptoki/src/session/session_management.rs index c5f22b03..40839ad7 100644 --- a/cryptoki/src/session/session_management.rs +++ b/cryptoki/src/session/session_management.rs @@ -26,8 +26,8 @@ impl Drop for Session { } } - if let Err(e) = close(self) { - error!("Failed to close session: {}", e); + if let Err(err) = close(self) { + error!("Failed to close session: {err}"); } } } diff --git a/cryptoki/src/slot/slot_info.rs b/cryptoki/src/slot/slot_info.rs index 50e74891..40d6b8d1 100644 --- a/cryptoki/src/slot/slot_info.rs +++ b/cryptoki/src/slot/slot_info.rs @@ -9,6 +9,7 @@ use std::fmt::Debug; bitflags! { /// Collection of flags defined for [`CK_SLOT_INFO`] + #[derive(Debug, Clone, Copy)] struct SlotInfoFlags: CK_FLAGS { const TOKEN_PRESENT = CKF_TOKEN_PRESENT; const REMOVABLE_DEVICE = CKF_REMOVABLE_DEVICE; @@ -98,7 +99,9 @@ mod test { #[test] fn debug_flags_all() { - let expected = "TOKEN_PRESENT | REMOVABLE_DEVICE | HW_SLOT"; + let expected = "SlotInfoFlags( + TOKEN_PRESENT | REMOVABLE_DEVICE | HW_SLOT, +)"; let all = SlotInfoFlags::all(); let observed = format!("{all:#?}"); assert_eq!(observed, expected); @@ -116,7 +119,9 @@ mod test { let expected = r#"SlotInfo { slot_description: "Slot Description", manufacturer_id: "Manufacturer ID", - flags: (empty), + flags: SlotInfoFlags( + 0x0, + ), hardware_version: Version { major: 0, minor: 255, diff --git a/cryptoki/src/slot/token_info.rs b/cryptoki/src/slot/token_info.rs index 9653c9b4..90021151 100644 --- a/cryptoki/src/slot/token_info.rs +++ b/cryptoki/src/slot/token_info.rs @@ -13,6 +13,7 @@ use std::fmt::Debug; bitflags! { /// Collection of flags defined for [`CK_TOKEN_INFO`] + #[derive(Debug, Clone, Copy)] struct TokenInfoFlags: CK_FLAGS { const RNG = CKF_RNG; const WRITE_PROTECTED = CKF_WRITE_PROTECTED; @@ -463,13 +464,14 @@ mod test { #[test] fn debug_flags_all() { - let expected = "\ -RNG | WRITE_PROTECTED | LOGIN_REQUIRED | USER_PIN_INITIALIZED | \ -RESTORE_KEY_NOT_NEEDED | CLOCK_ON_TOKEN | PROTECTED_AUTHENTICATION_PATH | \ -DUAL_CRYPTO_OPERATIONS | TOKEN_INITIALIZED | SECONDARY_AUTHENTICATION | \ -USER_PIN_COUNT_LOW | USER_PIN_FINAL_TRY | USER_PIN_LOCKED | \ -USER_PIN_TO_BE_CHANGED | SO_PIN_COUNT_LOW | SO_PIN_FINAL_TRY | SO_PIN_LOCKED | \ -SO_PIN_TO_BE_CHANGED | ERROR_STATE"; + let expected = "TokenInfoFlags( + RNG | WRITE_PROTECTED | LOGIN_REQUIRED | USER_PIN_INITIALIZED | \ + RESTORE_KEY_NOT_NEEDED | CLOCK_ON_TOKEN | PROTECTED_AUTHENTICATION_PATH | \ + DUAL_CRYPTO_OPERATIONS | TOKEN_INITIALIZED | SECONDARY_AUTHENTICATION | \ + USER_PIN_COUNT_LOW | USER_PIN_FINAL_TRY | USER_PIN_LOCKED | \ + USER_PIN_TO_BE_CHANGED | SO_PIN_COUNT_LOW | SO_PIN_FINAL_TRY | SO_PIN_LOCKED | \ + SO_PIN_TO_BE_CHANGED | ERROR_STATE, +)"; let all = TokenInfoFlags::all(); let observed = format!("{all:#?}"); assert_eq!(observed, expected); @@ -509,7 +511,9 @@ SO_PIN_TO_BE_CHANGED | ERROR_STATE"; manufacturer_id: "Manufacturer ID", model: "Token Model", serial_number: "Serial Number", - flags: (empty), + flags: TokenInfoFlags( + 0x0, + ), max_session_count: Max( 100, ), diff --git a/cryptoki/tests/basic.rs b/cryptoki/tests/basic.rs index 927d56d4..f6bbde4f 100644 --- a/cryptoki/tests/basic.rs +++ b/cryptoki/tests/basic.rs @@ -1579,7 +1579,7 @@ fn get_session_info_test() -> TestResult { let session_info = session.get_session_info()?; assert!(session_info.read_write()); assert_eq!(session_info.slot_id(), slot); - assert!(matches!(session_info.session_state(), SessionState::RwUser,)); + assert!(matches!(session_info.session_state(), SessionState::RwUser)); session.logout()?; session.login(UserType::So, Some(&AuthPin::new(SO_PIN.into())))?; let session_info = session.get_session_info()?;