diff --git a/.cargo/config b/.cargo/config.toml similarity index 86% rename from .cargo/config rename to .cargo/config.toml index 073d01a90b..e70dcfa7ad 100644 --- a/.cargo/config +++ b/.cargo/config.toml @@ -1,3 +1,5 @@ +# Licensed under the Apache-2.0 license + [target.riscv32imc-unknown-none-elf] rustflags = [ "-C", "target-feature=+relax", diff --git a/Cargo.lock b/Cargo.lock index 88d6869a1b..d2108ca7b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,20 +4,20 @@ version = 3 [[package]] name = "aes" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cipher", "cpufeatures", ] [[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", ] @@ -39,30 +39,30 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "arbitrary" -version = "1.3.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" dependencies = [ "derive_arbitrary", ] [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" [[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" dependencies = [ "zeroize", ] @@ -129,9 +129,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "base16ct" @@ -139,12 +139,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" - [[package]] name = "base64ct" version = "1.6.0" @@ -174,9 +168,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -189,36 +183,36 @@ dependencies = [ [[package]] name = "block-padding" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a90ec2df9600c28a01c56c4784c9207a96d2451833aeceb8cc97e4c9548bb78" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" dependencies = [ "generic-array", ] [[package]] name = "bumpalo" -version = "3.12.1" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "caliptra-api" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-api-types", "caliptra-emu-types", "caliptra-error", "caliptra-registers", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -230,13 +224,13 @@ name = "caliptra-auth-man-gen" version = "0.1.0" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-auth-man-types", "caliptra-image-gen", "caliptra-image-types", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -245,12 +239,12 @@ version = "0.1.0" dependencies = [ "arbitrary", "bitfield", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-error", "caliptra-image-types", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -272,8 +266,8 @@ dependencies = [ "hex", "serde", "serde_derive", - "toml 0.7.3", - "zerocopy", + "toml 0.7.8", + "zerocopy 0.6.6", ] [[package]] @@ -289,9 +283,9 @@ dependencies = [ "clap", "elf", "hex", - "nix 0.26.2", + "nix", "once_cell", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -354,7 +348,7 @@ version = "0.1.0" dependencies = [ "caliptra-drivers", "caliptra-registers", - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -362,7 +356,7 @@ name = "caliptra-drivers" version = "0.1.0" dependencies = [ "bitfield", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-api", "caliptra-auth-man-types", "caliptra-builder", @@ -378,12 +372,12 @@ dependencies = [ "caliptra-lms-types", "caliptra-registers", "caliptra-test", - "cfg-if 1.0.0", + "cfg-if", "dpe", "openssl", "ufmt", "ureg", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -398,8 +392,8 @@ dependencies = [ "caliptra-lms-types", "caliptra-registers", "caliptra-test-harness", - "cfg-if 1.0.0", - "zerocopy", + "cfg-if", + "zerocopy 0.6.6", ] [[package]] @@ -485,7 +479,7 @@ dependencies = [ "sha3", "smlang", "tock-registers", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -517,10 +511,10 @@ dependencies = [ "caliptra-test", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "openssl", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -550,12 +544,12 @@ dependencies = [ "caliptra-test-harness-types", "caliptra-verilated", "libc", - "nix 0.26.2", + "nix", "rand", "sha2", "uio", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -604,8 +598,8 @@ dependencies = [ "hex", "serde", "serde_derive", - "toml 0.7.3", - "zerocopy", + "toml 0.7.8", + "zerocopy 0.6.6", ] [[package]] @@ -616,14 +610,14 @@ dependencies = [ "caliptra-image-gen", "caliptra-image-types", "caliptra-lms-types", - "cfg-if 1.0.0", + "cfg-if", "ecdsa", "openssl", "p384", "rand", "sec1", "sha2", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -644,7 +638,7 @@ dependencies = [ "caliptra-image-gen", "caliptra-image-types", "caliptra-lms-types", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -652,13 +646,13 @@ name = "caliptra-image-gen" version = "0.1.0" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-image-types", "caliptra-lms-types", "fips204", "memoffset 0.8.0", "rand", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -668,7 +662,7 @@ dependencies = [ "anyhow", "caliptra-image-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -681,7 +675,7 @@ dependencies = [ "caliptra-error", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -689,14 +683,14 @@ dependencies = [ name = "caliptra-image-verify" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-cfi-derive", "caliptra-cfi-lib", "caliptra-drivers", "caliptra-image-types", "caliptra_common", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -706,7 +700,7 @@ dependencies = [ "caliptra-drivers", "caliptra-lms-types", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -716,7 +710,7 @@ dependencies = [ "arbitrary", "caliptra-cfi-derive", "caliptra-cfi-lib", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -758,14 +752,14 @@ dependencies = [ "caliptra-test", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "elf", "hex", "memoffset 0.8.0", "openssl", "ufmt", "x509-parser", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -778,10 +772,10 @@ dependencies = [ "caliptra-registers", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "ufmt", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -791,7 +785,7 @@ dependencies = [ "caliptra-cpu", "caliptra-drivers", "caliptra-image-types", - "cfg-if 1.0.0", + "cfg-if", "ufmt", ] @@ -800,7 +794,7 @@ name = "caliptra-runtime" version = "0.1.0" dependencies = [ "arrayvec", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-api", "caliptra-auth-man-gen", "caliptra-auth-man-types", @@ -825,7 +819,7 @@ dependencies = [ "caliptra-test", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "cms", "crypto", "dpe", @@ -836,7 +830,7 @@ dependencies = [ "ufmt", "wycheproof", "x509-parser", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -851,9 +845,9 @@ dependencies = [ "caliptra-runtime", "caliptra-test-harness", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -898,7 +892,7 @@ dependencies = [ "rand", "regex", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -906,7 +900,7 @@ name = "caliptra-test-harness" version = "0.1.0" dependencies = [ "caliptra-drivers", - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -941,7 +935,7 @@ name = "caliptra_common" version = "0.1.0" dependencies = [ "bitfield", - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-api", "caliptra-cpu", "caliptra-drivers", @@ -949,7 +943,7 @@ dependencies = [ "caliptra-image-verify", "caliptra-registers", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -974,12 +968,12 @@ dependencies = [ [[package]] name = "cbindgen" -version = "0.24.3" +version = "0.24.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6358dedf60f4d9b8db43ad187391afe959746101346fe51bb978126bec61dfb" +checksum = "4b922faaf31122819ec80c4047cc684c6979a087366c069611e33649bf98e18d" dependencies = [ "heck", - "indexmap", + "indexmap 1.9.3", "log", "proc-macro2", "quote", @@ -992,19 +986,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" dependencies = [ - "libc", + "shlex", ] -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - [[package]] name = "cfg-if" version = "1.0.0" @@ -1013,16 +1001,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.32" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets", ] [[package]] @@ -1043,7 +1031,7 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.3", "textwrap", ] @@ -1068,16 +1056,6 @@ dependencies = [ "x509-cert", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "compliance-test" version = "0.1.0" @@ -1097,9 +1075,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[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 = "convert_case" @@ -1112,15 +1090,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" dependencies = [ "libc", ] @@ -1157,58 +1135,14 @@ dependencies = [ "typenum", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.48", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ - "cfg-if 1.0.0", - "hashbrown", + "cfg-if", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1216,15 +1150,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "der_derive", @@ -1249,30 +1183,33 @@ dependencies = [ [[package]] name = "der_derive" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe87ce4529967e0ba1dcf8450bab64d97dfd5010a6256187ffe2e43e6f0e049" +checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "derive_arbitrary" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] @@ -1289,28 +1226,28 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] name = "dpe" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.6.0", "caliptra-cfi-derive-git", "caliptra-cfi-lib-git", - "cfg-if 1.0.0", + "cfg-if", "constant_time_eq", "crypto", "platform", "ufmt", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -1330,9 +1267,9 @@ dependencies = [ [[package]] name = "elf" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2b183d6ce6ca4cf30e3db37abf5b52568b5f9015c97d9fbdd7026aa5dcdd758" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" [[package]] name = "elliptic-curve" @@ -1355,11 +1292,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1367,12 +1310,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.9.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" [[package]] name = "ff" @@ -1386,9 +1326,9 @@ dependencies = [ [[package]] name = "fips204" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f6698c48aedd28ff9060f0f9b9712bd465db780ddcfd0d64fd3da199577ca1" +checksum = "b1909118ec7b649ae9feef77fa0548384e8d550af0497ad4de32f82252c44435" dependencies = [ "rand_core", "sha2", @@ -1398,9 +1338,9 @@ dependencies = [ [[package]] name = "flagset" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a7e408202050813e6f1d9addadcaafef3dca7530c7ddfb005d4081cce6779" +checksum = "b3ea1ec5f8307826a5b71094dd91fc04d4ae75d5709b20ad351c7fb4815c86ec" [[package]] name = "foreign-types" @@ -1429,9 +1369,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1444,9 +1384,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1454,15 +1394,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1471,27 +1411,27 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1506,12 +1446,12 @@ dependencies = [ [[package]] name = "gdbstub" -version = "0.6.4" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4fddc6f9d12cbef29e395d9a6b48c128f513c8a2ded7048c97ed5c484e53e7" +checksum = "f4e02bf1b1a624d96925c608f1b268d82a76cbc587ce9e59f7c755e9ea11c75c" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "log", "managed", "num-traits", @@ -1541,11 +1481,11 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi", ] @@ -1568,16 +1508,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "heck" -version = "0.4.1" +name = "hashbrown" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" [[package]] -name = "hermit-abi" -version = "0.3.4" +name = "hashbrown" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hex" @@ -1587,9 +1533,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -1605,124 +1551,104 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", -] - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "block-padding", - "generic-array", + "hashbrown 0.12.3", ] [[package]] -name = "instant" -version = "0.1.12" +name = "indexmap" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ - "cfg-if 1.0.0", + "equivalent", + "hashbrown 0.15.1", ] [[package]] -name = "io-lifetimes" -version = "1.0.11" +name = "inout" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", + "block-padding", + "generic-array", ] [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] [[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.152" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1730,12 +1656,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "managed" @@ -1745,9 +1668,9 @@ checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -1775,29 +1698,15 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nix" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "becb657d662f1cd2ef38c7ad480ec6b8cf9e96b27adb543e594f9cf0f2e6065c" -dependencies = [ - "bitflags 1.3.2", - "cc", - "cfg-if 0.1.10", - "libc", - "void", -] - -[[package]] -name = "nix" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset 0.7.1", "pin-utils", - "static_assertions", ] [[package]] @@ -1812,30 +1721,34 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] @@ -1851,18 +1764,18 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ - "bitflags 2.4.0", - "cfg-if 1.0.0", + "bitflags 2.6.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -1872,29 +1785,29 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", ] [[package]] name = "openssl-src" -version = "300.1.5+3.1.3" +version = "300.4.1+3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" +checksum = "faa4eac4138c62414b5622d1b31c5c304f34b406b013c079c2bbc652fdd6678c" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -1923,9 +1836,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1933,22 +1846,22 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets", ] [[package]] name = "paste" -version = "1.0.12" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem-rfc7468" @@ -1961,9 +1874,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" [[package]] name = "pin-utils" @@ -1983,24 +1896,33 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "platform" version = "0.1.0" dependencies = [ "arrayvec", - "cfg-if 1.0.0", + "cfg-if", "ufmt", ] +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[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 0.7.35", +] [[package]] name = "primeorder" @@ -2013,18 +1935,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2061,18 +1983,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.3" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", @@ -2082,9 +2004,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", @@ -2093,9 +2015,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rfc6979" @@ -2118,23 +2040,22 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.27" +version = "0.38.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "scopeguard" @@ -2142,12 +2063,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "sec1" version = "0.7.3" @@ -2164,40 +2079,41 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -2224,7 +2140,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] @@ -2233,7 +2149,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest", ] @@ -2248,6 +2164,12 @@ dependencies = [ "keccak", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signature" version = "2.2.0" @@ -2260,18 +2182,18 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "smlang" @@ -2303,17 +2225,11 @@ dependencies = [ "der", ] -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2328,9 +2244,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -2351,24 +2267,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", - "redox_syscall", + "once_cell", "rustix", - "windows-sys 0.45.0", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", + "windows-sys 0.59.0", ] [[package]] @@ -2379,32 +2286,34 @@ checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] [[package]] name = "time" -version = "0.3.29" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2418,10 +2327,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -2451,9 +2361,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.3" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -2463,20 +2373,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.7" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc18466501acd8ac6a3f615dd29a3438f8ca6bb3b19537138b3106e575621274" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -2485,9 +2395,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ufmt" @@ -2515,38 +2425,32 @@ source = "git+https://github.com/korran/ufmt.git?rev=1d0743c1ffffc68bc05ca8eeb81 [[package]] name = "uio" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5073b92c4a389c020d930424896f62c431b8cd858920519647aa1b1de5968fd1" +checksum = "1e5d9bffc3e2181d5d0ce370d9f7b086a191210a2f650e0c3961abf446ee308d" dependencies = [ "fs2", "libc", - "nix 0.11.1", + "nix", ] [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "ureg" @@ -2589,15 +2493,9 @@ dependencies = [ [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "void" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasi" @@ -2607,34 +2505,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2642,22 +2541,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.89", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "winapi" @@ -2675,15 +2574,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2691,30 +2581,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -2723,197 +2595,98 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[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_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "windows_i686_msvc" -version = "0.42.2" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[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_gnu" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[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_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.3.6" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] [[package]] name = "wycheproof" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e639f57253b80c6584b378011aec0fed61c4c21d7a4b97c4d9d7eaf35ca77d12" +checksum = "71039afb8a94cba8b3fbcd400af2d259eb0ecd833fca548130f9e7681ef2c53a" dependencies = [ - "base64", - "hex", + "data-encoding", "serde", "serde_json", ] @@ -2953,7 +2726,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" dependencies = [ "byteorder", - "zerocopy-derive", + "zerocopy-derive 0.6.6", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive 0.7.35", ] [[package]] @@ -2964,14 +2747,25 @@ checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", +] + +[[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.89", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -2984,5 +2778,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.89", ] diff --git a/api/src/soc_mgr.rs b/api/src/soc_mgr.rs index 29cf550bba..4024ecde60 100644 --- a/api/src/soc_mgr.rs +++ b/api/src/soc_mgr.rs @@ -319,8 +319,9 @@ pub trait SocManager { header.chksum = calc_checksum(R::ID.into(), payload_bytes); header_bytes.copy_from_slice(header.as_bytes()); - let Some(data) = SocManager::mailbox_exec(self, R::ID.into(), req.as_bytes(), resp_bytes)? else { - return Err(CaliptraApiError::MailboxNoResponseData); + let Some(data) = SocManager::mailbox_exec(self, R::ID.into(), req.as_bytes(), resp_bytes)? + else { + return Err(CaliptraApiError::MailboxNoResponseData); }; if data.len() < R::Resp::MIN_SIZE || data.len() > mem::size_of::() { diff --git a/builder/src/lib.rs b/builder/src/lib.rs index cd3f1d4ef1..2facac3ba9 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -388,7 +388,7 @@ pub fn elf2rom(elf_bytes: &[u8]) -> io::Result> { let elf = elf::ElfBytes::::minimal_parse(elf_bytes).map_err(other_err)?; let Some(segments) = elf.segments() else { - return Err(other_err("ELF file has no segments")) + return Err(other_err("ELF file has no segments")); }; for segment in segments { if segment.p_type != elf::abi::PT_LOAD { @@ -398,15 +398,21 @@ pub fn elf2rom(elf_bytes: &[u8]) -> io::Result> { let mem_offset = segment.p_paddr as usize; let len = segment.p_filesz as usize; let Some(src_bytes) = elf_bytes.get(file_offset..file_offset + len) else { - return Err(other_err(format!("segment at 0x{:x} out of file bounds", segment.p_offset))); + return Err(other_err(format!( + "segment at 0x{:x} out of file bounds", + segment.p_offset + ))); }; if len == 0 { continue; } let Some(dest_bytes) = result.get_mut(mem_offset..mem_offset + len) else { - return Err(other_err(format!( + return Err(other_err(format!( "segment at 0x{mem_offset:04x}..0x{:04x} exceeds the ROM region \ - of 0x0000..0x{:04x}", mem_offset + len, result.len()))); + of 0x0000..0x{:04x}", + mem_offset + len, + result.len() + ))); }; dest_bytes.copy_from_slice(src_bytes); } @@ -434,7 +440,7 @@ pub fn elf2rom(elf_bytes: &[u8]) -> io::Result> { pub fn elf_size(elf_bytes: &[u8]) -> io::Result { let elf = elf::ElfBytes::::minimal_parse(elf_bytes).map_err(other_err)?; let Some(segments) = elf.segments() else { - return Err(other_err("ELF file has no segments")) + return Err(other_err("ELF file has no segments")); }; let mut min_addr = u64::MAX; let mut max_addr = u64::MIN; @@ -445,11 +451,7 @@ pub fn elf_size(elf_bytes: &[u8]) -> io::Result { min_addr = min_addr.min(segment.p_paddr); max_addr = max_addr.max(segment.p_paddr + segment.p_filesz); } - Ok(if max_addr >= min_addr { - max_addr - min_addr - } else { - 0 - }) + Ok(max_addr.saturating_sub(min_addr)) } #[derive(Clone)] diff --git a/cfi/lib/src/cfi_counter.rs b/cfi/lib/src/cfi_counter.rs index 42b5bc64e5..bfc3ed26af 100644 --- a/cfi/lib/src/cfi_counter.rs +++ b/cfi/lib/src/cfi_counter.rs @@ -64,7 +64,8 @@ impl Default for CfiInt { } fn prng() -> &'static Xoshiro128 { - unsafe { &CFI_STATE.prng } + let cfi_state = &raw const CFI_STATE; + unsafe { &(*cfi_state).prng } } /// CFI counter @@ -177,8 +178,8 @@ impl CfiCounter { pub fn read() -> CfiInt { unsafe { CfiInt::from_raw( - core::ptr::read_volatile(&CFI_STATE.val as *const u32), - core::ptr::read_volatile(&CFI_STATE.mask as *const u32), + core::ptr::read_volatile(&raw const CFI_STATE.val), + core::ptr::read_volatile(&raw const CFI_STATE.mask), ) } } @@ -186,8 +187,8 @@ impl CfiCounter { /// Write counter value fn write(val: CfiInt) { unsafe { - core::ptr::write_volatile(&mut CFI_STATE.val as *mut u32, val.val); - core::ptr::write_volatile(&mut CFI_STATE.mask as *mut u32, val.masked_val); + core::ptr::write_volatile(&raw mut CFI_STATE.val, val.val); + core::ptr::write_volatile(&raw mut CFI_STATE.mask, val.masked_val); } } } diff --git a/ci-tools/size-history/src/git.rs b/ci-tools/size-history/src/git.rs index b543c88a7a..ec96f93bfc 100644 --- a/ci-tools/size-history/src/git.rs +++ b/ci-tools/size-history/src/git.rs @@ -29,7 +29,7 @@ impl CommitInfo { let mut title = expect_line_with_prefix(" ", lines.next())?.to_string(); 'inner: loop { let Some(line) = lines.next() else { - result.push(CommitInfo{ + result.push(CommitInfo { id: commit_id.into(), author: author.into(), title, diff --git a/ci-tools/size-history/src/main.rs b/ci-tools/size-history/src/main.rs index 6109e8ad17..242a947723 100644 --- a/ci-tools/size-history/src/main.rs +++ b/ci-tools/size-history/src/main.rs @@ -67,8 +67,12 @@ fn real_main() -> io::Result<()> { if !worktree.is_log_linear()? { println!("git history is not linear; attempting to squash PR"); - let (Ok(pull_request_title), Ok(base_ref)) = (env::var("PR_TITLE"), env::var("PR_BASE_COMMIT")) else { - return Err(other_err("non-linear history not supported outside of a PR")); + let (Ok(pull_request_title), Ok(base_ref)) = + (env::var("PR_TITLE"), env::var("PR_BASE_COMMIT")) + else { + return Err(other_err( + "non-linear history not supported outside of a PR", + )); }; let mut rebase_onto: String = base_ref; for merge_parents in worktree.merge_log()? { diff --git a/common/src/verifier.rs b/common/src/verifier.rs index 108060fc1b..2614654a8f 100644 --- a/common/src/verifier.rs +++ b/common/src/verifier.rs @@ -32,7 +32,7 @@ pub struct FirmwareImageVerificationEnv<'a, 'b> { pub image: &'b [u8], } -impl<'a, 'b> ImageVerificationEnv for &mut FirmwareImageVerificationEnv<'a, 'b> { +impl ImageVerificationEnv for &mut FirmwareImageVerificationEnv<'_, '_> { /// Calculate 384 digest using SHA2 Engine fn sha384_digest(&mut self, offset: u32, len: u32) -> CaliptraResult { let err = CaliptraError::IMAGE_VERIFIER_ERR_DIGEST_OUT_OF_BOUNDS; diff --git a/coverage/src/lib.rs b/coverage/src/lib.rs index 13065fcd0e..2b1635ad46 100644 --- a/coverage/src/lib.rs +++ b/coverage/src/lib.rs @@ -65,7 +65,7 @@ pub fn dump_emu_coverage_to_file( bitmap: &BitVec, ) -> std::io::Result<()> { let mut filename = format!("CovData{}", hex::encode(rand::random::<[u8; 16]>())); - filename.push_str(&'-'.to_string()); + filename.push('-'); filename.push_str(&tag.to_string()); filename.push_str(".bitvec"); @@ -164,7 +164,7 @@ pub fn collect_instr_pcs(id: &FwId<'static>) -> anyhow::Result> { let instruction = u16::from_le_bytes([instruction[0], instruction[1]]); match instruction & 0b11 { - 0 | 1 | 2 => { + 0..=2 => { index += 2; } _ => { @@ -263,7 +263,7 @@ pub mod calculator { fn test_parse_trace_file() { // Create a temporary trace file for testing let temp_trace_file = "temp_trace.txt"; - let trace_data = vec![ + let trace_data = [ "SoC write4 *0x300300bc <- 0x0", "SoC write4 *0x30030110 <- 0x2625a00", "SoC write4 *0x30030114 <- 0x0", @@ -312,5 +312,5 @@ fn test_coverage_map_creation_data_files() { let paths = get_bitvec_paths("/tmp").unwrap(); let cv = CoverageMap::new(paths); - assert!(cv.map.get(&tag).is_some()); + assert!(cv.map.contains_key(&tag)); } diff --git a/cpu/Cargo.toml b/cpu/Cargo.toml index 6503f3f606..d69551b3b8 100644 --- a/cpu/Cargo.toml +++ b/cpu/Cargo.toml @@ -12,6 +12,7 @@ edition = "2021" # --profile=firmware \ # --features riscv riscv = [] +std = [] [lib] test = false diff --git a/drivers/Cargo.toml b/drivers/Cargo.toml index f04aaeb264..3c9fb0f17e 100644 --- a/drivers/Cargo.toml +++ b/drivers/Cargo.toml @@ -28,7 +28,9 @@ caliptra-cfi-lib-git = { workspace = true, default-features = false, features = caliptra-cfi-derive-git = { workspace = true, optional = true } [features] +std = [] emu = [] +riscv = [] runtime = ["dep:dpe", "dep:caliptra-cfi-lib-git", "dep:caliptra-cfi-derive-git"] fmc = [] fpga_realtime = ["caliptra-hw-model/fpga_realtime"] diff --git a/drivers/src/ecc384.rs b/drivers/src/ecc384.rs index d41f61e54b..3b33ab1197 100644 --- a/drivers/src/ecc384.rs +++ b/drivers/src/ecc384.rs @@ -76,7 +76,7 @@ impl<'a> From<&'a mut Array4x12> for Ecc384PrivKeyOut<'a> { } } -impl<'a> From for Ecc384PrivKeyOut<'a> { +impl From for Ecc384PrivKeyOut<'_> { /// Converts to this type from the input type. fn from(value: KeyWriteArgs) -> Self { Self::Key(value) @@ -630,9 +630,6 @@ trait Ecc384KeyAccessErr { /// Convert to read seed operation error fn into_read_seed_err(self) -> CaliptraError; - /// Convert to read data operation error - fn into_read_data_err(self) -> CaliptraError; - /// Convert to read private key operation error fn into_read_priv_key_err(self) -> CaliptraError; @@ -650,15 +647,6 @@ impl Ecc384KeyAccessErr for KvAccessErr { } } - /// Convert to read data operation error - fn into_read_data_err(self) -> CaliptraError { - match self { - KvAccessErr::KeyRead => CaliptraError::DRIVER_ECC384_READ_DATA_KV_READ, - KvAccessErr::KeyWrite => CaliptraError::DRIVER_ECC384_READ_DATA_KV_WRITE, - KvAccessErr::Generic => CaliptraError::DRIVER_ECC384_READ_DATA_KV_UNKNOWN, - } - } - /// Convert to reads private key operation error fn into_read_priv_key_err(self) -> CaliptraError { match self { diff --git a/drivers/src/hmac.rs b/drivers/src/hmac.rs index ee6630c8e8..5947820f48 100644 --- a/drivers/src/hmac.rs +++ b/drivers/src/hmac.rs @@ -21,7 +21,6 @@ use crate::{ #[cfg(not(feature = "no-cfi"))] use caliptra_cfi_derive::cfi_impl_fn; use caliptra_registers::hmac::HmacReg; -use core::usize; const HMAC_BLOCK_SIZE_BYTES: usize = 128; const HMAC_BLOCK_LEN_OFFSET: usize = 112; @@ -86,7 +85,7 @@ impl<'a> From<&'a mut Array4x16> for HmacTag<'a> { } } -impl<'a> From for HmacTag<'a> { +impl From for HmacTag<'_> { /// Converts to this type from the input type. fn from(value: KeyWriteArgs) -> Self { Self::Key(value) @@ -161,7 +160,7 @@ impl Hmac { trng: &mut Trng, mut tag: HmacTag<'a>, mode: HmacMode, - ) -> CaliptraResult { + ) -> CaliptraResult> { let hmac = self.hmac.regs_mut(); // Configure the hardware so that the output tag is stored at a location specified by the @@ -551,7 +550,7 @@ pub struct HmacOp<'a> { mode: HmacMode, } -impl<'a> HmacOp<'a> { +impl HmacOp<'_> { /// /// Update the digest with data /// diff --git a/drivers/src/lib.rs b/drivers/src/lib.rs index 6632a03268..c00d8ea881 100644 --- a/drivers/src/lib.rs +++ b/drivers/src/lib.rs @@ -12,7 +12,7 @@ Abstract: --*/ -#![no_std] +#![cfg_attr(not(feature = "std"), no_std)] mod array; mod array_concat; @@ -108,12 +108,14 @@ pub use soc_ifc::{report_boot_status, Lifecycle, MfgFlags, ResetReason, SocIfc}; pub use trng::Trng; #[allow(unused_imports)] +#[allow(clippy::single_component_path_imports)] #[cfg(not(feature = "runtime"))] use caliptra_cfi_derive; #[allow(unused_imports)] #[cfg(feature = "runtime")] use caliptra_cfi_derive_git as caliptra_cfi_derive; #[allow(unused_imports)] +#[allow(clippy::single_component_path_imports)] #[cfg(not(feature = "runtime"))] use caliptra_cfi_lib; #[allow(unused_imports)] diff --git a/drivers/src/memory_layout.rs b/drivers/src/memory_layout.rs index d951d48cd2..2f22240b3c 100644 --- a/drivers/src/memory_layout.rs +++ b/drivers/src/memory_layout.rs @@ -81,9 +81,9 @@ pub const DPE_SIZE: u32 = 5 * 1024; pub const PCR_RESET_COUNTER_SIZE: u32 = 1024; pub const AUTH_MAN_IMAGE_METADATA_MAX_SIZE: u32 = 7 * 1024; pub const IDEVID_CSR_SIZE: u32 = 1024; -pub const DATA_SIZE: u32 = 115 * 1024; -pub const STACK_SIZE: u32 = 64 * 1024; -pub const ROM_STACK_SIZE: u32 = 40 * 1024; +pub const DATA_SIZE: u32 = 113 * 1024; +pub const STACK_SIZE: u32 = 66 * 1024; +pub const ROM_STACK_SIZE: u32 = 46 * 1024; pub const ESTACK_SIZE: u32 = 1024; pub const ROM_ESTACK_SIZE: u32 = 1024; pub const NSTACK_SIZE: u32 = 1024; diff --git a/drivers/src/sha1.rs b/drivers/src/sha1.rs index d332329a14..7be1b0c5f7 100644 --- a/drivers/src/sha1.rs +++ b/drivers/src/sha1.rs @@ -216,7 +216,7 @@ pub struct Sha1DigestOp<'a> { data_size: usize, } -impl<'a> Sha1DigestOp<'a> { +impl Sha1DigestOp<'_> { /// Update the digest with data /// /// # Arguments diff --git a/drivers/src/sha256.rs b/drivers/src/sha256.rs index d374d7690e..b7120e0016 100644 --- a/drivers/src/sha256.rs +++ b/drivers/src/sha256.rs @@ -12,8 +12,6 @@ Abstract: --*/ -use core::usize; - use crate::{array::Array4x16, wait, Array4x8, CaliptraError, CaliptraResult}; use caliptra_registers::sha256::Sha256Reg; @@ -548,7 +546,7 @@ impl<'a> Sha256DigestOp<'a> for Sha256DigestOpHw<'a> { Ok(()) } } -impl<'a> Sha256DigestOpHw<'a> { +impl Sha256DigestOpHw<'_> { /// Check if this the first digest operation fn is_first(&self) -> bool { self.state == Sha256DigestState::Init diff --git a/drivers/src/sha2_512_384.rs b/drivers/src/sha2_512_384.rs index 8e62763b90..97d4643229 100644 --- a/drivers/src/sha2_512_384.rs +++ b/drivers/src/sha2_512_384.rs @@ -12,8 +12,6 @@ Abstract: --*/ -use core::usize; - use crate::kv_access::{KvAccess, KvAccessErr}; use crate::PcrId; use crate::{array::Array4x32, wait, Array4x12, Array4x16, Array4x8}; @@ -404,7 +402,7 @@ pub struct Sha2DigestOp<'a, const HASH_SIZE: u16> { data_size: usize, } -impl<'a, const HASH_SIZE: u16> Sha2DigestOp<'a, HASH_SIZE> { +impl Sha2DigestOp<'_, HASH_SIZE> { /// Check if this the first digest operation fn is_first(&self) -> bool { self.state == Sha2DigestState::Init @@ -418,7 +416,7 @@ impl<'a, const HASH_SIZE: u16> Sha2DigestOp<'a, HASH_SIZE> { } } -impl<'a> Sha2DigestOp<'a, 384> { +impl Sha2DigestOp<'_, 384> { /// Update the digest with data /// /// # Arguments diff --git a/drivers/src/sha2_512_384acc.rs b/drivers/src/sha2_512_384acc.rs index 0439bf9178..2e61bf30c9 100644 --- a/drivers/src/sha2_512_384acc.rs +++ b/drivers/src/sha2_512_384acc.rs @@ -46,14 +46,14 @@ impl Sha2_512_384Acc { /// # Arguments /// /// * assumed_lock_state - The assumed lock state of the SHA384 Accelerator. - /// Note: Callers should pass assumed_lock_state=ShaAccLockState::NotAcquired - /// unless they are the first caller to the peripheral after a cold/warm boot. + /// Note: Callers should pass assumed_lock_state=ShaAccLockState::NotAcquired + /// unless they are the first caller to the peripheral after a cold/warm boot. /// /// # Returns /// /// * On success, either an object representing the SHA384 accelerator operation or - /// 'None' if unable to acquire the SHA384 Accelerator lock. - /// On failure, an error code. + /// 'None' if unable to acquire the SHA384 Accelerator lock. + /// On failure, an error code. /// pub fn try_start_operation( &mut self, diff --git a/drivers/test-fw/src/bin/ecc384_tests.rs b/drivers/test-fw/src/bin/ecc384_tests.rs index a185ec8d0e..30530f6b95 100644 --- a/drivers/test-fw/src/bin/ecc384_tests.rs +++ b/drivers/test-fw/src/bin/ecc384_tests.rs @@ -86,7 +86,7 @@ fn test_gen_key_pair() { let mut der = [0u8; 97]; der[0] = 0x04; - der[01..49].copy_from_slice(&PUB_KEY_X); + der[1..49].copy_from_slice(&PUB_KEY_X); der[49..97].copy_from_slice(&PUB_KEY_Y); assert_eq!(pub_key.to_der(), der); } @@ -495,10 +495,7 @@ fn test_kat() { let mut entropy_gen = || trng.generate().map(|a| a.0); CfiCounter::reset(&mut entropy_gen); - assert_eq!( - Ecc384Kat::default().execute(&mut ecc, &mut trng).is_ok(), - true - ); + assert!(Ecc384Kat::default().execute(&mut ecc, &mut trng).is_ok()); } test_suite! { diff --git a/drivers/test-fw/src/bin/hmac_tests.rs b/drivers/test-fw/src/bin/hmac_tests.rs index 7722b5545b..41150f4e39 100755 --- a/drivers/test-fw/src/bin/hmac_tests.rs +++ b/drivers/test-fw/src/bin/hmac_tests.rs @@ -436,7 +436,7 @@ fn test_kdf_hmac384( hmac384 .hmac( &(&key_0).into(), - &(&msg_0.into()), + &msg_0.into(), &mut trng, kdf_key_out.into(), HmacMode::Hmac384, diff --git a/drivers/test-fw/src/bin/mailbox_driver_negative_tests.rs b/drivers/test-fw/src/bin/mailbox_driver_negative_tests.rs index 9f2010dac1..1a4d438b6f 100644 --- a/drivers/test-fw/src/bin/mailbox_driver_negative_tests.rs +++ b/drivers/test-fw/src/bin/mailbox_driver_negative_tests.rs @@ -34,7 +34,6 @@ extern "C" fn main() { while !txn.is_response_ready() && !mbox_fsm_error() {} txn.complete().unwrap(); drop(txn); - drop(mbox); // Clear any error states // TODO: This should probably be done in the driver diff --git a/drivers/test-fw/src/bin/mailbox_driver_responder.rs b/drivers/test-fw/src/bin/mailbox_driver_responder.rs index 6aaf4d2f2c..4bae6e8319 100644 --- a/drivers/test-fw/src/bin/mailbox_driver_responder.rs +++ b/drivers/test-fw/src/bin/mailbox_driver_responder.rs @@ -49,7 +49,7 @@ extern "C" fn main() { let dlen = txn.dlen() as usize; let dlen_words = (dlen + 3) / 4; println!("dlen: {dlen}"); - for _ in 0..((dlen_words + (buf.len() - 1)) / buf.len()) { + for _ in 0..dlen_words.div_ceil(buf.len()) { txn.copy_request(buf.as_bytes_mut()).unwrap(); println!("buf: {:08x?}", buf); } @@ -87,7 +87,7 @@ extern "C" fn main() { let dlen = txn.dlen() as usize; let dlen_words = (dlen + 3) / 4; println!("dlen: {dlen}"); - for _ in 0..((dlen_words + (buf.len() - 1)) / buf.len()) { + for _ in 0..dlen_words.div_ceil(buf.len()) { txn.copy_request(buf.as_bytes_mut()).unwrap(); println!("buf: {:08x?}", buf); } diff --git a/drivers/test-fw/src/bin/mbox_send_txn_drop.rs b/drivers/test-fw/src/bin/mbox_send_txn_drop.rs index c78716c8e7..7b13a29dd5 100644 --- a/drivers/test-fw/src/bin/mbox_send_txn_drop.rs +++ b/drivers/test-fw/src/bin/mbox_send_txn_drop.rs @@ -39,24 +39,24 @@ extern "C" fn main() { txn.write_dlen(1).unwrap(); txn.execute_request().unwrap(); drop(txn); - assert_eq!(mbox_fsm_error(), false); + assert!(!mbox_fsm_error()); // Transition from rdy_for_data to idle let mut txn = mbox.try_start_send_txn().unwrap(); txn.write_cmd(0).unwrap(); txn.write_dlen(1).unwrap(); drop(txn); - assert_eq!(mbox_fsm_error(), false); + assert!(!mbox_fsm_error()); // Transition from rdy_for_dlen to idle let mut txn = mbox.try_start_send_txn().unwrap(); txn.write_cmd(0).unwrap(); drop(txn); - assert_eq!(mbox_fsm_error(), false); + assert!(!mbox_fsm_error()); // Transition from rdy_for_cmd to idle let txn = mbox.try_start_send_txn().unwrap(); drop(txn); - assert_eq!(mbox_fsm_error(), false); + assert!(!mbox_fsm_error()); let _ = mbox.try_start_send_txn().unwrap(); } diff --git a/drivers/test-fw/src/bin/negative_tests_lms.rs b/drivers/test-fw/src/bin/negative_tests_lms.rs index c2fef59b6b..e0da31a4a2 100644 --- a/drivers/test-fw/src/bin/negative_tests_lms.rs +++ b/drivers/test-fw/src/bin/negative_tests_lms.rs @@ -340,7 +340,7 @@ fn test_failures_lms_24() { let new_message = "this is a different message".as_bytes(); let result = Lms::default() - .verify_lms_signature(&mut sha256, &new_message, &LMS_PUBLIC_KEY, &lms_sig) + .verify_lms_signature(&mut sha256, new_message, &LMS_PUBLIC_KEY, &lms_sig) .unwrap(); assert_ne!(result, LmsResult::Success); diff --git a/drivers/test-fw/src/bin/sha1_tests.rs b/drivers/test-fw/src/bin/sha1_tests.rs index 4de7ef92a3..60b73fbf86 100644 --- a/drivers/test-fw/src/bin/sha1_tests.rs +++ b/drivers/test-fw/src/bin/sha1_tests.rs @@ -68,10 +68,7 @@ fn test_kat() { // Init CFI CfiCounter::reset(&mut || Ok([0xDEADBEEFu32; 12])); - assert_eq!( - Sha1Kat::default().execute(&mut Sha1::default()).is_ok(), - true - ); + assert!(Sha1Kat::default().execute(&mut Sha1::default()).is_ok()); } test_suite! { diff --git a/drivers/test-fw/src/bin/sha256_tests.rs b/drivers/test-fw/src/bin/sha256_tests.rs index f003e568bd..6831ab5613 100644 --- a/drivers/test-fw/src/bin/sha256_tests.rs +++ b/drivers/test-fw/src/bin/sha256_tests.rs @@ -225,7 +225,7 @@ fn test_kat() { CfiCounter::reset(&mut || Ok([0xDEADBEEFu32; 12])); let mut sha = unsafe { Sha256::new(Sha256Reg::new()) }; - assert_eq!(Sha256Kat::default().execute(&mut sha).is_ok(), true); + assert!(Sha256Kat::default().execute(&mut sha).is_ok()); } test_suite! { diff --git a/drivers/test-fw/src/bin/sha2_512_384acc_tests.rs b/drivers/test-fw/src/bin/sha2_512_384acc_tests.rs index 704f60b104..19c446004c 100644 --- a/drivers/test-fw/src/bin/sha2_512_384acc_tests.rs +++ b/drivers/test-fw/src/bin/sha2_512_384acc_tests.rs @@ -50,7 +50,7 @@ fn test_digest0() { if let Some(mut txn) = mbox.try_start_send_txn() { const CMD: u32 = 0x1c; - assert!(txn.send_request(CMD, &data).is_ok()); + assert!(txn.send_request(CMD, data).is_ok()); let mut digest = Array4x12::default(); let mut digest_512 = Array4x16::default(); @@ -59,27 +59,26 @@ fn test_digest0() { .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384(data.len() as u32, 0, false, (&mut digest).into()); + let result = sha_acc_op.digest_384(data.len() as u32, 0, false, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = - sha_acc_op.digest_512(data.len() as u32, 0, false, (&mut digest_512).into()); + let result = sha_acc_op.digest_512(data.len() as u32, 0, false, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } drop(txn); }; @@ -106,7 +105,7 @@ fn test_digest1() { if let Some(mut txn) = mbox.try_start_send_txn() { const CMD: u32 = 0x1c; - assert!(txn.send_request(CMD, &data).is_ok()); + assert!(txn.send_request(CMD, data).is_ok()); let mut digest = Array4x12::default(); let mut digest_512 = Array4x16::default(); @@ -115,27 +114,26 @@ fn test_digest1() { .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384(data.len() as u32, 0, false, (&mut digest).into()); + let result = sha_acc_op.digest_384(data.len() as u32, 0, false, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = - sha_acc_op.digest_512(data.len() as u32, 0, false, (&mut digest_512).into()); + let result = sha_acc_op.digest_512(data.len() as u32, 0, false, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } drop(txn); }; @@ -165,33 +163,32 @@ fn test_digest2() { if let Some(mut txn) = mbox.try_start_send_txn() { const CMD: u32 = 0x1c; - assert!(txn.send_request(CMD, &data).is_ok()); + assert!(txn.send_request(CMD, data).is_ok()); if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384(data.len() as u32, 0, false, (&mut digest).into()); + let result = sha_acc_op.digest_384(data.len() as u32, 0, false, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = - sha_acc_op.digest_512(data.len() as u32, 0, false, (&mut digest_512).into()); + let result = sha_acc_op.digest_512(data.len() as u32, 0, false, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } drop(txn); }; @@ -221,32 +218,32 @@ fn test_digest_offset() { if let Some(mut txn) = mbox.try_start_send_txn() { const CMD: u32 = 0x1c; - assert!(txn.send_request(CMD, &data).is_ok()); + assert!(txn.send_request(CMD, data).is_ok()); if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384(8, 4, false, (&mut digest).into()); + let result = sha_acc_op.digest_384(8, 4, false, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_512(8, 4, false, (&mut digest_512).into()); + let result = sha_acc_op.digest_512(8, 4, false, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); } drop(txn); }; @@ -276,26 +273,26 @@ fn test_digest_zero_size_buffer() { .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384(0, 0, true, (&mut digest).into()); + let result = sha_acc_op.digest_384(0, 0, true, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); }; if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_512(0, 0, true, (&mut digest_512).into()); + let result = sha_acc_op.digest_512(0, 0, true, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); }; } @@ -338,47 +335,35 @@ fn test_digest_max_mailbox_size() { .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_384( - MAX_MAILBOX_CAPACITY_BYTES as u32, - 0, - true, - (&mut digest).into(), - ); + let result = sha_acc_op.digest_384(MAX_MAILBOX_CAPACITY_BYTES as u32, 0, true, &mut digest); assert!(result.is_ok()); assert_eq!(digest, Array4x12::from(expected)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); }; if let Some(mut sha_acc_op) = sha_acc .try_start_operation(ShaAccLockState::NotAcquired) .unwrap() { - let result = sha_acc_op.digest_512( - MAX_MAILBOX_CAPACITY_BYTES as u32, - 0, - true, - (&mut digest_512).into(), - ); + let result = + sha_acc_op.digest_512(MAX_MAILBOX_CAPACITY_BYTES as u32, 0, true, &mut digest_512); assert!(result.is_ok()); assert_eq!(digest_512, Array4x16::from(expected_512)); drop(sha_acc_op); } else { - assert!(false); + panic!("Operation failed"); }; } fn test_kat() { let mut sha_acc = unsafe { Sha2_512_384Acc::new(Sha512AccCsr::new()) }; - assert_eq!( - Sha2_512_384AccKat::default() - .execute(&mut sha_acc, ShaAccLockState::AssumedLocked) - .is_ok(), - true - ); + assert!(Sha2_512_384AccKat::default() + .execute(&mut sha_acc, ShaAccLockState::AssumedLocked) + .is_ok()); } test_suite! { diff --git a/drivers/test-fw/src/bin/sha384_tests.rs b/drivers/test-fw/src/bin/sha384_tests.rs index ead03d3f4f..290b9e27a1 100644 --- a/drivers/test-fw/src/bin/sha384_tests.rs +++ b/drivers/test-fw/src/bin/sha384_tests.rs @@ -45,7 +45,7 @@ fn test_digest1() { 0xC8, 0x25, 0xA7, ]; let data = "abc".as_bytes(); - let digest = sha384.sha384_digest(data.into()).unwrap(); + let digest = sha384.sha384_digest(data).unwrap(); assert_eq!(digest, Array4x12::from(expected)); } @@ -58,7 +58,7 @@ fn test_digest2() { 0xC8, 0x45, 0x2B, ]; let data = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq".as_bytes(); - let digest = sha384.sha384_digest(data.into()).unwrap(); + let digest = sha384.sha384_digest(data).unwrap(); assert_eq!(digest, Array4x12::from(expected)); } @@ -71,7 +71,7 @@ fn test_digest3() { 0x74, 0x60, 0x39, ]; let data = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu".as_bytes(); - let digest = sha384.sha384_digest(data.into()).unwrap(); + let digest = sha384.sha384_digest(data).unwrap(); assert_eq!(digest, Array4x12::from(expected)); } @@ -388,7 +388,7 @@ fn test_kat() { let mut sha384 = unsafe { Sha2_512_384::new(Sha512Reg::new()) }; - assert_eq!(Sha384Kat::default().execute(&mut sha384).is_ok(), true); + assert!(Sha384Kat::default().execute(&mut sha384).is_ok()); } test_suite! { diff --git a/drivers/test-fw/src/bin/test_success.rs b/drivers/test-fw/src/bin/test_success.rs index 0938b33970..538206dd40 100644 --- a/drivers/test-fw/src/bin/test_success.rs +++ b/drivers/test-fw/src/bin/test_success.rs @@ -8,6 +8,7 @@ #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } @@ -25,5 +26,6 @@ extern "C" fn main() { .cptra_generic_output_wires() .at(0) .write(|_| 0xff); + #[allow(clippy::empty_loop)] loop {} } diff --git a/drivers/test-fw/src/bin/test_uart.rs b/drivers/test-fw/src/bin/test_uart.rs index 047bcd01eb..fc9b932b84 100644 --- a/drivers/test-fw/src/bin/test_uart.rs +++ b/drivers/test-fw/src/bin/test_uart.rs @@ -8,10 +8,12 @@ use caliptra_drivers::{ExitCtrl, Uart}; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #![allow(clippy::empty_loop)] loop {} } diff --git a/drivers/test-fw/src/bin/trng_driver_responder.rs b/drivers/test-fw/src/bin/trng_driver_responder.rs index 94eb7dd685..673da88836 100644 --- a/drivers/test-fw/src/bin/trng_driver_responder.rs +++ b/drivers/test-fw/src/bin/trng_driver_responder.rs @@ -18,12 +18,14 @@ use zerocopy::AsBytes; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } #[no_mangle] extern "C" fn cfi_panic_handler(code: u32) -> ! { println!("[TRNG] CFI Panic code=0x{:08X}", code); + #[allow(clippy::empty_loop)] loop {} } diff --git a/fmc/Cargo.toml b/fmc/Cargo.toml index a2e4fd245f..bc5093a609 100644 --- a/fmc/Cargo.toml +++ b/fmc/Cargo.toml @@ -32,11 +32,12 @@ caliptra-image-types.workspace = true openssl.workspace = true [features] -default = ["std"] +default = ["std", "caliptra-drivers/no-cfi"] emu = ["caliptra_common/emu", "caliptra-drivers/emu"] -riscv = ["caliptra-cpu/riscv"] -std = ["ufmt/std", "caliptra_common/std"] +fake-fmc = [] fpga_realtime = ["caliptra-hw-model/fpga_realtime"] itrng = ["caliptra-hw-model/itrng"] +no-cfi = ["caliptra-drivers/no-cfi"] +riscv = ["caliptra-cpu/riscv"] +std = ["ufmt/std", "caliptra_common/std", "caliptra-drivers/std", "caliptra-cpu/std"] verilator = ["caliptra-hw-model/verilator"] -fake-fmc = [] diff --git a/hw-model/c-binding/src/caliptra_model.rs b/hw-model/c-binding/src/caliptra_model.rs index 531df88c6f..a34f3d90a0 100644 --- a/hw-model/c-binding/src/caliptra_model.rs +++ b/hw-model/c-binding/src/caliptra_model.rs @@ -151,7 +151,7 @@ pub unsafe extern "C" fn caliptra_model_output_peek(model: *mut caliptra_model) assert!(!model.is_null()); let peek_str = (*{ model as *mut DefaultHwModel }).output().peek(); caliptra_buffer { - data: peek_str.as_ptr() as *const u8, + data: peek_str.as_ptr(), len: peek_str.len(), } } diff --git a/hw-model/src/lib.rs b/hw-model/src/lib.rs index 7467662b42..b85220bffc 100644 --- a/hw-model/src/lib.rs +++ b/hw-model/src/lib.rs @@ -91,14 +91,13 @@ pub const DEFAULT_APB_PAUSER: u32 = 0x01; /// should use [`new`] instead. pub fn new_unbooted(params: InitParams) -> Result> { let summary = params.summary(); - DefaultHwModel::new_unbooted(params).map(|hw| { + DefaultHwModel::new_unbooted(params).inspect(|hw| { println!( "Using hardware-model {} trng={:?}", hw.type_name(), hw.trng_mode() ); println!("{summary:#?}"); - hw }) } @@ -182,7 +181,7 @@ pub struct InitParams<'a> { // overflows. pub stack_info: Option, } -impl<'a> Default for InitParams<'a> { +impl Default for InitParams<'_> { fn default() -> Self { let seed = std::env::var("CPTRA_TRNG_SEED") .ok() @@ -220,7 +219,7 @@ impl<'a> Default for InitParams<'a> { } } -impl<'a> InitParams<'a> { +impl InitParams<'_> { fn summary(&self) -> InitParamsSummary { InitParamsSummary { rom_sha384: sha2::Sha384::digest(self.rom).into(), @@ -263,7 +262,7 @@ pub struct BootParams<'a> { pub wdt_timeout_cycles: u64, } -impl<'a> Default for BootParams<'a> { +impl Default for BootParams<'_> { fn default() -> Self { Self { fuses: Default::default(), @@ -462,7 +461,7 @@ pub struct MailboxRecvTxn<'a, TModel: HwModel> { model: &'a mut TModel, pub req: MailboxRequest, } -impl<'a, Model: HwModel> MailboxRecvTxn<'a, Model> { +impl MailboxRecvTxn<'_, Model> { pub fn respond_success(self) { self.complete(MboxStatusE::CmdComplete); } diff --git a/hw-model/src/model_emulated.rs b/hw-model/src/model_emulated.rs index f94c22e4f4..fac72bb0d9 100644 --- a/hw-model/src/model_emulated.rs +++ b/hw-model/src/model_emulated.rs @@ -34,7 +34,7 @@ pub struct EmulatedAxiBus<'a> { model: &'a mut ModelEmulated, } -impl<'a> Bus for EmulatedAxiBus<'a> { +impl Bus for EmulatedAxiBus<'_> { fn read(&mut self, size: RvSize, addr: RvAddr) -> Result { let result = self.model.soc_to_caliptra_bus.read(size, addr); self.model.cpu.bus.log_read("SoC", size, addr, result); diff --git a/hw-model/test-fw/mailbox_responder.rs b/hw-model/test-fw/mailbox_responder.rs index d4ca7122fd..5220426233 100644 --- a/hw-model/test-fw/mailbox_responder.rs +++ b/hw-model/test-fw/mailbox_responder.rs @@ -7,6 +7,7 @@ // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; use caliptra_drivers::cprint; @@ -46,13 +47,13 @@ extern "C" fn main() { let dlen = mbox.dlen().read(); let dlen_words = usize::try_from((dlen + 3) / 4).unwrap(); let mut buf = [0u32; 8]; - for i in 0..dlen_words { - buf[i] = mbox.dataout().read(); + for e in buf.iter_mut().take(dlen_words) { + *e = mbox.dataout().read(); } mbox.dlen().write(|_| dlen + 4); mbox.datain().write(|_| cmd); - for i in 0..dlen_words { - mbox.datain().write(|_| buf[i]); + for e in buf.iter().take(dlen_words) { + mbox.datain().write(|_| *e); } mbox.status().write(|w| w.status(|w| w.data_ready())); } @@ -77,8 +78,8 @@ extern "C" fn main() { 0x3000_0000 => { let dlen = mbox.dlen().read(); let dlen_words = usize::try_from((dlen + 3) / 4).unwrap(); - for i in 0..usize::min(dlen_words, replay_buf.len()) { - replay_buf[i] = mbox.dataout().read(); + for e in replay_buf.iter_mut().take(dlen_words) { + *e = mbox.dataout().read(); } replay_buf_len = u32::min(dlen, u32::try_from(replay_buf.len()).unwrap()); mbox.status().write(|w| w.status(|w| w.cmd_complete())); @@ -100,8 +101,8 @@ extern "C" fn main() { cprint!("|"); mbox.dlen().write(|_| replay_buf_len); let dlen_words = usize::try_from((replay_buf_len + 3) / 4).unwrap(); - for i in 0..dlen_words { - mbox.datain().write(|_| replay_buf[i]); + for e in replay_buf.iter().take(dlen_words) { + mbox.datain().write(|_| *e); } mbox.status().write(|w| w.status(|w| w.data_ready())); } diff --git a/hw-model/test-fw/test_dccm_double_bit_ecc.rs b/hw-model/test-fw/test_dccm_double_bit_ecc.rs index 500f03787a..cac5cd637a 100644 --- a/hw-model/test-fw/test_dccm_double_bit_ecc.rs +++ b/hw-model/test-fw/test_dccm_double_bit_ecc.rs @@ -7,6 +7,7 @@ use ::core::arch::global_asm; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] diff --git a/hw-model/test-fw/test_iccm_byte_write.rs b/hw-model/test-fw/test_iccm_byte_write.rs index b83f00d197..55b7f129c2 100644 --- a/hw-model/test-fw/test_iccm_byte_write.rs +++ b/hw-model/test-fw/test_iccm_byte_write.rs @@ -7,6 +7,7 @@ use ::core::arch::global_asm; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] diff --git a/hw-model/test-fw/test_iccm_double_bit_ecc.rs b/hw-model/test-fw/test_iccm_double_bit_ecc.rs index 910b7bcb6a..dd8fb6fb27 100644 --- a/hw-model/test-fw/test_iccm_double_bit_ecc.rs +++ b/hw-model/test-fw/test_iccm_double_bit_ecc.rs @@ -7,10 +7,12 @@ use ::core::arch::global_asm; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } diff --git a/hw-model/test-fw/test_iccm_unaligned_write.rs b/hw-model/test-fw/test_iccm_unaligned_write.rs index d72f6b6735..16eebad5c8 100644 --- a/hw-model/test-fw/test_iccm_unaligned_write.rs +++ b/hw-model/test-fw/test_iccm_unaligned_write.rs @@ -7,6 +7,7 @@ use ::core::arch::global_asm; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] diff --git a/hw-model/test-fw/test_iccm_write_locked.rs b/hw-model/test-fw/test_iccm_write_locked.rs index 0a44a07850..9a489a73ec 100644 --- a/hw-model/test-fw/test_iccm_write_locked.rs +++ b/hw-model/test-fw/test_iccm_write_locked.rs @@ -12,6 +12,7 @@ use caliptra_test_harness::println; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } @@ -28,5 +29,6 @@ extern "C" fn main() { let iccm_ptr = iccm_start as *mut u32; *iccm_ptr = 0xdeadbeef; } + #[allow(clippy::empty_loop)] loop {} } diff --git a/hw-model/test-fw/test_invalid_instruction.rs b/hw-model/test-fw/test_invalid_instruction.rs index 11d6fda9b1..c30e6e1715 100644 --- a/hw-model/test-fw/test_invalid_instruction.rs +++ b/hw-model/test-fw/test_invalid_instruction.rs @@ -7,6 +7,7 @@ use ::core::arch::global_asm; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] diff --git a/hw-model/test-fw/test_uninitialized_read.rs b/hw-model/test-fw/test_uninitialized_read.rs index ff7c022812..108dcfc31f 100644 --- a/hw-model/test-fw/test_uninitialized_read.rs +++ b/hw-model/test-fw/test_uninitialized_read.rs @@ -7,10 +7,12 @@ use caliptra_registers::{self, mbox::MboxCsr, soc_ifc::SocIfcReg}; // Needed to bring in startup code #[allow(unused)] +#[allow(clippy::single_component_path_imports)] use caliptra_test_harness; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } @@ -44,5 +46,6 @@ extern "C" fn main() { .cptra_generic_output_wires() .at(0) .write(|_| 0xff); + #[allow(clippy::empty_loop)] loop {} } diff --git a/hw-model/test-fw/test_write_to_rom.rs b/hw-model/test-fw/test_write_to_rom.rs index 53afda0796..41dc2dbc2e 100644 --- a/hw-model/test-fw/test_write_to_rom.rs +++ b/hw-model/test-fw/test_write_to_rom.rs @@ -11,6 +11,7 @@ use caliptra_test_harness::println; #[panic_handler] pub fn panic(_info: &core::panic::PanicInfo) -> ! { + #[allow(clippy::empty_loop)] loop {} } @@ -21,5 +22,6 @@ extern "C" fn main() { let rom_address_ptr = rom_address as *mut u32; *rom_address_ptr = 0xdeadbeef; } + #[allow(clippy::empty_loop)] loop {} } diff --git a/hw-model/tests/model_tests.rs b/hw-model/tests/model_tests.rs index 158e793753..954b554aed 100644 --- a/hw-model/tests/model_tests.rs +++ b/hw-model/tests/model_tests.rs @@ -29,7 +29,8 @@ fn wait_with_timeout(child: &mut Child, timeout: Duration) -> Option { fn run_fw_elf(elf: &[u8]) -> DefaultHwModel { let rom = caliptra_builder::elf2rom(elf).unwrap(); - let model = caliptra_hw_model::new( + + caliptra_hw_model::new( InitParams { rom: &rom, random_sram_puf: false, @@ -37,21 +38,20 @@ fn run_fw_elf(elf: &[u8]) -> DefaultHwModel { }, BootParams::default(), ) - .unwrap(); - model + .unwrap() } fn run_fw_elf_with_rand_puf(elf: &[u8]) -> DefaultHwModel { let rom = caliptra_builder::elf2rom(elf).unwrap(); - let model = caliptra_hw_model::new( + + caliptra_hw_model::new( InitParams { rom: &rom, ..Default::default() }, BootParams::default(), ) - .unwrap(); - model + .unwrap() } #[test] diff --git a/hw-model/types/src/lib.rs b/hw-model/types/src/lib.rs index b290bb6af0..c1454bf0b4 100644 --- a/hw-model/types/src/lib.rs +++ b/hw-model/types/src/lib.rs @@ -1,6 +1,6 @@ // Licensed under the Apache-2.0 license -use caliptra_api_types::{self, Fuses, SecurityState}; +use caliptra_api_types::{self}; use std::array; pub use caliptra_api_types::DeviceLifecycle; @@ -27,15 +27,6 @@ pub const DEFAULT_CPTRA_OBF_KEY: [u32; 8] = [ 0xa0a1a2a3, 0xb0b1b2b3, 0xc0c1c2c3, 0xd0d1d2d3, 0xe0e1e2e3, 0xf0f1f2f3, 0xa4a5a6a7, 0xb4b5b6b7, ]; -struct SecurityStateWrapper(SecurityState); -impl std::fmt::Debug for SecurityStateWrapper { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("SecurityState") - .field("debug_locked", &self.0.debug_locked()) - .field("device_lifecycle", &self.0.device_lifecycle()) - .finish() - } -} #[derive(Clone, Copy, PartialEq, Eq, Debug, Default)] pub enum U4 { #[default] @@ -106,38 +97,8 @@ impl TryFrom for U4 { } } -struct FusesWrapper(Fuses); -impl std::fmt::Debug for FusesWrapper { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Fuses") - .field("uds_seed", &HexSlice(&self.0.uds_seed)) - .field("field_entropy", &HexSlice(&self.0.field_entropy)) - .field( - "key_manifest_pk_hash", - &HexSlice(&self.0.key_manifest_pk_hash), - ) - .field( - "key_manifest_pk_hash_mask", - &self.0.key_manifest_pk_hash_mask, - ) - .field("owner_pk_hash", &HexSlice(&self.0.owner_pk_hash)) - .field("fmc_key_manifest_svn", &self.0.fmc_key_manifest_svn) - .field("runtime_svn", &HexSlice(&self.0.runtime_svn)) - .field("anti_rollback_disable", &self.0.anti_rollback_disable) - .field("idevid_cert_attr", &HexSlice(&self.0.idevid_cert_attr)) - .field( - "idevid_manuf_hsm_id", - &HexSlice(&self.0.idevid_manuf_hsm_id), - ) - .field("life_cycle", &self.0.life_cycle) - .field("fuse_lms_revocation", &self.0.fuse_lms_revocation) - .field("soc_stepping_id", &self.0.soc_stepping_id) - .finish() - } -} - pub struct HexSlice<'a, T: std::fmt::LowerHex + PartialEq>(pub &'a [T]); -impl<'a, T: std::fmt::LowerHex + PartialEq> std::fmt::Debug for HexSlice<'a, T> { +impl std::fmt::Debug for HexSlice<'_, T> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { let width = std::mem::size_of::() * 2 + 2; if self.0.len() > 1 && self.0.iter().all(|item| item == &self.0[0]) { @@ -157,7 +118,7 @@ impl<'a, T: std::fmt::LowerHex + PartialEq> std::fmt::Debug for HexSlice<'a, T> } pub struct HexBytes<'a>(pub &'a [u8]); -impl<'a> std::fmt::Debug for HexBytes<'a> { +impl std::fmt::Debug for HexBytes<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "\"")?; for val in self.0.iter() { diff --git a/image/crypto/src/lib.rs b/image/crypto/src/lib.rs index e07c197ff6..3c0f06b973 100644 --- a/image/crypto/src/lib.rs +++ b/image/crypto/src/lib.rs @@ -208,8 +208,8 @@ fn generate_lms_pubkey_helper( Some(_) => 1, None => (((1 << tree_height) as u32) + q.unwrap()) ^ 1, }; - let mut k = vec![0u8; SHA192_DIGEST_BYTE_SIZE]; - let zero_k = vec![0u8; SHA192_DIGEST_BYTE_SIZE]; + let mut k = [0u8; SHA192_DIGEST_BYTE_SIZE]; + let zero_k = [0u8; SHA192_DIGEST_BYTE_SIZE]; let mut level: usize = 0; let mut pub_key_stack = vec![0u8; SHA192_DIGEST_BYTE_SIZE * (tree_height as usize)]; diff --git a/image/elf/src/lib.rs b/image/elf/src/lib.rs index 0dfb64b83d..cee4a80973 100644 --- a/image/elf/src/lib.rs +++ b/image/elf/src/lib.rs @@ -75,7 +75,12 @@ impl ElfExecutable { bail!("ELF file has no segments"); }; - let Some(load_addr) = segments.iter().filter(|s| s.p_type == PT_LOAD).map(|s| s.p_paddr as u32).min() else { + let Some(load_addr) = segments + .iter() + .filter(|s| s.p_type == PT_LOAD) + .map(|s| s.p_paddr as u32) + .min() + else { bail!("ELF file has no LOAD segments"); }; diff --git a/lms-types/src/lib.rs b/lms-types/src/lib.rs index 8bf00f8c37..8260b9b828 100644 --- a/lms-types/src/lib.rs +++ b/lms-types/src/lib.rs @@ -1,6 +1,7 @@ // Licensed under the Apache-2.0 license -#![cfg_attr(all(not(test), not(fuzzing)), no_std)] +// TODO not(fuzzing), attribute not found +#![cfg_attr(not(test), no_std)] use core::mem::size_of; diff --git a/rom/dev/Cargo.toml b/rom/dev/Cargo.toml index 68f35e844b..2949c41ff0 100644 --- a/rom/dev/Cargo.toml +++ b/rom/dev/Cargo.toml @@ -55,6 +55,7 @@ default = ["std"] emu = ["caliptra-drivers/emu"] std = [ "caliptra_common/std", + "caliptra-drivers/std", "caliptra-image-types/std", "caliptra-image-verify/std", "caliptra-x509/std", diff --git a/rom/dev/src/flow/cold_reset/dice.rs b/rom/dev/src/flow/cold_reset/dice.rs index 5edbfa1614..26deffbb7c 100644 --- a/rom/dev/src/flow/cold_reset/dice.rs +++ b/rom/dev/src/flow/cold_reset/dice.rs @@ -32,9 +32,11 @@ pub struct DiceInput<'a> { pub mldsa_auth_key_pair: &'a MlDsaKeyPair, /// MLDSA Authority Serial Number + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_auth_sn: &'a [u8; 64], /// MLDSA Authority Key Identifier + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_auth_key_id: &'a [u8; 20], } diff --git a/rom/dev/src/flow/cold_reset/fw_processor.rs b/rom/dev/src/flow/cold_reset/fw_processor.rs index d7490927dc..89e0274306 100644 --- a/rom/dev/src/flow/cold_reset/fw_processor.rs +++ b/rom/dev/src/flow/cold_reset/fw_processor.rs @@ -74,16 +74,16 @@ impl FirmwareProcessor { // Hmac-512/384 Engine hmac: &mut env.hmac, - /// Cryptographically Secure Random Number Generator + // Cryptographically Secure Random Number Generator trng: &mut env.trng, // LMS Engine lms: &mut env.lms, - /// Ecc384 Engine + // Ecc384 Engine ecc384: &mut env.ecc384, - /// SHA Acc lock state + // SHA Acc lock state sha_acc_lock_state: ShaAccLockState::NotAcquired, }; // Process mailbox commands. @@ -714,7 +714,10 @@ impl FirmwareProcessor { stash_measurement: &StashMeasurementReq, ) -> CaliptraResult<()> { let fht = &mut persistent_data.fht; - let Some(dst) = persistent_data.measurement_log.get_mut(fht.meas_log_index as usize) else { + let Some(dst) = persistent_data + .measurement_log + .get_mut(fht.meas_log_index as usize) + else { return Err(CaliptraError::ROM_GLOBAL_MEASUREMENT_LOG_EXHAUSTED); }; diff --git a/rom/dev/src/flow/cold_reset/mod.rs b/rom/dev/src/flow/cold_reset/mod.rs index 9713fcdac4..2e64a7cf1a 100644 --- a/rom/dev/src/flow/cold_reset/mod.rs +++ b/rom/dev/src/flow/cold_reset/mod.rs @@ -14,7 +14,7 @@ Abstract: mod dice; mod fmc_alias; -mod fw_processor; +pub mod fw_processor; mod idev_id; mod ldev_id; mod x509; @@ -106,7 +106,7 @@ impl ColdResetFlow { #[cfg_attr(not(feature = "no-cfi"), cfi_mod_fn)] #[inline(never)] pub fn copy_tbs(tbs: &[u8], tbs_type: TbsType, env: &mut RomEnv) -> CaliptraResult<()> { - let mut persistent_data = env.persistent_data.get_mut(); + let persistent_data = env.persistent_data.get_mut(); let dst = match tbs_type { TbsType::LdevidTbs => { persistent_data.fht.ldevid_tbs_size = tbs.len() as u16; diff --git a/rom/dev/src/flow/cold_reset/x509.rs b/rom/dev/src/flow/cold_reset/x509.rs index 93ec773b5b..a8be1aaa50 100644 --- a/rom/dev/src/flow/cold_reset/x509.rs +++ b/rom/dev/src/flow/cold_reset/x509.rs @@ -16,7 +16,6 @@ use crate::crypto::{Crypto, PubKey}; use crate::rom_env::RomEnv; use caliptra_drivers::*; use core::mem::size_of; -use core::usize; use zerocopy::AsBytes; /// X509 API diff --git a/rom/dev/src/flow/fake.rs b/rom/dev/src/flow/fake.rs index 55da4c4a01..5ba0e5a302 100644 --- a/rom/dev/src/flow/fake.rs +++ b/rom/dev/src/flow/fake.rs @@ -15,11 +15,8 @@ Abstract: #[cfg(not(feature = "fake-rom"))] compile_error!("This file should NEVER be included except for the fake-rom feature"); -#[allow(dead_code)] -#[path = "cold_reset/fw_processor.rs"] -mod fw_processor; - use crate::fht; +use crate::flow::cold_reset::fw_processor; use crate::flow::update_reset; use crate::flow::warm_reset; use crate::print::HexBytes; @@ -213,7 +210,12 @@ pub fn copy_canned_ldev_cert(env: &mut RomEnv) -> CaliptraResult<()> { // Copy TBS to DCCM let tbs = &FAKE_LDEV_TBS; env.persistent_data.get_mut().fht.ldevid_tbs_size = u16::try_from(tbs.len()).unwrap(); - let Some(dst) = env.persistent_data.get_mut().ldevid_tbs.get_mut(..tbs.len()) else { + let Some(dst) = env + .persistent_data + .get_mut() + .ldevid_tbs + .get_mut(..tbs.len()) + else { return Err(CaliptraError::ROM_GLOBAL_UNSUPPORTED_LDEVID_TBS_SIZE); }; dst.copy_from_slice(tbs); @@ -233,7 +235,12 @@ pub fn copy_canned_fmc_alias_cert(env: &mut RomEnv) -> CaliptraResult<()> { // Copy TBS to DCCM let tbs = &FAKE_FMC_ALIAS_TBS; env.persistent_data.get_mut().fht.fmcalias_tbs_size = u16::try_from(tbs.len()).unwrap(); - let Some(dst) = env.persistent_data.get_mut().fmcalias_tbs.get_mut(..tbs.len()) else { + let Some(dst) = env + .persistent_data + .get_mut() + .fmcalias_tbs + .get_mut(..tbs.len()) + else { return Err(CaliptraError::ROM_GLOBAL_UNSUPPORTED_FMCALIAS_TBS_SIZE); }; dst.copy_from_slice(tbs); @@ -251,7 +258,7 @@ pub(crate) struct FakeRomImageVerificationEnv<'a, 'b> { pub image: &'b [u8], } -impl<'a, 'b> ImageVerificationEnv for &mut FakeRomImageVerificationEnv<'a, 'b> { +impl ImageVerificationEnv for &mut FakeRomImageVerificationEnv<'_, '_> { /// Calculate 384 digest using SHA2 Engine fn sha384_digest(&mut self, offset: u32, len: u32) -> CaliptraResult { let err = CaliptraError::IMAGE_VERIFIER_ERR_DIGEST_OUT_OF_BOUNDS; diff --git a/rom/dev/src/main.rs b/rom/dev/src/main.rs index 9b7ee46e29..c439c956b2 100644 --- a/rom/dev/src/main.rs +++ b/rom/dev/src/main.rs @@ -143,19 +143,19 @@ pub extern "C" fn rom_entry() -> ! { // Hmac-512/384 Engine hmac: &mut env.hmac, - /// Cryptographically Secure Random Number Generator + // Cryptographically Secure Random Number Generator trng: &mut env.trng, // LMS Engine lms: &mut env.lms, - /// Ecc384 Engine + // Ecc384 Engine ecc384: &mut env.ecc384, - /// SHA Acc lock state. - /// SHA Acc is guaranteed to be locked on Cold and Warm Resets; - /// On an Update Reset, it is expected to be unlocked. - /// Not having it unlocked will result in a fatal error. + // SHA Acc lock state. + // SHA Acc is guaranteed to be locked on Cold and Warm Resets; + // On an Update Reset, it is expected to be unlocked. + // Not having it unlocked will result in a fatal error. sha_acc_lock_state: if reset_reason == ResetReason::UpdateReset { ShaAccLockState::NotAcquired } else { diff --git a/rom/dev/src/rom.ld b/rom/dev/src/rom.ld index ddda7b425e..dd02f0179f 100644 --- a/rom/dev/src/rom.ld +++ b/rom/dev/src/rom.ld @@ -20,7 +20,7 @@ ROM_ORG = 0x00000000; ICCM_ORG = 0x40000000; DCCM_ORG = 0x50000000; DATA_ORG = 0x50000000; -STACK_ORG = 0x50035800; +STACK_ORG = 0x50034000; ESTACK_ORG = 0x5003F800; NSTACK_ORG = 0x5003FC00; @@ -29,14 +29,14 @@ CFI_STATE_ORG = 0x500003E4; /* Workaround https://github.com/llvm/llvm-project/issues/62423 * by allowing lld to exceed the ROM size before relaxation optimizations are * applied. To prevent legitimate overflows, caliptra_builder::elf2rom() will - * ensure that the sections fit within the true 48k ROM size. + * ensure that the sections fit within the true 96k ROM size. */ ROM_RELAXATION_PADDING = 8k; ROM_SIZE = 96K; ICCM_SIZE = 128K; DCCM_SIZE = 256K; DATA_SIZE = 996; -STACK_SIZE = 40K; +STACK_SIZE = 46K; ESTACK_SIZE = 1K; NSTACK_SIZE = 1K; diff --git a/rom/dev/src/rom_env.rs b/rom/dev/src/rom_env.rs index 8750ede1a5..1c1feb27c0 100644 --- a/rom/dev/src/rom_env.rs +++ b/rom/dev/src/rom_env.rs @@ -15,7 +15,6 @@ Abstract: --*/ -use crate::fht::FhtDataStore; use caliptra_drivers::{ DeobfuscationEngine, Ecc384, Hmac, KeyVault, Lms, Mailbox, Mldsa87, PcrBank, PersistentDataAccessor, Sha1, Sha256, Sha2_512_384, Sha2_512_384Acc, SocIfc, Trng, @@ -65,9 +64,6 @@ pub struct RomEnv { /// PCR Bank pub pcr_bank: PcrBank, - /// FHT Data Store - pub fht_data_store: FhtDataStore, - /// Cryptographically Secure Random Number Generator pub trng: Trng, @@ -100,7 +96,6 @@ impl RomEnv { soc_ifc: SocIfc::new(SocIfcReg::new()), mbox: Mailbox::new(MboxCsr::new()), pcr_bank: PcrBank::new(PvReg::new()), - fht_data_store: FhtDataStore::default(), trng, persistent_data: PersistentDataAccessor::new(), mldsa87: Mldsa87::new(MldsaReg::new()), diff --git a/rom/dev/test-fw/asm_tests.rs b/rom/dev/test-fw/asm_tests.rs index 3e685c1d86..81280b6e03 100644 --- a/rom/dev/test-fw/asm_tests.rs +++ b/rom/dev/test-fw/asm_tests.rs @@ -45,9 +45,8 @@ extern "C" fn nmi_handler(exception: &exception::ExceptionRecord) { #[inline(never)] #[cfg(not(feature = "std"))] fn handle_panic(pi: &core::panic::PanicInfo) -> ! { - match pi.location() { - Some(loc) => cprintln!("Panic at file {} line {}", loc.file(), loc.line()), - _ => {} + if let Some(loc) = pi.location() { + cprintln!("Panic at file {} line {}", loc.file(), loc.line()) } ExitCtrl::exit(1); } diff --git a/rom/dev/test-fw/pmp_tests.rs b/rom/dev/test-fw/pmp_tests.rs index 0c6a1f6015..e21585909e 100644 --- a/rom/dev/test-fw/pmp_tests.rs +++ b/rom/dev/test-fw/pmp_tests.rs @@ -45,9 +45,8 @@ extern "C" fn nmi_handler(exception: &exception::ExceptionRecord) { #[inline(never)] #[cfg(not(feature = "std"))] fn handle_panic(pi: &core::panic::PanicInfo) -> ! { - match pi.location() { - Some(loc) => cprintln!("Panic at file {} line {}", loc.file(), loc.line()), - _ => {} + if let Some(loc) = pi.location() { + cprintln!("Panic at file {} line {}", loc.file(), loc.line()) } ExitCtrl::exit(1); } diff --git a/rom/dev/tools/test-fmc/src/main.rs b/rom/dev/tools/test-fmc/src/main.rs index d45be970bb..c2d3e9abb4 100644 --- a/rom/dev/tools/test-fmc/src/main.rs +++ b/rom/dev/tools/test-fmc/src/main.rs @@ -368,7 +368,7 @@ fn read_pcrs(mbox: &caliptra_registers::mbox::RegisterBlock) { const PCR_COUNT: usize = 32; for i in 0..PCR_COUNT { let pcr = pcr_bank.read_pcr(PcrId::try_from(i as u8).unwrap()); - let mut pcr_bytes: [u32; 12] = pcr.try_into().unwrap(); + let mut pcr_bytes: [u32; 12] = pcr.into(); swap_word_bytes_inplace(&mut pcr_bytes); send_to_mailbox(mbox, pcr.as_bytes(), false); diff --git a/runtime/src/authorize_and_stash.rs b/runtime/src/authorize_and_stash.rs index 326840e490..f6d4fc1c66 100644 --- a/runtime/src/authorize_and_stash.rs +++ b/runtime/src/authorize_and_stash.rs @@ -12,38 +12,19 @@ Abstract: --*/ -use core::cmp::{self, min}; -use core::mem::size_of; - -use crate::{dpe_crypto::DpeCrypto, CptraDpeTypes, DpePlatform, Drivers, StashMeasurementCmd}; +use crate::{Drivers, StashMeasurementCmd}; use caliptra_auth_man_types::{ - AuthManifestImageMetadata, AuthManifestImageMetadataCollection, AuthManifestPreamble, - ImageMetadataFlags, AUTH_MANIFEST_MARKER, + AuthManifestImageMetadata, AuthManifestImageMetadataCollection, ImageMetadataFlags, }; use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq, cfi_launder}; use caliptra_common::mailbox_api::{ AuthAndStashFlags, AuthorizeAndStashReq, AuthorizeAndStashResp, ImageHashSource, MailboxResp, - MailboxRespHeader, SetAuthManifestReq, -}; -use caliptra_drivers::{ - pcr_log::PCR_ID_STASH_MEASUREMENT, Array4x12, Array4xN, AuthManifestImageMetadataList, - CaliptraError, CaliptraResult, Ecc384, Ecc384PubKey, Ecc384Signature, HashValue, Lms, - PersistentData, RomPqcVerifyConfig, Sha256, Sha2_512_384, SocIfc, -}; -use caliptra_image_types::{ - ImageDigest384, ImageEccPubKey, ImageEccSignature, ImageLmsPublicKey, ImageLmsSignature, - ImagePreamble, SHA192_DIGEST_WORD_SIZE, SHA384_DIGEST_BYTE_SIZE, -}; -use crypto::{AlgLen, Crypto}; -use dpe::{ - commands::{CommandExecution, DeriveContextCmd, DeriveContextFlags}, - context::ContextHandle, - dpe_instance::DpeEnv, - response::DpeErrorCode, + MailboxRespHeader, }; -use memoffset::offset_of; -use zerocopy::{AsBytes, FromBytes}; +use caliptra_drivers::{Array4x12, CaliptraError, CaliptraResult}; +use dpe::response::DpeErrorCode; +use zerocopy::FromBytes; pub const IMAGE_AUTHORIZED: u32 = 0xDEADC0DE; // Either FW ID and image digest matched or 'ignore_auth_check' is set for the FW ID. pub const IMAGE_NOT_AUTHORIZED: u32 = 0x21523F21; // FW ID not found in the image metadata entry collection. diff --git a/runtime/src/certify_key_extended.rs b/runtime/src/certify_key_extended.rs index a426fb5a34..e3c8524283 100644 --- a/runtime/src/certify_key_extended.rs +++ b/runtime/src/certify_key_extended.rs @@ -12,25 +12,18 @@ Abstract: --*/ -use core::str::from_utf8; - -use arrayvec::ArrayVec; -use bitflags::bitflags; use caliptra_common::mailbox_api::{ CertifyKeyExtendedFlags, CertifyKeyExtendedReq, CertifyKeyExtendedResp, MailboxResp, MailboxRespHeader, }; use caliptra_error::{CaliptraError, CaliptraResult}; use dpe::{ - commands::{CertifyKeyCmd, Command, CommandExecution}, + commands::{CertifyKeyCmd, CommandExecution}, response::Response, }; use zerocopy::{AsBytes, FromBytes}; -use crate::{ - CptraDpeTypes, DpeCrypto, DpeEnv, DpePlatform, Drivers, PauserPrivileges, MAX_CERT_CHAIN_SIZE, - PL0_PAUSER_FLAG, -}; +use crate::{CptraDpeTypes, DpeCrypto, DpeEnv, DpePlatform, Drivers, PauserPrivileges}; pub struct CertifyKeyExtendedCmd; impl CertifyKeyExtendedCmd { @@ -84,7 +77,7 @@ impl CertifyKeyExtendedCmd { ), }; - let mut dpe = &mut pdata.dpe; + let dpe = &mut pdata.dpe; let certify_key_cmd = CertifyKeyCmd::read_from(&cmd.certify_key_req[..]) .ok_or(CaliptraError::RUNTIME_DPE_COMMAND_DESERIALIZATION_FAILED)?; let locality = drivers.mbox.id(); diff --git a/runtime/src/dice.rs b/runtime/src/dice.rs index 642ec651ad..7ce91282c5 100644 --- a/runtime/src/dice.rs +++ b/runtime/src/dice.rs @@ -19,10 +19,7 @@ use caliptra_common::mailbox_api::{ use crate::Drivers; -use caliptra_drivers::{ - hand_off::DataStore, CaliptraError, CaliptraResult, DataVault, Ecc384Scalar, Ecc384Signature, - PersistentData, -}; +use caliptra_drivers::{CaliptraError, CaliptraResult, Ecc384Signature, PersistentData}; use caliptra_x509::{Ecdsa384CertBuilder, Ecdsa384Signature}; use zerocopy::AsBytes; @@ -44,7 +41,8 @@ impl IDevIdCertCmd { s: cmd.signature_s, }; - let Some(builder) = Ecdsa384CertBuilder::new(&cmd.tbs[..cmd.tbs_size as usize], &sig) else { + let Some(builder) = Ecdsa384CertBuilder::new(&cmd.tbs[..cmd.tbs_size as usize], &sig) + else { return Err(CaliptraError::RUNTIME_GET_IDEVID_CERT_FAILED); }; diff --git a/runtime/src/disable.rs b/runtime/src/disable.rs index 9d889049aa..6a0ecdf9d9 100644 --- a/runtime/src/disable.rs +++ b/runtime/src/disable.rs @@ -16,8 +16,8 @@ use crate::Drivers; use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_common::mailbox_api::MailboxResp; use caliptra_drivers::{ - hmac_kdf, Array4x12, CaliptraError, CaliptraResult, Ecc384Seed, HmacKey, HmacMode, KeyReadArgs, - KeyUsage, KeyWriteArgs, + hmac_kdf, Array4x12, CaliptraResult, Ecc384Seed, HmacKey, HmacMode, KeyReadArgs, KeyUsage, + KeyWriteArgs, }; use dpe::U8Bool; diff --git a/runtime/src/dpe_crypto.rs b/runtime/src/dpe_crypto.rs index 01d8e32994..ddc072533e 100644 --- a/runtime/src/dpe_crypto.rs +++ b/runtime/src/dpe_crypto.rs @@ -18,9 +18,9 @@ use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq, cfi_launder}; use caliptra_common::keyids::{KEY_ID_DPE_CDI, KEY_ID_DPE_PRIV_KEY, KEY_ID_TMP}; use caliptra_drivers::{ - cprintln, hmac_kdf, Array4x12, Ecc384, Ecc384PrivKeyIn, Ecc384PubKey, Ecc384Scalar, Ecc384Seed, - Hmac, HmacData, HmacKey, HmacMode, HmacTag, KeyId, KeyReadArgs, KeyUsage, KeyVault, - KeyWriteArgs, Sha2DigestOp, Sha2_512_384, Trng, + hmac_kdf, Array4x12, Ecc384, Ecc384PrivKeyIn, Ecc384PubKey, Ecc384Scalar, Ecc384Seed, Hmac, + HmacData, HmacKey, HmacMode, HmacTag, KeyId, KeyReadArgs, KeyUsage, KeyVault, KeyWriteArgs, + Sha2DigestOp, Sha2_512_384, Trng, }; use crypto::{AlgLen, Crypto, CryptoBuf, CryptoError, Digest, EcdsaPub, EcdsaSig, Hasher, HmacSig}; use zerocopy::AsBytes; @@ -80,7 +80,7 @@ impl<'a> DpeHasher<'a> { } } -impl<'a> Hasher for DpeHasher<'a> { +impl Hasher for DpeHasher<'_> { fn update(&mut self, bytes: &[u8]) -> Result<(), CryptoError> { self.op .update(bytes) @@ -96,9 +96,12 @@ impl<'a> Hasher for DpeHasher<'a> { } } -impl<'a> Crypto for DpeCrypto<'a> { +impl Crypto for DpeCrypto<'_> { type Cdi = KeyId; - type Hasher<'b> = DpeHasher<'b> where Self: 'b; + type Hasher<'b> + = DpeHasher<'b> + where + Self: 'b; type PrivKey = KeyId; fn rand_bytes(&mut self, dst: &mut [u8]) -> Result<(), CryptoError> { diff --git a/runtime/src/dpe_platform.rs b/runtime/src/dpe_platform.rs index ab53d6122f..4b6c863340 100644 --- a/runtime/src/dpe_platform.rs +++ b/runtime/src/dpe_platform.rs @@ -16,19 +16,13 @@ use core::cmp::min; use arrayvec::ArrayVec; use caliptra_drivers::cprintln; -use caliptra_image_types::{ImageHeader, ImageManifest}; use caliptra_x509::{NotAfter, NotBefore}; use crypto::Digest; -use dpe::{ - x509::{CertWriter, DirectoryString, Name}, - DPE_PROFILE, -}; +use dpe::x509::{CertWriter, DirectoryString, Name}; use platform::{ CertValidity, OtherName, Platform, PlatformError, SignerIdentifier, SubjectAltName, - MAX_CHUNK_SIZE, MAX_ISSUER_NAME_SIZE, MAX_KEY_IDENTIFIER_SIZE, MAX_OTHER_NAME_SIZE, - MAX_SN_SIZE, + MAX_CHUNK_SIZE, MAX_ISSUER_NAME_SIZE, MAX_KEY_IDENTIFIER_SIZE, }; -use zerocopy::AsBytes; use crate::{subject_alt_name::AddSubjectAltNameCmd, MAX_CERT_CHAIN_SIZE}; diff --git a/runtime/src/drivers.rs b/runtime/src/drivers.rs index 2c018319a6..da5f0e2311 100644 --- a/runtime/src/drivers.rs +++ b/runtime/src/drivers.rs @@ -12,10 +12,10 @@ Abstract: --*/ -#![cfg_attr(not(feature = "fip-self-test"), allow(unused))] +#![cfg_attr(not(feature = "fips_self_test"), allow(unused))] #[cfg(feature = "fips_self_test")] -pub use crate::fips::{fips_self_test_cmd, fips_self_test_cmd::SelfTestStatus}; +pub use crate::fips::fips_self_test_cmd::SelfTestStatus; use crate::{ dice, CptraDpeTypes, DisableAttestationCmd, DpeCrypto, DpePlatform, Mailbox, DPE_SUPPORT, @@ -24,32 +24,19 @@ use crate::{ }; use arrayvec::ArrayVec; -use caliptra_cfi_derive_git::{cfi_impl_fn, cfi_mod_fn}; +use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq, cfi_assert_eq_12_words, cfi_launder}; use caliptra_common::mailbox_api::AddSubjectAltNameReq; use caliptra_drivers::{ - cprint, cprintln, hand_off::DataStore, pcr_log::RT_FW_JOURNEY_PCR, Array4x12, CaliptraError, - CaliptraResult, DataVault, Ecc384, Ecc384PubKey, Hmac, KeyId, KeyVault, Lms, Mldsa87, PcrBank, - PcrId, PersistentDataAccessor, Pic, ResetReason, Sha1, Sha256, Sha256Alg, Sha2_512_384, - Sha2_512_384Acc, SocIfc, Trng, + cprintln, hand_off::DataStore, pcr_log::RT_FW_JOURNEY_PCR, Array4x12, CaliptraError, + CaliptraResult, Ecc384, Hmac, KeyId, KeyVault, Lms, Mldsa87, PcrBank, PersistentDataAccessor, + Pic, ResetReason, Sha1, Sha256, Sha256Alg, Sha2_512_384, Sha2_512_384Acc, SocIfc, Trng, }; use caliptra_image_types::ImageManifest; use caliptra_registers::{ - csrng::CsrngReg, - dv::DvReg, - ecc::EccReg, - el2_pic_ctrl::El2PicCtrl, - entropy_src::EntropySrcReg, - hmac::HmacReg, - kv::KvReg, - mbox::{enums::MboxStatusE, MboxCsr}, - mldsa::MldsaReg, - pv::PvReg, - sha256::Sha256Reg, - sha512::Sha512Reg, - sha512_acc::Sha512AccCsr, - soc_ifc::SocIfcReg, - soc_ifc_trng::SocIfcTrngReg, + csrng::CsrngReg, ecc::EccReg, el2_pic_ctrl::El2PicCtrl, entropy_src::EntropySrcReg, + hmac::HmacReg, kv::KvReg, mbox::MboxCsr, mldsa::MldsaReg, pv::PvReg, sha256::Sha256Reg, + sha512::Sha512Reg, sha512_acc::Sha512AccCsr, soc_ifc::SocIfcReg, soc_ifc_trng::SocIfcTrngReg, }; use caliptra_x509::{NotAfter, NotBefore}; use dpe::context::{Context, ContextState, ContextType}; @@ -59,13 +46,12 @@ use dpe::MAX_HANDLES; use dpe::{ commands::{CommandExecution, DeriveContextCmd, DeriveContextFlags}, context::ContextHandle, - dpe_instance::{DpeEnv, DpeInstance, DpeTypes}, - support::Support, + dpe_instance::{DpeEnv, DpeInstance}, DPE_PROFILE, }; use core::cmp::Ordering::{Equal, Greater}; -use crypto::{AlgLen, Crypto, CryptoBuf, Hasher}; +use crypto::CryptoBuf; use zerocopy::AsBytes; #[derive(PartialEq, Clone)] @@ -210,7 +196,7 @@ impl Drivers { .contexts .iter() .enumerate() - .find(|&(idx, context)| { + .find(|&(_idx, context)| { context.state != ContextState::Inactive && context.parent_idx == Context::ROOT_INDEX && context.context_type == ContextType::Normal @@ -224,13 +210,13 @@ impl Drivers { } /// Validate DPE and disable attestation if validation fails - fn validate_dpe_structure(mut drivers: &mut Drivers) -> CaliptraResult<()> { + fn validate_dpe_structure(drivers: &mut Drivers) -> CaliptraResult<()> { let dpe = &mut drivers.persistent_data.get_mut().dpe; let dpe_validator = DpeValidator { dpe }; let validation_result = dpe_validator.validate_dpe(); if let Err(e) = validation_result { // If SRAM Dpe Instance validation fails, disable attestation - let mut result = DisableAttestationCmd::execute(drivers); + let result = DisableAttestationCmd::execute(drivers); if cfi_launder(result.is_ok()) { cfi_assert!(result.is_ok()); } else { @@ -251,7 +237,6 @@ impl Drivers { } } } else { - let pl0_pauser = drivers.persistent_data.get().manifest1.header.pl0_pauser; // check that DPE used context limits are not exceeded let dpe_context_threshold_exceeded = drivers.is_dpe_context_threshold_exceeded(); if cfi_launder(dpe_context_threshold_exceeded.is_ok()) { @@ -297,7 +282,7 @@ impl Drivers { } /// Check that RT_FW_JOURNEY_PCR == DPE Root Context's TCI measurement - fn check_dpe_rt_journey_unchanged(mut drivers: &mut Drivers) -> CaliptraResult<()> { + fn check_dpe_rt_journey_unchanged(drivers: &mut Drivers) -> CaliptraResult<()> { let dpe = &drivers.persistent_data.get().dpe; let root_idx = Self::get_dpe_root_context_idx(dpe)?; let latest_tci = Array4x12::from(&dpe.contexts[root_idx].tci.tci_current.0); @@ -335,13 +320,13 @@ impl Drivers { } /// Check that inactive DPE contexts do not have context tags set - fn validate_context_tags(mut drivers: &mut Drivers) -> CaliptraResult<()> { + fn validate_context_tags(drivers: &mut Drivers) -> CaliptraResult<()> { let pdata = drivers.persistent_data.get(); let context_has_tag = &pdata.context_has_tag; let context_tags = &pdata.context_tags; let dpe = &pdata.dpe; - for i in (0..MAX_HANDLES) { + for i in 0..MAX_HANDLES { if dpe.contexts[i].state == ContextState::Inactive { if context_tags[i] != 0 { return Err(CaliptraError::RUNTIME_CONTEXT_TAGS_VALIDATION_FAILED); @@ -389,7 +374,7 @@ impl Drivers { let key_id_rt_cdi = Drivers::get_key_id_rt_cdi(drivers)?; let key_id_rt_priv_key = Drivers::get_key_id_rt_priv_key(drivers)?; let pdata = drivers.persistent_data.get_mut(); - let mut crypto = DpeCrypto::new( + let crypto = DpeCrypto::new( &mut drivers.sha2_512_384, &mut drivers.trng, &mut drivers.ecc384, @@ -594,7 +579,7 @@ impl Drivers { let locality = self.mbox.id(); // When the PL0_PAUSER_FLAG bit is not set there can be no PL0 PAUSER. - if (flags & PL0_PAUSER_FLAG == 0) { + if flags & PL0_PAUSER_FLAG == 0 { return PauserPrivileges::PL1; } diff --git a/runtime/src/fips.rs b/runtime/src/fips.rs index 796ee40201..c0be5e7f21 100644 --- a/runtime/src/fips.rs +++ b/runtime/src/fips.rs @@ -13,7 +13,7 @@ Abstract: --*/ use caliptra_cfi_derive_git::{cfi_impl_fn, cfi_mod_fn}; use caliptra_common::cprintln; -use caliptra_common::mailbox_api::{MailboxResp, MailboxRespHeader}; +use caliptra_common::mailbox_api::MailboxResp; use caliptra_drivers::CaliptraError; use caliptra_drivers::CaliptraResult; use caliptra_drivers::Ecc384; @@ -22,7 +22,6 @@ use caliptra_drivers::KeyVault; use caliptra_drivers::Sha256; use caliptra_drivers::Sha2_512_384; use caliptra_drivers::Sha2_512_384Acc; -use caliptra_registers::mbox::enums::MboxStatusE; use zeroize::Zeroize; use crate::Drivers; @@ -91,7 +90,7 @@ pub mod fips_self_test_cmd { env.persistent_data.get().manifest1.size + env.persistent_data.get().manifest1.fmc.size + env.persistent_data.get().manifest1.runtime.size, - ); + )?; env.mbox .copy_bytes_to_mbox(env.persistent_data.get().manifest1.as_bytes())?; @@ -105,8 +104,8 @@ pub mod fips_self_test_cmd { return Err(CaliptraError::RUNTIME_INVALID_RUNTIME_SIZE); } - let fmc = unsafe { create_slice(&fmc_toc) }; - let rt = unsafe { create_slice(&rt_toc) }; + let fmc = unsafe { create_slice(fmc_toc) }; + let rt = unsafe { create_slice(rt_toc) }; env.mbox.copy_bytes_to_mbox(fmc.as_bytes())?; env.mbox.copy_bytes_to_mbox(rt.as_bytes())?; @@ -163,16 +162,16 @@ pub mod fips_self_test_cmd { // Hmac-512/384 Engine hmac: &mut env.hmac, - /// Cryptographically Secure Random Number Generator + // Cryptographically Secure Random Number Generator trng: &mut env.trng, // LMS Engine lms: &mut env.lms, - /// Ecc384 Engine + // Ecc384 Engine ecc384: &mut env.ecc384, - /// SHA Acc Lock State + // SHA Acc Lock State sha_acc_lock_state: ShaAccLockState::NotAcquired, }; diff --git a/runtime/src/get_idev_csr.rs b/runtime/src/get_idev_csr.rs index 5ec4b2ef60..f8b85387cd 100644 --- a/runtime/src/get_idev_csr.rs +++ b/runtime/src/get_idev_csr.rs @@ -3,54 +3,47 @@ use crate::Drivers; use caliptra_cfi_derive_git::cfi_impl_fn; -use caliptra_cfi_lib_git::cfi_launder; -use caliptra_common::{ - cprintln, - mailbox_api::{GetIdevCsrReq, GetIdevCsrResp, MailboxResp, MailboxRespHeader}, -}; +use caliptra_common::mailbox_api::{GetIdevCsrReq, GetIdevCsrResp, MailboxResp}; use caliptra_error::{CaliptraError, CaliptraResult}; use caliptra_drivers::IdevIdCsr; -use zerocopy::{AsBytes, FromBytes}; +use zerocopy::FromBytes; pub struct GetIdevCsrCmd; impl GetIdevCsrCmd { #[cfg_attr(not(feature = "no-cfi"), cfi_impl_fn)] #[inline(never)] pub(crate) fn execute(drivers: &mut Drivers, cmd_args: &[u8]) -> CaliptraResult { - if let Some(cmd) = GetIdevCsrReq::read_from(cmd_args) { - let csr_persistent_mem = &drivers.persistent_data.get().idevid_csr; - - match csr_persistent_mem.get_csr_len() { - IdevIdCsr::UNPROVISIONED_CSR => { - Err(CaliptraError::RUNTIME_GET_IDEV_ID_UNPROVISIONED) - } - 0 => Err(CaliptraError::RUNTIME_GET_IDEV_ID_UNSUPPORTED_ROM), - len => { - let csr = csr_persistent_mem - .get() - .ok_or(CaliptraError::RUNTIME_GET_IDEV_ID_UNPROVISIONED)?; - - let mut resp = GetIdevCsrResp { - data_size: len, - ..Default::default() - }; - // NOTE: This code will not panic. - // - // csr is guranteed to be the same size as `len`, and therefore - // `resp.data_size` by the `IDevIDCsr::get` API. - // - // A valid `IDevIDCsr` cannot be larger than `MAX_CSR_SIZE`, which is the max - // size of the buffer in `GetIdevCsrResp` - resp.data[..resp.data_size as usize].copy_from_slice(csr); - - Ok(MailboxResp::GetIdevCsr(resp)) - } + if GetIdevCsrReq::read_from(cmd_args).is_none() { + return Err(CaliptraError::RUNTIME_INSUFFICIENT_MEMORY); + } + + let csr_persistent_mem = &drivers.persistent_data.get().idevid_csr; + match csr_persistent_mem.get_csr_len() { + IdevIdCsr::UNPROVISIONED_CSR => Err(CaliptraError::RUNTIME_GET_IDEV_ID_UNPROVISIONED), + 0 => Err(CaliptraError::RUNTIME_GET_IDEV_ID_UNSUPPORTED_ROM), + len => { + let csr = csr_persistent_mem + .get() + .ok_or(CaliptraError::RUNTIME_GET_IDEV_ID_UNPROVISIONED)?; + + let mut resp = GetIdevCsrResp { + data_size: len, + ..Default::default() + }; + // NOTE: This code will not panic. + // + // csr is guranteed to be the same size as `len`, and therefore + // `resp.data_size` by the `IDevIDCsr::get` API. + // + // A valid `IDevIDCsr` cannot be larger than `MAX_CSR_SIZE`, which is the max + // size of the buffer in `GetIdevCsrResp` + resp.data[..resp.data_size as usize].copy_from_slice(csr); + + Ok(MailboxResp::GetIdevCsr(resp)) } - } else { - Err(CaliptraError::RUNTIME_INSUFFICIENT_MEMORY) } } } diff --git a/runtime/src/hmac.rs b/runtime/src/hmac.rs index 88e01b9257..7f671a813d 100644 --- a/runtime/src/hmac.rs +++ b/runtime/src/hmac.rs @@ -16,8 +16,8 @@ use caliptra_cfi_derive_git::{cfi_impl_fn, cfi_mod_fn}; use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq, cfi_launder}; use caliptra_common::{crypto::Ecc384KeyPair, keyids::KEY_ID_TMP}; use caliptra_drivers::{ - hmac_kdf, Array4x12, Ecc384PrivKeyOut, Ecc384PubKey, HmacData, HmacKey, HmacMode, HmacTag, - KeyId, KeyReadArgs, KeyUsage, KeyWriteArgs, + hmac_kdf, Array4x12, HmacData, HmacKey, HmacMode, HmacTag, KeyId, KeyReadArgs, KeyUsage, + KeyWriteArgs, }; use caliptra_error::CaliptraResult; use zerocopy::AsBytes; diff --git a/runtime/src/info.rs b/runtime/src/info.rs index 029447a6ec..54b935a617 100644 --- a/runtime/src/info.rs +++ b/runtime/src/info.rs @@ -15,7 +15,6 @@ Abstract: use crate::{handoff::RtHandoff, Drivers}; use caliptra_common::mailbox_api::{FwInfoResp, GetIdevInfoResp, MailboxResp, MailboxRespHeader}; use caliptra_drivers::CaliptraResult; -use caliptra_image_types::RomInfo; pub struct FwInfoCmd; impl FwInfoCmd { diff --git a/runtime/src/invoke_dpe.rs b/runtime/src/invoke_dpe.rs index 63c615bbdc..a1c7167605 100644 --- a/runtime/src/invoke_dpe.rs +++ b/runtime/src/invoke_dpe.rs @@ -12,22 +12,17 @@ Abstract: --*/ -use crate::{ - CptraDpeTypes, DpeCrypto, DpeEnv, DpePlatform, Drivers, PauserPrivileges, PL0_PAUSER_FLAG, -}; +use crate::{CptraDpeTypes, DpeCrypto, DpeEnv, DpePlatform, Drivers, PauserPrivileges}; use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_common::mailbox_api::{InvokeDpeReq, InvokeDpeResp, MailboxResp, MailboxRespHeader}; use caliptra_drivers::{CaliptraError, CaliptraResult}; -use crypto::{AlgLen, Crypto}; use dpe::{ - commands::{ - CertifyKeyCmd, Command, CommandExecution, DeriveContextCmd, DeriveContextFlags, InitCtxCmd, - }, - context::{Context, ContextState}, + commands::{CertifyKeyCmd, Command, CommandExecution, DeriveContextCmd, InitCtxCmd}, + context::ContextState, response::{Response, ResponseHdr}, DpeInstance, U8Bool, MAX_HANDLES, }; -use zerocopy::{AsBytes, FromBytes}; +use zerocopy::AsBytes; pub struct InvokeDpeCmd; impl InvokeDpeCmd { @@ -78,11 +73,10 @@ impl InvokeDpeCmd { let locality = drivers.mbox.id(); let command = Command::deserialize(&cmd.data[..cmd.data_size as usize]) .map_err(|_| CaliptraError::RUNTIME_DPE_COMMAND_DESERIALIZATION_FAILED)?; - let flags = pdata.manifest1.header.flags; - let mut dpe = &mut pdata.dpe; - let mut context_has_tag = &mut pdata.context_has_tag; - let mut context_tags = &mut pdata.context_tags; + let dpe = &mut pdata.dpe; + let context_has_tag = &mut pdata.context_has_tag; + let context_tags = &mut pdata.context_tags; let resp = match command { Command::GetProfile => Ok(Response::GetProfile( dpe.get_profile(&mut env.platform) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index c8057bff47..636e38017e 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -11,7 +11,7 @@ Abstract: File contains exports for the Runtime library and mailbox command handling logic. --*/ -#![cfg_attr(not(feature = "fip-self-test"), allow(unused))] +#![cfg_attr(not(feature = "fips_self_test"), allow(unused))] #![no_std] mod authorize_and_stash; mod capabilities; @@ -39,7 +39,6 @@ mod verify; pub mod mailbox; use authorize_and_stash::AuthorizeAndStashCmd; use caliptra_cfi_lib_git::{cfi_assert, cfi_assert_eq, cfi_assert_ne, cfi_launder, CfiCounter}; -use caliptra_registers::soc_ifc::SocIfcReg; pub use drivers::{Drivers, PauserPrivileges}; use mailbox::Mailbox; @@ -74,15 +73,12 @@ use tagging::{GetTaggedTciCmd, TagTciCmd}; use caliptra_common::cprintln; use caliptra_drivers::{CaliptraError, CaliptraResult, ResetReason}; -use caliptra_registers::el2_pic_ctrl::El2PicCtrl; -use caliptra_registers::{mbox::enums::MboxStatusE, soc_ifc}; +use caliptra_registers::mbox::enums::MboxStatusE; +pub use dpe::{context::ContextState, tci::TciMeasurement, DpeInstance, U8Bool, MAX_HANDLES}; use dpe::{ - commands::{CommandExecution, DeriveContextCmd, DeriveContextFlags}, dpe_instance::{DpeEnv, DpeTypes}, support::Support, - DPE_PROFILE, }; -pub use dpe::{context::ContextState, tci::TciMeasurement, DpeInstance, U8Bool, MAX_HANDLES}; use crate::{ dice::GetRtAliasCertCmd, @@ -130,7 +126,7 @@ fn enter_idle(drivers: &mut Drivers) { #[cfg(feature = "fips_self_test")] if let SelfTestStatus::InProgress(execute) = drivers.self_test_status { let lock = drivers.mbox.lock(); - if lock == false { + if !lock { let result = execute(drivers); drivers.mbox.unlock(); match result { @@ -263,7 +259,7 @@ pub fn handle_mailbox_commands(drivers: &mut Drivers) -> CaliptraResult<()> { let reset_reason = drivers.soc_ifc.reset_reason(); if reset_reason == ResetReason::WarmReset { cfi_assert_eq(drivers.soc_ifc.reset_reason(), ResetReason::WarmReset); - let mut result = DisableAttestationCmd::execute(drivers); + let result = DisableAttestationCmd::execute(drivers); if cfi_launder(result.is_ok()) { cfi_assert!(result.is_ok()); } else { @@ -342,5 +338,4 @@ pub fn handle_mailbox_commands(drivers: &mut Drivers) -> CaliptraResult<()> { cfi_assert!(!cmd_ready); } } - Ok(()) } diff --git a/runtime/src/mailbox.rs b/runtime/src/mailbox.rs index 362069e9d7..395488c16e 100644 --- a/runtime/src/mailbox.rs +++ b/runtime/src/mailbox.rs @@ -147,7 +147,7 @@ impl Mailbox { /// Write a word-aligned `buf` to the mailbox pub fn write_response(&mut self, buf: &[u8]) -> CaliptraResult<()> { self.set_dlen(buf.len() as u32)?; - self.copy_bytes_to_mbox(buf); + self.copy_bytes_to_mbox(buf)?; Ok(()) } diff --git a/runtime/src/pcr.rs b/runtime/src/pcr.rs index 4da78e0a49..30cedbdbf1 100644 --- a/runtime/src/pcr.rs +++ b/runtime/src/pcr.rs @@ -18,7 +18,7 @@ use caliptra_common::mailbox_api::{ ExtendPcrReq, IncrementPcrResetCounterReq, MailboxResp, MailboxRespHeader, QuotePcrsReq, QuotePcrsResp, }; -use caliptra_drivers::{hand_off::DataStore, CaliptraError, CaliptraResult, PcrBank, PcrId}; +use caliptra_drivers::{CaliptraError, CaliptraResult, PcrId}; use zerocopy::FromBytes; pub struct IncrementPcrResetCounterCmd; diff --git a/runtime/src/set_auth_manifest.rs b/runtime/src/set_auth_manifest.rs index 770e9093a6..723144a28c 100644 --- a/runtime/src/set_auth_manifest.rs +++ b/runtime/src/set_auth_manifest.rs @@ -15,33 +15,22 @@ Abstract: use core::cmp::min; use core::mem::size_of; -use crate::verify; -use crate::{dpe_crypto::DpeCrypto, CptraDpeTypes, DpePlatform, Drivers}; +use crate::Drivers; use caliptra_auth_man_types::{ AuthManifestFlags, AuthManifestImageMetadata, AuthManifestImageMetadataCollection, AuthManifestPreamble, AUTH_MANIFEST_IMAGE_METADATA_MAX_COUNT, AUTH_MANIFEST_MARKER, }; use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_cfi_lib_git::cfi_launder; -use caliptra_common::mailbox_api::{ - MailboxResp, MailboxRespHeader, SetAuthManifestReq, StashMeasurementReq, StashMeasurementResp, -}; +use caliptra_common::mailbox_api::{MailboxResp, SetAuthManifestReq}; use caliptra_drivers::{ - pcr_log::PCR_ID_STASH_MEASUREMENT, Array4x12, Array4xN, AuthManifestImageMetadataList, - CaliptraError, CaliptraResult, Ecc384, Ecc384PubKey, Ecc384Signature, HashValue, Lms, - PersistentData, RomPqcVerifyConfig, Sha256, Sha2_512_384, SocIfc, + Array4x12, Array4xN, CaliptraError, CaliptraResult, Ecc384, Ecc384PubKey, Ecc384Signature, + HashValue, Lms, Sha256, Sha2_512_384, }; use caliptra_image_types::{ ImageDigest384, ImageEccPubKey, ImageEccSignature, ImageLmsPublicKey, ImageLmsSignature, ImagePreamble, SHA192_DIGEST_WORD_SIZE, SHA384_DIGEST_BYTE_SIZE, }; -use crypto::{AlgLen, Crypto}; -use dpe::{ - commands::{CommandExecution, DeriveContextCmd, DeriveContextFlags}, - context::ContextHandle, - dpe_instance::DpeEnv, - response::DpeErrorCode, -}; use memoffset::offset_of; use zerocopy::{AsBytes, FromBytes}; use zeroize::Zeroize; @@ -103,7 +92,6 @@ impl SetAuthManifestCmd { sha2: &mut Sha2_512_384, ecc384: &mut Ecc384, sha256: &mut Sha256, - soc_ifc: &SocIfc, ) -> CaliptraResult<()> { let range = AuthManifestPreamble::vendor_signed_data_range(); let digest_vendor = Self::sha384_digest( @@ -162,7 +150,6 @@ impl SetAuthManifestCmd { sha2: &mut Sha2_512_384, ecc384: &mut Ecc384, sha256: &mut Sha256, - soc_ifc: &SocIfc, ) -> CaliptraResult<()> { let range = AuthManifestPreamble::owner_pub_keys_range(); let digest_owner = Self::sha384_digest( @@ -219,10 +206,8 @@ impl SetAuthManifestCmd { fn verify_vendor_image_metadata_col( auth_manifest_preamble: &AuthManifestPreamble, image_metadata_col_digest: &ImageDigest384, - sha2: &mut Sha2_512_384, ecc384: &mut Ecc384, sha256: &mut Sha256, - soc_ifc: &SocIfc, ) -> CaliptraResult<()> { let flags = AuthManifestFlags::from(auth_manifest_preamble.flags); if !flags.contains(AuthManifestFlags::VENDOR_SIGNATURE_REQUIRED) { @@ -280,10 +265,8 @@ impl SetAuthManifestCmd { fn verify_owner_image_metadata_col( auth_manifest_preamble: &AuthManifestPreamble, image_metadata_col_digest: &ImageDigest384, - sha2: &mut Sha2_512_384, ecc384: &mut Ecc384, sha256: &mut Sha256, - soc_ifc: &SocIfc, ) -> CaliptraResult<()> { // Verify the owner ECC signature. let verify_r = Self::ecc384_verify( @@ -342,7 +325,6 @@ impl SetAuthManifestCmd { sha2: &mut Sha2_512_384, ecc384: &mut Ecc384, sha256: &mut Sha256, - soc_ifc: &SocIfc, ) -> CaliptraResult<()> { if cmd_buf.len() < size_of::() { Err(CaliptraError::RUNTIME_AUTH_MANIFEST_IMAGE_METADATA_LIST_INVALID_SIZE)?; @@ -382,19 +364,15 @@ impl SetAuthManifestCmd { Self::verify_vendor_image_metadata_col( auth_manifest_preamble, &digest_metadata_col, - sha2, ecc384, sha256, - soc_ifc, )?; Self::verify_owner_image_metadata_col( auth_manifest_preamble, &digest_metadata_col, - sha2, ecc384, sha256, - soc_ifc, )?; // Sort the image metadata list by firmware ID in place. Also check for duplicate firmware IDs. let slice = @@ -493,7 +471,6 @@ impl SetAuthManifestCmd { &mut drivers.sha2_512_384, &mut drivers.ecc384, &mut drivers.sha256, - &drivers.soc_ifc, )?; // Verify the owner public keys. @@ -503,7 +480,6 @@ impl SetAuthManifestCmd { &mut drivers.sha2_512_384, &mut drivers.ecc384, &mut drivers.sha256, - &drivers.soc_ifc, )?; Self::process_image_metadata_col( @@ -515,14 +491,13 @@ impl SetAuthManifestCmd { &mut drivers.sha2_512_384, &mut drivers.ecc384, &mut drivers.sha256, - &drivers.soc_ifc, )?; Ok(MailboxResp::default()) } } -#[cfg(all(test))] +#[cfg(test)] mod tests { use super::*; diff --git a/runtime/src/stash_measurement.rs b/runtime/src/stash_measurement.rs index 8d7b279f8c..c3a01140f2 100644 --- a/runtime/src/stash_measurement.rs +++ b/runtime/src/stash_measurement.rs @@ -18,7 +18,6 @@ use caliptra_common::mailbox_api::{ MailboxResp, MailboxRespHeader, StashMeasurementReq, StashMeasurementResp, }; use caliptra_drivers::{pcr_log::PCR_ID_STASH_MEASUREMENT, CaliptraError, CaliptraResult}; -use crypto::{AlgLen, Crypto}; use dpe::{ commands::{CommandExecution, DeriveContextCmd, DeriveContextFlags}, context::ContextHandle, @@ -53,7 +52,7 @@ impl StashMeasurementCmd { let key_id_rt_cdi = Drivers::get_key_id_rt_cdi(drivers)?; let key_id_rt_priv_key = Drivers::get_key_id_rt_priv_key(drivers)?; let pdata = drivers.persistent_data.get_mut(); - let mut crypto = DpeCrypto::new( + let crypto = DpeCrypto::new( &mut drivers.sha2_512_384, &mut drivers.trng, &mut drivers.ecc384, diff --git a/runtime/src/subject_alt_name.rs b/runtime/src/subject_alt_name.rs index 68166d09f8..264a2cf552 100644 --- a/runtime/src/subject_alt_name.rs +++ b/runtime/src/subject_alt_name.rs @@ -19,7 +19,7 @@ use caliptra_common::mailbox_api::{AddSubjectAltNameReq, MailboxResp}; use caliptra_error::{CaliptraError, CaliptraResult}; use zerocopy::AsBytes; -use crate::{Drivers, MAX_CERT_CHAIN_SIZE, PL0_PAUSER_FLAG}; +use crate::Drivers; pub struct AddSubjectAltNameCmd; impl AddSubjectAltNameCmd { diff --git a/runtime/src/tagging.rs b/runtime/src/tagging.rs index 63539a0b8c..099a3a5dd1 100644 --- a/runtime/src/tagging.rs +++ b/runtime/src/tagging.rs @@ -12,21 +12,15 @@ Abstract: --*/ -use crate::CfiCounter; use caliptra_cfi_derive_git::cfi_impl_fn; use caliptra_common::mailbox_api::{ GetTaggedTciReq, GetTaggedTciResp, MailboxResp, MailboxRespHeader, TagTciReq, }; -use caliptra_drivers::cprintln; use caliptra_error::{CaliptraError, CaliptraResult}; -use dpe::{ - context::{ContextHandle, ContextState}, - dpe_instance::DpeEnv, - U8Bool, MAX_HANDLES, -}; +use dpe::{context::ContextHandle, U8Bool, MAX_HANDLES}; use zerocopy::FromBytes; -use crate::{dpe_crypto::DpeCrypto, CptraDpeTypes, DpePlatform, Drivers}; +use crate::Drivers; pub struct TagTciCmd; impl TagTciCmd { @@ -36,9 +30,9 @@ impl TagTciCmd { let cmd = TagTciReq::read_from(cmd_args).ok_or(CaliptraError::RUNTIME_INSUFFICIENT_MEMORY)?; let pdata_mut = drivers.persistent_data.get_mut(); - let mut dpe = &mut pdata_mut.dpe; - let mut context_has_tag = &mut pdata_mut.context_has_tag; - let mut context_tags = &mut pdata_mut.context_tags; + let dpe = &mut pdata_mut.dpe; + let context_has_tag = &mut pdata_mut.context_has_tag; + let context_tags = &mut pdata_mut.context_tags; // Make sure the tag isn't used by any other contexts. if (0..MAX_HANDLES).any(|i| { diff --git a/runtime/src/verify.rs b/runtime/src/verify.rs index 3ac5350f26..a9fc413fde 100644 --- a/runtime/src/verify.rs +++ b/runtime/src/verify.rs @@ -22,7 +22,6 @@ use caliptra_drivers::{ use caliptra_lms_types::{ LmotsAlgorithmType, LmotsSignature, LmsAlgorithmType, LmsPublicKey, LmsSignature, }; -use zerocopy::AsBytes; use zerocopy::{BigEndian, FromBytes, LittleEndian, U32}; pub struct EcdsaVerifyCmd; diff --git a/runtime/test-fw/Cargo.toml b/runtime/test-fw/Cargo.toml index 75acc16088..4f30cf66c3 100644 --- a/runtime/test-fw/Cargo.toml +++ b/runtime/test-fw/Cargo.toml @@ -17,6 +17,10 @@ emu = [ "caliptra-runtime/emu", "caliptra-test-harness/emu", ] +std = [ + "caliptra-drivers/std", + "caliptra-runtime/std", +] fpga_realtime = ["caliptra-runtime/fpga_realtime"] [[bin]] diff --git a/runtime/test-fw/src/boot_tests.rs b/runtime/test-fw/src/boot_tests.rs index 2b7d9cab2d..218e640b91 100644 --- a/runtime/test-fw/src/boot_tests.rs +++ b/runtime/test-fw/src/boot_tests.rs @@ -18,9 +18,7 @@ Abstract: use caliptra_registers::soc_ifc::SocIfcReg; use caliptra_test_harness::{runtime_handlers, test_suite}; -fn test_boot() { - assert!(true); -} +fn test_boot() {} test_suite! { test_boot, diff --git a/runtime/test-fw/src/mbox_responder.rs b/runtime/test-fw/src/mbox_responder.rs index 09b08fa391..e79673bf73 100644 --- a/runtime/test-fw/src/mbox_responder.rs +++ b/runtime/test-fw/src/mbox_responder.rs @@ -54,7 +54,7 @@ const BANNER: &str = r#" #[no_mangle] #[allow(clippy::empty_loop)] -fn rt_entry() -> () { +fn rt_entry() { cprintln!("{}", BANNER); let mut drivers = unsafe { Drivers::new_from_registers().unwrap_or_else(|e| { @@ -75,7 +75,6 @@ fn rt_entry() -> () { if let Err(e) = handle_mailbox_commands(&mut drivers) { handle_fatal_error(e.into()); } - return; } pub fn handle_mailbox_commands(drivers: &mut Drivers) -> CaliptraResult<()> { diff --git a/runtime/test-fw/src/mock_rt_test_interactive.rs b/runtime/test-fw/src/mock_rt_test_interactive.rs index ead4f66871..8882827cb6 100644 --- a/runtime/test-fw/src/mock_rt_test_interactive.rs +++ b/runtime/test-fw/src/mock_rt_test_interactive.rs @@ -25,7 +25,7 @@ pub const TEST_CMD_PCRS_LOCKED: u32 = 0x1000_0004; #[no_mangle] #[allow(clippy::empty_loop)] -fn rt_entry() -> () { +fn rt_entry() { cprintln!("{}", BANNER); let mut drivers = unsafe { Drivers::new_from_registers().unwrap_or_else(|e| { @@ -46,7 +46,6 @@ fn rt_entry() -> () { if let Err(e) = handle_mailbox_commands(&mut drivers) { handle_fatal_error(e.into()); } - return; } pub fn handle_mailbox_commands(drivers: &mut Drivers) -> CaliptraResult<()> { @@ -132,7 +131,7 @@ fn read_pcrs(mbox: &mut Mailbox) { const PCR_COUNT: usize = 32; for i in 0..PCR_COUNT { let pcr = pcr_bank.read_pcr(PcrId::try_from(i as u8).unwrap()); - let mut pcr_bytes: [u32; 12] = pcr.try_into().unwrap(); + let mut pcr_bytes: [u32; 12] = pcr.into(); swap_word_bytes_inplace(&mut pcr_bytes); mbox.copy_bytes_to_mbox(pcr.as_bytes()).unwrap(); @@ -153,10 +152,11 @@ fn try_to_reset_pcrs(mbox: &mut Mailbox) { let res0 = pcr_bank.erase_pcr(caliptra_common::RT_FW_CURRENT_PCR); let res1 = pcr_bank.erase_pcr(caliptra_common::RT_FW_JOURNEY_PCR); + // Resetting the PCRs should fail if locked if res0.is_err() && res1.is_err() { mbox.set_status(MboxStatusE::CmdComplete); } else { - mbox.set_status(MboxStatusE::CmdComplete); + mbox.set_status(MboxStatusE::CmdFailure); } } diff --git a/runtime/tests/runtime_integration_tests/test_certify_key_extended.rs b/runtime/tests/runtime_integration_tests/test_certify_key_extended.rs index 400b352486..b1de636034 100644 --- a/runtime/tests/runtime_integration_tests/test_certify_key_extended.rs +++ b/runtime/tests/runtime_integration_tests/test_certify_key_extended.rs @@ -110,7 +110,7 @@ fn test_dmtf_other_name_extension_present() { assert!(!ext.critical); let san = ext.value; assert_eq!(san.general_names.len(), 1); - let general_name = san.general_names.get(0).unwrap(); + let general_name = san.general_names.first().unwrap(); match general_name { GeneralName::OtherName(oid, other_name_value) => { assert_eq!(oid.as_bytes(), AddSubjectAltNameCmd::DMTF_OID); diff --git a/runtime/tests/runtime_integration_tests/test_pcr.rs b/runtime/tests/runtime_integration_tests/test_pcr.rs index 10a5a8bc1b..09f16cd401 100644 --- a/runtime/tests/runtime_integration_tests/test_pcr.rs +++ b/runtime/tests/runtime_integration_tests/test_pcr.rs @@ -100,7 +100,7 @@ pub fn get_model_pcrs(model: &mut DefaultHwModel) -> [[u8; 48]; 32] { .unwrap() .unwrap(); - return QuotePcrsResp::read_from(resp.as_slice()).unwrap().pcrs; + QuotePcrsResp::read_from(resp.as_slice()).unwrap().pcrs } #[test] diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 0d9ca873ec..3d5d5986c6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,7 +1,7 @@ # Licensed under the Apache-2.0 license [toolchain] -channel = "1.70" +channel = "1.83" targets = ["riscv32imc-unknown-none-elf"] profile = "minimal" components = ["rustfmt", "clippy"] diff --git a/sw-emulator/app/src/main.rs b/sw-emulator/app/src/main.rs index 8c2a0aa23d..db678dfe09 100644 --- a/sw-emulator/app/src/main.rs +++ b/sw-emulator/app/src/main.rs @@ -415,7 +415,7 @@ fn main() -> io::Result<()> { Ok(()) } -fn change_dword_endianess(data: &mut Vec) { +fn change_dword_endianess(data: &mut [u8]) { for idx in (0..data.len()).step_by(4) { data.swap(idx, idx + 3); data.swap(idx + 1, idx + 2); diff --git a/sw-emulator/compliance-test/src/main.rs b/sw-emulator/compliance-test/src/main.rs index 1c84eab0a1..8272d64b54 100644 --- a/sw-emulator/compliance-test/src/main.rs +++ b/sw-emulator/compliance-test/src/main.rs @@ -171,7 +171,7 @@ fn main() -> Result<(), Box> { } } if !is_test_complete(&mut cpu.bus) { - return Err(std::io::Error::new( + Err(std::io::Error::new( ErrorKind::Other, "test did not complete", ))?; diff --git a/sw-emulator/lib/bus/src/testing/log.rs b/sw-emulator/lib/bus/src/testing/log.rs index 9d8026ef11..2e24f09c46 100644 --- a/sw-emulator/lib/bus/src/testing/log.rs +++ b/sw-emulator/lib/bus/src/testing/log.rs @@ -77,7 +77,7 @@ impl Default for Log { struct LogWriter<'a> { log: &'a RefCell, } -impl<'a> Write for LogWriter<'a> { +impl Write for LogWriter<'_> { fn write_str(&mut self, s: &str) -> std::fmt::Result { Write::write_str(&mut *self.log.borrow_mut(), s) } diff --git a/sw-emulator/lib/cpu/src/cpu.rs b/sw-emulator/lib/cpu/src/cpu.rs index 9e032e7595..2ad7450d88 100644 --- a/sw-emulator/lib/cpu/src/cpu.rs +++ b/sw-emulator/lib/cpu/src/cpu.rs @@ -23,6 +23,7 @@ use caliptra_emu_types::{RvAddr, RvData, RvException, RvSize}; pub type InstrTracer<'a> = dyn FnMut(u32, RvInstr) + 'a; /// Describes a Caliptra stack memory region +#[allow(dead_code)] // Stack start never checked pub struct StackRange(u32, u32); impl StackRange { /// **Note:** `stack_start` MUST be greater than `stack_end`. Caliptra's stack grows @@ -746,7 +747,9 @@ impl Cpu { if self.write_csr_machine(Csr::MEIHAP, meihap.0).is_err() { return StepAction::Fatal; } - let Ok(next_pc) = self.read_bus(RvSize::Word, next_pc_ptr) else { return StepAction::Fatal; }; + let Ok(next_pc) = self.read_bus(RvSize::Word, next_pc_ptr) else { + return StepAction::Fatal; + }; const MACHINE_EXTERNAL_INT: u32 = 0x8000_000B; let ret = self.handle_trap(self.read_pc(), MACHINE_EXTERNAL_INT, 0, next_pc); match ret { @@ -1814,7 +1817,7 @@ mod tests { #[test] fn test_coverage() { // represent program as an array of 16-bit and 32-bit instructions - let instructions = vec![ + let instructions = [ Instr::Compressed(0x1234), Instr::Compressed(0xABCD), Instr::General(0xDEADBEEF), diff --git a/sw-emulator/lib/cpu/src/csr_file.rs b/sw-emulator/lib/cpu/src/csr_file.rs index bc4ee59c8f..284c60587a 100644 --- a/sw-emulator/lib/cpu/src/csr_file.rs +++ b/sw-emulator/lib/cpu/src/csr_file.rs @@ -87,7 +87,6 @@ impl Csr { /// /// * `val` - Reset value /// * `mask` - Write Mask - ///' pub fn new(default_val: RvData, mask: RvData) -> Self { Self { val: default_val, diff --git a/sw-emulator/lib/cpu/src/instr/mod.rs b/sw-emulator/lib/cpu/src/instr/mod.rs index 08aee4a1a1..6962ba5cfe 100644 --- a/sw-emulator/lib/cpu/src/instr/mod.rs +++ b/sw-emulator/lib/cpu/src/instr/mod.rs @@ -93,7 +93,7 @@ impl Cpu { fn fetch(&mut self) -> Result { let instr = self.read_instr(RvSize::HalfWord, self.read_pc())?; match instr & 0b11 { - 0 | 1 | 2 => Ok(Instr::Compressed(instr as u16)), + 0..=2 => Ok(Instr::Compressed(instr as u16)), _ => Ok(Instr::General( self.read_instr(RvSize::Word, self.read_pc())?, )), diff --git a/sw-emulator/lib/derive/src/util/token_iter.rs b/sw-emulator/lib/derive/src/util/token_iter.rs index 9f806f43e9..462b33273f 100644 --- a/sw-emulator/lib/derive/src/util/token_iter.rs +++ b/sw-emulator/lib/derive/src/util/token_iter.rs @@ -29,7 +29,7 @@ pub struct FieldWithAttributes { } pub struct DisplayToken<'a>(pub &'a Option); -impl<'a> Display for DisplayToken<'a> { +impl Display for DisplayToken<'_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self.0 { Some(TokenTree::Ident(i)) => write!(f, "identifier {}", i), diff --git a/sw-emulator/lib/periph/src/hash_sha512.rs b/sw-emulator/lib/periph/src/hash_sha512.rs index e6aaa007ea..8ba5613fc9 100644 --- a/sw-emulator/lib/periph/src/hash_sha512.rs +++ b/sw-emulator/lib/periph/src/hash_sha512.rs @@ -847,7 +847,7 @@ mod tests { let mut hash_write_fail_test = false; let mut block_disallowed_for_sha = false; - for (_idx, action) in keyvault_actions.iter().enumerate() { + for action in keyvault_actions.iter() { match action { KeyVaultAction::BlockFromVault(id) => { block_via_kv = true; diff --git a/sw-emulator/lib/periph/src/hmac.rs b/sw-emulator/lib/periph/src/hmac.rs index 1d29d2168a..c3caec4a09 100644 --- a/sw-emulator/lib/periph/src/hmac.rs +++ b/sw-emulator/lib/periph/src/hmac.rs @@ -818,7 +818,7 @@ mod tests { let mut tag_write_fail_test = false; let mut block_disallowed_for_hmac = false; - for (_idx, action) in keyvault_actions.iter().enumerate() { + for action in keyvault_actions.iter() { match action { KeyVaultAction::KeyFromVault(id) => { key_via_kv = true; diff --git a/sw-emulator/lib/periph/src/mailbox.rs b/sw-emulator/lib/periph/src/mailbox.rs index 59383d8a2d..ac7bc02a2d 100644 --- a/sw-emulator/lib/periph/src/mailbox.rs +++ b/sw-emulator/lib/periph/src/mailbox.rs @@ -129,7 +129,6 @@ pub struct MailboxInternal { } /// Mailbox Peripheral - impl MailboxInternal { pub fn new(clock: &Clock, ram: MailboxRam) -> Self { Self { @@ -250,7 +249,6 @@ pub struct MailboxRegs { /// Trigger interrupt irq: bool, - /// timer: Timer, } @@ -490,8 +488,6 @@ pub struct Context { pub locked: u32, /// Who acquired the lock. pub user: MailboxRequester, - /// Execute flag - pub exec: bool, /// number of data elements pub dlen: u32, /// Fifo storage @@ -511,7 +507,6 @@ impl Context { Self { locked: 0, user: MailboxRequester::Caliptra, - exec: false, dlen: 0, status: LocalRegisterCopy::new(0), fifo: Fifo::new(ram), diff --git a/sw-emulator/lib/periph/src/root_bus.rs b/sw-emulator/lib/periph/src/root_bus.rs index 1864c0d714..f92db59635 100644 --- a/sw-emulator/lib/periph/src/root_bus.rs +++ b/sw-emulator/lib/periph/src/root_bus.rs @@ -68,7 +68,7 @@ pub struct ReadyForFwCbArgs<'a> { pub mailbox: &'a mut MailboxInternal, pub(crate) sched_fn: Box>, } -impl<'a> ReadyForFwCbArgs<'a> { +impl ReadyForFwCbArgs<'_> { pub fn schedule_later( self, ticks_from_now: u64, diff --git a/sw-emulator/lib/periph/src/sha512_acc.rs b/sw-emulator/lib/periph/src/sha512_acc.rs index 2f06b046db..0cf6b744d3 100644 --- a/sw-emulator/lib/periph/src/sha512_acc.rs +++ b/sw-emulator/lib/periph/src/sha512_acc.rs @@ -409,7 +409,7 @@ impl Sha512AcceleratorRegs { /// * `BusError` - Exception with cause `BusError::StoreAccessFault` or `BusError::StoreAddrMisaligned` fn compute_mbox_hash(&mut self) { let data_len = self.dlen.reg.get() as usize; - let totaldwords = (data_len + (RvSize::Word as usize - 1)) / (RvSize::Word as usize); + let totaldwords = data_len.div_ceil(RvSize::Word as usize); let totalblocks = ((data_len + 16) + SHA512_BLOCK_SIZE) / SHA512_BLOCK_SIZE; let totalbytes = totalblocks * SHA512_BLOCK_SIZE; let mut block_arr: Vec = vec![0; totalbytes]; diff --git a/systemrdl/src/component_meta.rs b/systemrdl/src/component_meta.rs index 91d4aab0c2..2a9745d01a 100644 --- a/systemrdl/src/component_meta.rs +++ b/systemrdl/src/component_meta.rs @@ -9,7 +9,6 @@ use crate::{RdlError, Result}; pub struct PropertyMeta { pub name: &'static str, pub ty: PropertyType, - pub is_dynamic: bool, } pub struct ComponentMeta { @@ -25,13 +24,13 @@ static SIGNAL: ComponentMeta = ComponentMeta { can_instantiate: true, deep_subelement_types: &[], properties: &[ - PropertyMeta{name: "signalwidth", ty: PropertyType::U64, is_dynamic: false }, - PropertyMeta{name: "sync", ty: PropertyType::Boolean, is_dynamic: true }, - PropertyMeta{name: "async", ty: PropertyType::Boolean, is_dynamic: true }, - PropertyMeta{name: "cpuif_reset", ty: PropertyType::Boolean, is_dynamic: true }, - PropertyMeta{name: "field_reset", ty: PropertyType::Boolean, is_dynamic: true }, - PropertyMeta{name: "activelow", ty: PropertyType::Boolean, is_dynamic: true }, - PropertyMeta{name: "activehigh", ty: PropertyType::Boolean, is_dynamic: true }, + PropertyMeta{name: "signalwidth", ty: PropertyType::U64}, + PropertyMeta{name: "sync", ty: PropertyType::Boolean}, + PropertyMeta{name: "async", ty: PropertyType::Boolean}, + PropertyMeta{name: "cpuif_reset", ty: PropertyType::Boolean}, + PropertyMeta{name: "field_reset", ty: PropertyType::Boolean}, + PropertyMeta{name: "activelow", ty: PropertyType::Boolean}, + PropertyMeta{name: "activehigh", ty: PropertyType::Boolean}, ], }; @@ -42,73 +41,73 @@ static FIELD: ComponentMeta = ComponentMeta { deep_subelement_types: &[], properties: &[ // Structural properties - PropertyMeta{name: "donttest", ty: PropertyType::Bits, is_dynamic: true}, - PropertyMeta{name: "dontcompare", ty: PropertyType::Bits, is_dynamic: true}, + PropertyMeta{name: "donttest", ty: PropertyType::Bits}, + PropertyMeta{name: "dontcompare", ty: PropertyType::Bits}, // Field access properties - PropertyMeta{name: "hw", ty: PropertyType::AccessType, is_dynamic: false}, - PropertyMeta{name: "sw", ty: PropertyType::AccessType, is_dynamic: true}, + PropertyMeta{name: "hw", ty: PropertyType::AccessType}, + PropertyMeta{name: "sw", ty: PropertyType::AccessType}, // Hardware signal properties - PropertyMeta{name: "next", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "reset", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "resetsignal", ty: PropertyType::Reference, is_dynamic: true}, + PropertyMeta{name: "next", ty: PropertyType::Reference}, + PropertyMeta{name: "reset", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "resetsignal", ty: PropertyType::Reference}, // Software access properties - PropertyMeta{name: "rclr", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "rset", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "onread", ty: PropertyType::OnReadType, is_dynamic: true}, - PropertyMeta{name: "woset", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "woclr", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "onwrite", ty: PropertyType::OnWriteType, is_dynamic: true}, - PropertyMeta{name: "swwe", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "swwel", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "swmod", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "swacc", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "singlepulse", ty: PropertyType::Boolean, is_dynamic: true}, + PropertyMeta{name: "rclr", ty: PropertyType::Boolean}, + PropertyMeta{name: "rset", ty: PropertyType::Boolean}, + PropertyMeta{name: "onread", ty: PropertyType::OnReadType}, + PropertyMeta{name: "woset", ty: PropertyType::Boolean}, + PropertyMeta{name: "woclr", ty: PropertyType::Boolean}, + PropertyMeta{name: "onwrite", ty: PropertyType::OnWriteType}, + PropertyMeta{name: "swwe", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "swwel", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "swmod", ty: PropertyType::Boolean}, + PropertyMeta{name: "swacc", ty: PropertyType::Boolean}, + PropertyMeta{name: "singlepulse", ty: PropertyType::Boolean}, // Hardware access properties - PropertyMeta{name: "we", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "wel", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "anded", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "ored", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "xored", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "fieldwidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "hwclr", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "hwset", ty: PropertyType::BooleanOrReference, is_dynamic: true}, - PropertyMeta{name: "hwenable", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "hwmask", ty: PropertyType::Reference, is_dynamic: true}, + PropertyMeta{name: "we", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "wel", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "anded", ty: PropertyType::Boolean}, + PropertyMeta{name: "ored", ty: PropertyType::Boolean}, + PropertyMeta{name: "xored", ty: PropertyType::Boolean}, + PropertyMeta{name: "fieldwidth", ty: PropertyType::U64}, + PropertyMeta{name: "hwclr", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "hwset", ty: PropertyType::BooleanOrReference}, + PropertyMeta{name: "hwenable", ty: PropertyType::Reference}, + PropertyMeta{name: "hwmask", ty: PropertyType::Reference}, // Counter field properties - PropertyMeta{name: "counter", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "threshold", ty: PropertyType::BitOrReference, is_dynamic: true}, // alias incrthreshold - PropertyMeta{name: "saturate", ty: PropertyType::BitOrReference, is_dynamic: true}, // alias incrsaturate - PropertyMeta{name: "incrthreshold", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "incrsaturate", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "overflow", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "underflow", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "incrvalue", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "incr", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "incrwidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "decrvalue", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "decr", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "decrwidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "decrsaturate", ty: PropertyType::BitOrReference, is_dynamic: true}, - PropertyMeta{name: "decrthreshold", ty: PropertyType::BitOrReference, is_dynamic: true}, + PropertyMeta{name: "counter", ty: PropertyType::Boolean}, + PropertyMeta{name: "threshold", ty: PropertyType::BitOrReference}, // alias incrthreshold + PropertyMeta{name: "saturate", ty: PropertyType::BitOrReference}, // alias incrsaturate + PropertyMeta{name: "incrthreshold", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "incrsaturate", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "overflow", ty: PropertyType::Boolean}, + PropertyMeta{name: "underflow", ty: PropertyType::Boolean}, + PropertyMeta{name: "incrvalue", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "incr", ty: PropertyType::Reference}, + PropertyMeta{name: "incrwidth", ty: PropertyType::U64}, + PropertyMeta{name: "decrvalue", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "decr", ty: PropertyType::Reference}, + PropertyMeta{name: "decrwidth", ty: PropertyType::U64}, + PropertyMeta{name: "decrsaturate", ty: PropertyType::BitOrReference}, + PropertyMeta{name: "decrthreshold", ty: PropertyType::BitOrReference}, // Field access interrupt properties - PropertyMeta{name: "intr" , ty: PropertyType::FieldInterrupt, is_dynamic: true}, // also - PropertyMeta{name: "enable", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "mask", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "haltenable", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "haltmask", ty: PropertyType::Reference, is_dynamic: true}, - PropertyMeta{name: "sticky", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "stickybit", ty: PropertyType::Boolean, is_dynamic: true}, + PropertyMeta{name: "intr" , ty: PropertyType::FieldInterrupt}, // also + PropertyMeta{name: "enable", ty: PropertyType::Reference}, + PropertyMeta{name: "mask", ty: PropertyType::Reference}, + PropertyMeta{name: "haltenable", ty: PropertyType::Reference}, + PropertyMeta{name: "haltmask", ty: PropertyType::Reference}, + PropertyMeta{name: "sticky", ty: PropertyType::Boolean}, + PropertyMeta{name: "stickybit", ty: PropertyType::Boolean}, // Miscellaneous field properties - PropertyMeta{name: "encode", ty: PropertyType::EnumReference, is_dynamic: true}, - PropertyMeta{name: "precedence", ty: PropertyType::PrecedenceType, is_dynamic: true}, - PropertyMeta{name: "paritycheck", ty: PropertyType::Boolean, is_dynamic: true}, + PropertyMeta{name: "encode", ty: PropertyType::EnumReference}, + PropertyMeta{name: "precedence", ty: PropertyType::PrecedenceType}, + PropertyMeta{name: "paritycheck", ty: PropertyType::Boolean}, ], }; @@ -118,10 +117,10 @@ static REG: ComponentMeta = ComponentMeta { can_instantiate: true, deep_subelement_types: &[&FIELD], properties: &[ - PropertyMeta{name: "regwidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "accesswidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "errextbus", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "shared", ty: PropertyType::Boolean, is_dynamic: true}, + PropertyMeta{name: "regwidth", ty: PropertyType::U64}, + PropertyMeta{name: "accesswidth", ty: PropertyType::U64}, + PropertyMeta{name: "errextbus", ty: PropertyType::Boolean}, + PropertyMeta{name: "shared", ty: PropertyType::Boolean}, ], }; @@ -131,9 +130,9 @@ static MEM: ComponentMeta = ComponentMeta { can_instantiate: true, deep_subelement_types: &[], properties: &[ - PropertyMeta{name: "mementries", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "memwidth", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "sw", ty: PropertyType::AccessType, is_dynamic: true}, + PropertyMeta{name: "mementries", ty: PropertyType::U64}, + PropertyMeta{name: "memwidth", ty: PropertyType::U64}, + PropertyMeta{name: "sw", ty: PropertyType::AccessType}, ], }; @@ -143,9 +142,9 @@ static REGFILE: ComponentMeta = ComponentMeta { can_instantiate: true, deep_subelement_types: &[®, ®FILE, &FIELD, &SIGNAL], properties: &[ - PropertyMeta{name: "alignment", ty: PropertyType::U64, is_dynamic: true}, - PropertyMeta{name: "sharedextbus", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "errextbus", ty: PropertyType::Boolean, is_dynamic: true}, + PropertyMeta{name: "alignment", ty: PropertyType::U64}, + PropertyMeta{name: "sharedextbus", ty: PropertyType::Boolean}, + PropertyMeta{name: "errextbus", ty: PropertyType::Boolean}, ], }; @@ -155,16 +154,16 @@ static ADDRMAP: ComponentMeta = ComponentMeta { can_instantiate: true, deep_subelement_types: &[®, ®FILE, &FIELD, &SIGNAL], properties: &[ - PropertyMeta{name: "alignment", ty: PropertyType::U64, is_dynamic: false}, - PropertyMeta{name: "sharedextbus", ty: PropertyType::Boolean, is_dynamic: false}, - PropertyMeta{name: "errextbus", ty: PropertyType::Boolean, is_dynamic: false}, - PropertyMeta{name: "bigendian", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "littleendian", ty: PropertyType::Boolean, is_dynamic: true}, - PropertyMeta{name: "addressing", ty: PropertyType::AddressingType, is_dynamic: false}, - PropertyMeta{name: "rsvdset", ty: PropertyType::Boolean, is_dynamic: false}, - PropertyMeta{name: "rsvdsetX", ty: PropertyType::Boolean, is_dynamic: false}, - PropertyMeta{name: "msb0", ty: PropertyType::Boolean, is_dynamic: false}, - PropertyMeta{name: "lsb0", ty: PropertyType::Boolean, is_dynamic: false}, + PropertyMeta{name: "alignment", ty: PropertyType::U64}, + PropertyMeta{name: "sharedextbus", ty: PropertyType::Boolean}, + PropertyMeta{name: "errextbus", ty: PropertyType::Boolean}, + PropertyMeta{name: "bigendian", ty: PropertyType::Boolean}, + PropertyMeta{name: "littleendian", ty: PropertyType::Boolean}, + PropertyMeta{name: "addressing", ty: PropertyType::AddressingType}, + PropertyMeta{name: "rsvdset", ty: PropertyType::Boolean}, + PropertyMeta{name: "rsvdsetX", ty: PropertyType::Boolean}, + PropertyMeta{name: "msb0", ty: PropertyType::Boolean}, + PropertyMeta{name: "lsb0", ty: PropertyType::Boolean}, ], }; @@ -220,12 +219,10 @@ static GENERAL_PROPERTIES: [PropertyMeta; 2] = [ PropertyMeta { name: "name", ty: PropertyType::String, - is_dynamic: true, }, PropertyMeta { name: "desc", ty: PropertyType::String, - is_dynamic: true, }, ]; diff --git a/systemrdl/src/scope.rs b/systemrdl/src/scope.rs index 3bdb867884..22f07060c2 100644 --- a/systemrdl/src/scope.rs +++ b/systemrdl/src/scope.rs @@ -528,7 +528,7 @@ impl<'a> ParentScope<'a> { }, }) } - pub fn type_iter(&'a self) -> impl Iterator)> { + pub fn type_iter(&'a self) -> impl Iterator)> { self.scope.types.iter().map(|(name, scope)| { ( name.as_str(), @@ -591,7 +591,7 @@ pub fn lookup_parameter<'a, 'b>( } return lookup_parameter(p.parent, name); } - return Err(RdlError::UnknownIdentifier(name)); + Err(RdlError::UnknownIdentifier(name)) } pub fn lookup_parameter_of_type<'a, 'b>( @@ -679,13 +679,12 @@ pub struct Instance { } impl Instance { pub fn element_size(&self) -> u64 { - let width = if let Ok(Some(w)) = self.scope.property_val_opt::("regwidth") { + if let Ok(Some(w)) = self.scope.property_val_opt::("regwidth") { w / 8 } else { // According to section 10.1 of the SystemRDL 2.0 spec, the default regwidth is 32-bits 4 - }; - width + } } pub fn total_size(&self) -> Result<'static, u64> { let stride = if let Some(stride) = self.stride { @@ -776,6 +775,74 @@ impl Instance { } } +fn is_intr_modifier(token: &Token) -> bool { + matches!( + *token, + Token::Identifier("posedge" | "negedge" | "bothedge" | "level" | "nonsticky" | "sticky") + ) +} + +struct PropertyAssignment<'a> { + prop_name: &'a str, + value: Value, +} + +static INTR_BOOL_PROPERTY: PropertyMeta = PropertyMeta { + name: "intr", + ty: PropertyType::Boolean, +}; +fn intr_bool_property<'a>(_name: &str) -> Result<'a, &'static PropertyMeta> { + Ok(&INTR_BOOL_PROPERTY) +} + +impl<'a> PropertyAssignment<'a> { + fn parse( + tokens: &mut TokenIter<'a>, + parameters: Option<&ParameterScope<'_>>, + meta_lookup_fn: impl Fn(&'a str) -> Result<'a, &'static PropertyMeta>, + ) -> Result<'a, Self> { + if is_intr_modifier(tokens.peek(0)) && *tokens.peek(1) == Token::Identifier("intr") { + let intr_modifier = tokens.expect_identifier()?; + // skip the bool tokens... + PropertyAssignment::parse(tokens, parameters, intr_bool_property)?; + return Ok(Self { + prop_name: "intr", + value: match intr_modifier { + "posedge" => InterruptType::PosEdge.into(), + "negedge" => InterruptType::NegEdge.into(), + "bothedge" => InterruptType::BothEdge.into(), + "level" => InterruptType::Level.into(), + "nonsticky" => InterruptType::NonSticky.into(), + "sticky" => InterruptType::Sticky.into(), + _ => InterruptType::Level.into(), + }, + }); + } + + let prop_name = tokens.expect_identifier()?; + let prop_meta = meta_lookup_fn(prop_name)?; + + let value = if *tokens.peek(0) == Token::Semicolon { + // This must be a boolean property set to true or an intr + if prop_meta.ty != PropertyType::Boolean + && prop_meta.ty != PropertyType::BooleanOrReference + && prop_meta.ty != PropertyType::FieldInterrupt + { + return Err(RdlError::UnexpectedPropertyType { + expected_type: prop_meta.ty, + value: true.into(), + }); + } + true.into() + } else { + tokens.expect(Token::Equals)?; + prop_meta.ty.eval(tokens, parameters)? + }; + tokens.expect(Token::Semicolon)?; + Ok(Self { prop_name, value }) + } +} + #[cfg(test)] mod tests { use crate::{file_source::MemFileSource, value::AccessType, EnumReference}; @@ -1035,72 +1102,3 @@ mod tests { ); } } - -fn is_intr_modifier(token: &Token) -> bool { - matches!( - *token, - Token::Identifier("posedge" | "negedge" | "bothedge" | "level" | "nonsticky" | "sticky") - ) -} - -struct PropertyAssignment<'a> { - prop_name: &'a str, - value: Value, -} - -static INTR_BOOL_PROPERTY: PropertyMeta = PropertyMeta { - name: "intr", - ty: PropertyType::Boolean, - is_dynamic: true, -}; -fn intr_bool_property<'a>(_name: &str) -> Result<'a, &'static PropertyMeta> { - Ok(&INTR_BOOL_PROPERTY) -} - -impl<'a> PropertyAssignment<'a> { - fn parse( - tokens: &mut TokenIter<'a>, - parameters: Option<&ParameterScope<'_>>, - meta_lookup_fn: impl Fn(&'a str) -> Result<'a, &'static PropertyMeta>, - ) -> Result<'a, Self> { - if is_intr_modifier(tokens.peek(0)) && *tokens.peek(1) == Token::Identifier("intr") { - let intr_modifier = tokens.expect_identifier()?; - // skip the bool tokens... - PropertyAssignment::parse(tokens, parameters, intr_bool_property)?; - return Ok(Self { - prop_name: "intr", - value: match intr_modifier { - "posedge" => InterruptType::PosEdge.into(), - "negedge" => InterruptType::NegEdge.into(), - "bothedge" => InterruptType::BothEdge.into(), - "level" => InterruptType::Level.into(), - "nonsticky" => InterruptType::NonSticky.into(), - "sticky" => InterruptType::Sticky.into(), - _ => InterruptType::Level.into(), - }, - }); - } - - let prop_name = tokens.expect_identifier()?; - let prop_meta = meta_lookup_fn(prop_name)?; - - let value = if *tokens.peek(0) == Token::Semicolon { - // This must be a boolean property set to true or an intr - if prop_meta.ty != PropertyType::Boolean - && prop_meta.ty != PropertyType::BooleanOrReference - && prop_meta.ty != PropertyType::FieldInterrupt - { - return Err(RdlError::UnexpectedPropertyType { - expected_type: prop_meta.ty, - value: true.into(), - }); - } - true.into() - } else { - tokens.expect(Token::Equals)?; - prop_meta.ty.eval(tokens, parameters)? - }; - tokens.expect(Token::Semicolon)?; - Ok(Self { prop_name, value }) - } -} diff --git a/systemrdl/src/token_iter.rs b/systemrdl/src/token_iter.rs index a40c85e2b7..653624d2e8 100644 --- a/systemrdl/src/token_iter.rs +++ b/systemrdl/src/token_iter.rs @@ -97,9 +97,7 @@ impl<'a> TokenIter<'a> { continue; } None => { - let Some(stack_entry) = self.iter_stack.pop() else { - return None; - }; + let stack_entry = self.iter_stack.pop()?; // this file was included from another file; resume // processing the original file. self.lex = stack_entry.lex; diff --git a/test/src/lib.rs b/test/src/lib.rs index 44dba1f839..98acba9d71 100644 --- a/test/src/lib.rs +++ b/test/src/lib.rs @@ -78,7 +78,7 @@ pub fn run_test( .unwrap(); let image_bytes = image.to_bytes().unwrap(); - let boot_params = boot_params.unwrap_or(BootParams::default()); + let boot_params = boot_params.unwrap_or_default(); // Use image in boot_params if provided // Otherwise, add our newly built image diff --git a/test/src/x509.rs b/test/src/x509.rs index 09ac3374f1..7de26bda32 100644 --- a/test/src/x509.rs +++ b/test/src/x509.rs @@ -103,7 +103,7 @@ impl DiceTcbInfo { } pub fn find_single_in_cert(cert_der: &[u8]) -> Result, asn1::ParseError> { let Some(ext_der) = get_cert_extension(cert_der, &DICE_TCB_INFO_OID)? else { - return Ok(None) + return Ok(None); }; asn1::parse(ext_der, Self::parse_single).map(Some) } diff --git a/test/tests/caliptra_integration_tests/jtag_test.rs b/test/tests/caliptra_integration_tests/jtag_test.rs index 5b40aa04d4..c6fa984f70 100644 --- a/test/tests/caliptra_integration_tests/jtag_test.rs +++ b/test/tests/caliptra_integration_tests/jtag_test.rs @@ -126,6 +126,8 @@ fn gdb_test() { .spawn() .unwrap(); + gdb.wait().unwrap(); + let mut stdin = gdb.stdin.take().expect("Failed to open stdin"); let mut stderr = BufReader::new(gdb.stderr.as_mut().unwrap()); diff --git a/test/tests/fips_test_suite/common.rs b/test/tests/fips_test_suite/common.rs index d387c3b823..a7f8ed4978 100755 --- a/test/tests/fips_test_suite/common.rs +++ b/test/tests/fips_test_suite/common.rs @@ -145,7 +145,7 @@ impl RtExpVals { pub fn fips_test_init_model(init_params: Option) -> DefaultHwModel { // Create params if not provided - let mut init_params = init_params.unwrap_or(InitParams::default()); + let mut init_params = init_params.unwrap_or_default(); // Check that ROM was not provided if the immutable_rom feature is set #[cfg(feature = "test_env_immutable_rom")] @@ -176,7 +176,7 @@ pub fn fips_test_init_model(init_params: Option) -> DefaultHwModel { fn fips_test_boot(hw: &mut T, boot_params: Option) { // Create params if not provided - let boot_params = boot_params.unwrap_or(BootParams::default()); + let boot_params = boot_params.unwrap_or_default(); // Boot hw.boot(boot_params).unwrap(); @@ -238,7 +238,7 @@ pub fn fips_test_init_to_rt( boot_params: Option, ) -> DefaultHwModel { // Create params if not provided - let mut boot_params = boot_params.unwrap_or(BootParams::default()); + let mut boot_params = boot_params.unwrap_or_default(); if boot_params.fw_image.is_some() { fips_test_init_base(init_params, Some(boot_params)) diff --git a/test/tests/fips_test_suite/fw_load.rs b/test/tests/fips_test_suite/fw_load.rs index 6de7a4b63c..d004ff6a76 100755 --- a/test/tests/fips_test_suite/fw_load.rs +++ b/test/tests/fips_test_suite/fw_load.rs @@ -174,7 +174,7 @@ fn fw_load_error_flow_base( initial_dbg_manuf_service_reg: Option, ) { // Use defaults if not provided - let fuses = fuses.unwrap_or(Fuses::default()); + let fuses = fuses.unwrap_or_default(); let fw_image = fw_image.unwrap_or(build_fw_image(ImageOptions::default())); // Attempt to load the FW diff --git a/ureg/lib/schema/src/validate.rs b/ureg/lib/schema/src/validate.rs index 8f3ca782a0..acaa25a204 100644 --- a/ureg/lib/schema/src/validate.rs +++ b/ureg/lib/schema/src/validate.rs @@ -233,7 +233,9 @@ impl ValidatedRegisterBlock { // Keep this register in self.registers return true; } - let Ok(index) = reg.name[reg_name.len()..].parse::() else { return true; }; + let Ok(index) = reg.name[reg_name.len()..].parse::() else { + return true; + }; let reg_name = reg_name.trim_start_matches(block_name); instances_by_name @@ -484,36 +486,6 @@ fn compute_common_name<'a>(reg_names: &'a [&'a str]) -> Option { .and_then(|s| if s.is_empty() { None } else { Some(s) }) } -#[cfg(test)] -mod compute_reg_type_name_tests { - use super::*; - - #[test] - fn test() { - assert_eq!( - compute_common_name(&["UART0", "UART1", "UART10"]), - Some("UART".into()) - ); - assert_eq!(compute_common_name(&["UART0"]), Some("UART0".into())); - assert_eq!( - compute_common_name(&["DIEPTCTL", "DOEPTCTL"]), - Some("DXEPTCTL".into()) - ); - assert_eq!( - compute_common_name(&["dieptctl", "doeptctl"]), - Some("dxeptctl".into()) - ); - assert_eq!( - compute_common_name(&["DIEPTCTL0", "DIEPTCTL1", "DOEPTCTL0", "DOEPTCTL1"]), - Some("DXEPTCTL".into()) - ); - assert_eq!( - compute_common_name(&["PROG_LB0_POST_OVRD", "LB0_POST_OVRD"]), - Some("LB0_POST_OVRD".into()) - ); - } -} - fn hash_u64(v: &impl Hash) -> u64 { let mut h = DefaultHasher::new(); v.hash(&mut h); @@ -778,3 +750,33 @@ impl RegisterBlock { } } } + +#[cfg(test)] +mod compute_reg_type_name_tests { + use super::*; + + #[test] + fn test() { + assert_eq!( + compute_common_name(&["UART0", "UART1", "UART10"]), + Some("UART".into()) + ); + assert_eq!(compute_common_name(&["UART0"]), Some("UART0".into())); + assert_eq!( + compute_common_name(&["DIEPTCTL", "DOEPTCTL"]), + Some("DXEPTCTL".into()) + ); + assert_eq!( + compute_common_name(&["dieptctl", "doeptctl"]), + Some("dxeptctl".into()) + ); + assert_eq!( + compute_common_name(&["DIEPTCTL0", "DIEPTCTL1", "DOEPTCTL0", "DOEPTCTL1"]), + Some("DXEPTCTL".into()) + ); + assert_eq!( + compute_common_name(&["PROG_LB0_POST_OVRD", "LB0_POST_OVRD"]), + Some("LB0_POST_OVRD".into()) + ); + } +} diff --git a/ureg/lib/systemrdl/src/lib.rs b/ureg/lib/systemrdl/src/lib.rs index 0dba7a33e2..a726c2e81d 100644 --- a/ureg/lib/systemrdl/src/lib.rs +++ b/ureg/lib/systemrdl/src/lib.rs @@ -362,23 +362,6 @@ fn next_multiple_of(x: u64, mult: u64) -> u64 { } } -#[cfg(test)] -mod next_multiple_of_tests { - use super::*; - #[test] - fn test_next_multiple_of() { - assert_eq!(0, next_multiple_of(0, 3)); - assert_eq!(3, next_multiple_of(1, 3)); - assert_eq!(3, next_multiple_of(2, 3)); - assert_eq!(3, next_multiple_of(3, 3)); - assert_eq!(6, next_multiple_of(4, 3)); - for i in 1..128 { - assert_eq!(128, next_multiple_of(i, 128)); - assert_eq!(256, next_multiple_of(128 + i, 128)); - } - } -} - fn translate_block(iref: InstanceRef, top: bool) -> Result { let wrap_err = |err: Error| Error::BlockError { block_name: iref.instance.name.clone(), @@ -473,3 +456,20 @@ pub fn translate_addrmap(addrmap: systemrdl::ParentScope) -> Result { pub tcb_info_fmc_svn: &'a [u8; 1usize], pub tcb_info_fmc_svn_fuses: &'a [u8; 1usize], } -impl<'a> FmcAliasCertTbsParams<'a> { +impl FmcAliasCertTbsParams<'_> { pub const PUBLIC_KEY_LEN: usize = 97usize; pub const SUBJECT_SN_LEN: usize = 64usize; pub const ISSUER_SN_LEN: usize = 64usize; diff --git a/x509/build/init_dev_id_csr_tbs.rs b/x509/build/init_dev_id_csr_tbs.rs index c989be7267..04f147b2b7 100644 --- a/x509/build/init_dev_id_csr_tbs.rs +++ b/x509/build/init_dev_id_csr_tbs.rs @@ -12,7 +12,7 @@ pub struct InitDevIdCsrTbsParams<'a> { pub public_key: &'a [u8; 97usize], pub subject_sn: &'a [u8; 64usize], } -impl<'a> InitDevIdCsrTbsParams<'a> { +impl InitDevIdCsrTbsParams<'_> { pub const UEID_LEN: usize = 17usize; pub const PUBLIC_KEY_LEN: usize = 97usize; pub const SUBJECT_SN_LEN: usize = 64usize; diff --git a/x509/build/local_dev_id_cert_tbs.rs b/x509/build/local_dev_id_cert_tbs.rs index adb180a84c..2727e2f829 100644 --- a/x509/build/local_dev_id_cert_tbs.rs +++ b/x509/build/local_dev_id_cert_tbs.rs @@ -18,7 +18,7 @@ pub struct LocalDevIdCertTbsParams<'a> { pub not_before: &'a [u8; 15usize], pub not_after: &'a [u8; 15usize], } -impl<'a> LocalDevIdCertTbsParams<'a> { +impl LocalDevIdCertTbsParams<'_> { pub const PUBLIC_KEY_LEN: usize = 97usize; pub const SUBJECT_SN_LEN: usize = 64usize; pub const ISSUER_SN_LEN: usize = 64usize; diff --git a/x509/build/rt_alias_cert_tbs.rs b/x509/build/rt_alias_cert_tbs.rs index fb13855784..3ecdc26ea3 100644 --- a/x509/build/rt_alias_cert_tbs.rs +++ b/x509/build/rt_alias_cert_tbs.rs @@ -20,7 +20,7 @@ pub struct RtAliasCertTbsParams<'a> { pub not_after: &'a [u8; 15usize], pub tcb_info_rt_svn: &'a [u8; 1usize], } -impl<'a> RtAliasCertTbsParams<'a> { +impl RtAliasCertTbsParams<'_> { pub const PUBLIC_KEY_LEN: usize = 97usize; pub const SUBJECT_SN_LEN: usize = 64usize; pub const ISSUER_SN_LEN: usize = 64usize; diff --git a/x509/src/cert_bldr.rs b/x509/src/cert_bldr.rs index f8388d0a5e..630335f0d1 100644 --- a/x509/src/cert_bldr.rs +++ b/x509/src/cert_bldr.rs @@ -57,10 +57,10 @@ impl Ecdsa384Signature { impl Signature<108> for Ecdsa384Signature { fn to_der(&self, buf: &mut [u8; 108]) -> Option { // Encode Signature R Coordinate - let r_uint_len = der_uint_len(&self.r)?; + let r_uint_len = der_uint_len(&self.r); // Encode Signature S Coordinate - let s_uint_len = der_uint_len(&self.s)?; + let s_uint_len = der_uint_len(&self.s); // // Signature DER Sequence encoding @@ -115,7 +115,7 @@ impl Default for Mldsa87Signature { impl Signature<4635> for Mldsa87Signature { fn to_der(&self, buf: &mut [u8; 4635]) -> Option { - let ml_dsa_signature_len = der_uint_len(&self.sig)?; + let ml_dsa_signature_len = der_uint_len(&self.sig); // // Signature DER Sequence encoding diff --git a/x509/src/der_helper.rs b/x509/src/der_helper.rs index 956ad5a0af..1cb4b584d9 100644 --- a/x509/src/der_helper.rs +++ b/x509/src/der_helper.rs @@ -39,17 +39,16 @@ fn encode_length(val: &[u8]) -> usize { /// Compute len of DER encoding of an unsinged integer #[inline(never)] -pub fn der_uint_len(val: &[u8]) -> Option { +pub fn der_uint_len(val: &[u8]) -> usize { let encode_length = encode_length(val); let len_field_size = match encode_length { 0..=127 => 1, 128.. => trim_leading_zeros(&encode_length.to_be_bytes()).len(), - _ => None?, }; // Tag + len + int - Some(1 + len_field_size + encode_length) + 1 + len_field_size + encode_length } /// Encode a DER length