From 5cd5f8984d5726e1614b85d7ab93b62014e4be83 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Mon, 10 Feb 2025 20:06:55 +0100 Subject: [PATCH] Update rust toolchain to 1.84 This fixes all the warnings and erros that the newer rust toolchain throws. 1.84 uses a bit more stack than 1.70. Signed-off-by: Arthur Heymans --- .cargo/{config => config.toml} | 2 + Cargo.lock | 1091 +++++++---------- api/src/soc_mgr.rs | 5 +- builder/src/lib.rs | 28 +- cfi/lib/src/cfi_counter.rs | 11 +- ci-tools/size-history/src/git.rs | 2 +- ci-tools/size-history/src/main.rs | 8 +- common/src/lib.rs | 2 +- common/src/verifier.rs | 2 +- common/src/x509.rs | 1 - coverage/src/lib.rs | 10 +- cpu/Cargo.toml | 1 + drivers/Cargo.toml | 3 +- drivers/src/dma.rs | 4 +- drivers/src/ecc384.rs | 16 +- drivers/src/hmac.rs | 7 +- drivers/src/lib.rs | 2 +- drivers/src/memory_layout.rs | 4 +- drivers/src/printer.rs | 16 +- drivers/src/sha1.rs | 2 +- drivers/src/sha256.rs | 4 +- drivers/src/sha2_512_384.rs | 6 +- drivers/src/sha2_512_384acc.rs | 8 +- drivers/test-fw/Cargo.toml | 1 + fmc/Cargo.toml | 9 +- fmc/src/flow/dice.rs | 5 + hw-model/c-binding/src/caliptra_model.rs | 2 +- hw-model/src/lib.rs | 11 +- hw-model/src/model_emulated.rs | 2 +- hw-model/tests/model_tests.rs | 12 +- hw-model/types/src/lib.rs | 40 +- image/crypto/src/lib.rs | 4 +- image/elf/src/lib.rs | 7 +- image/gen/src/lib.rs | 2 +- lms-types/src/lib.rs | 3 +- rom/dev/src/flow/cold_reset/dice.rs | 2 + rom/dev/src/flow/cold_reset/fw_processor.rs | 11 +- rom/dev/src/flow/cold_reset/mod.rs | 2 +- rom/dev/src/flow/fake.rs | 14 +- rom/dev/src/main.rs | 12 +- rom/dev/src/rom_env.rs | 5 - .../test_image_validation.rs | 4 +- rom/dev/tools/test-fmc/src/main.rs | 2 +- runtime/src/authorize_and_stash.rs | 37 +- runtime/src/certify_key_extended.rs | 13 +- runtime/src/dice.rs | 8 +- runtime/src/disable.rs | 4 +- runtime/src/dpe_crypto.rs | 15 +- runtime/src/dpe_platform.rs | 10 +- runtime/src/drivers.rs | 55 +- runtime/src/fips.rs | 11 +- runtime/src/get_idev_csr.rs | 66 +- runtime/src/hmac.rs | 4 +- runtime/src/info.rs | 1 - runtime/src/invoke_dpe.rs | 21 +- runtime/src/lib.rs | 14 +- runtime/src/mailbox.rs | 2 +- runtime/src/pcr.rs | 2 +- runtime/src/recovery_flow.rs | 21 +- runtime/src/set_auth_manifest.rs | 35 +- runtime/src/stash_measurement.rs | 3 +- runtime/src/subject_alt_name.rs | 2 +- runtime/src/tagging.rs | 16 +- runtime/src/verify.rs | 1 - runtime/test-fw/Cargo.toml | 1 + .../test_certify_key_extended.rs | 2 +- .../runtime_integration_tests/test_certs.rs | 4 +- .../test_pauser_privilege_levels.rs | 16 +- .../runtime_integration_tests/test_pcr.rs | 2 +- rust-toolchain.toml | 2 +- sw-emulator/app/src/main.rs | 2 +- sw-emulator/compliance-test/src/main.rs | 2 +- sw-emulator/lib/bus/src/testing/log.rs | 2 +- sw-emulator/lib/cpu/src/cpu.rs | 7 +- sw-emulator/lib/cpu/src/csr_file.rs | 1 - sw-emulator/lib/cpu/src/instr/mod.rs | 2 +- sw-emulator/lib/derive/src/util/token_iter.rs | 2 +- .../lib/periph/src/csrng/health_test.rs | 2 +- sw-emulator/lib/periph/src/hash_sha512.rs | 2 +- sw-emulator/lib/periph/src/hmac.rs | 2 +- sw-emulator/lib/periph/src/mailbox.rs | 6 +- sw-emulator/lib/periph/src/root_bus.rs | 2 +- sw-emulator/lib/periph/src/sha512_acc.rs | 2 +- systemrdl/src/component_meta.rs | 163 ++- systemrdl/src/scope.rs | 146 ++- systemrdl/src/token_iter.rs | 4 +- test/src/lib.rs | 2 +- test/src/x509.rs | 2 +- .../caliptra_integration_tests/jtag_test.rs | 2 + test/tests/fips_test_suite/common.rs | 6 +- ureg/lib/schema/src/validate.rs | 64 +- ureg/lib/systemrdl/src/lib.rs | 34 +- x509/build/fmc_alias_cert_tbs_ecc_384.rs | 2 +- x509/build/fmc_alias_cert_tbs_mldsa_87.rs | 4 +- x509/build/init_dev_id_csr_tbs_ecc_384.rs | 2 +- x509/build/init_dev_id_csr_tbs_mldsa_87.rs | 2 +- x509/build/local_dev_id_cert_tbs_ecc_384.rs | 2 +- x509/build/local_dev_id_cert_tbs_mldsa_87.rs | 4 +- x509/build/rt_alias_cert_tbs_ecc_384.rs | 2 +- x509/build/rt_alias_cert_tbs_mldsa_87.rs | 4 +- x509/src/cert_bldr.rs | 6 +- x509/src/der_helper.rs | 5 +- 102 files changed, 977 insertions(+), 1266 deletions(-) rename .cargo/{config => config.toml} (86%) 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 da45f1f40b..3e945ce608 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.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[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.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" [[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.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[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.8.0", "caliptra-api-types", "caliptra-emu-types", "caliptra-error", "caliptra-registers", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -233,13 +227,13 @@ name = "caliptra-auth-man-gen" version = "0.1.0" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-auth-man-types", "caliptra-image-gen", "caliptra-image-types", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -248,12 +242,12 @@ version = "0.1.0" dependencies = [ "arbitrary", "bitfield", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-error", "caliptra-image-types", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -275,8 +269,8 @@ dependencies = [ "hex", "serde", "serde_derive", - "toml 0.7.3", - "zerocopy", + "toml 0.7.8", + "zerocopy 0.6.6", ] [[package]] @@ -292,9 +286,9 @@ dependencies = [ "clap", "elf", "hex", - "nix 0.26.2", + "nix", "once_cell", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -357,7 +351,7 @@ version = "0.1.0" dependencies = [ "caliptra-drivers", "caliptra-registers", - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -365,7 +359,7 @@ name = "caliptra-drivers" version = "0.1.0" dependencies = [ "bitfield", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-api", "caliptra-auth-man-types", "caliptra-builder", @@ -381,13 +375,12 @@ dependencies = [ "caliptra-lms-types", "caliptra-registers", "caliptra-test", - "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "dpe", "openssl", "ufmt", "ureg", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -402,8 +395,8 @@ dependencies = [ "caliptra-lms-types", "caliptra-registers", "caliptra-test-harness", - "cfg-if 1.0.0", - "zerocopy", + "cfg-if", + "zerocopy 0.6.6", ] [[package]] @@ -490,7 +483,7 @@ dependencies = [ "sha3", "smlang", "tock-registers", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -522,10 +515,10 @@ dependencies = [ "caliptra-test", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "openssl", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -555,12 +548,12 @@ dependencies = [ "caliptra-test-harness-types", "caliptra-verilated", "libc", - "nix 0.26.2", + "nix", "rand", "sha2", "uio", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -609,8 +602,8 @@ dependencies = [ "hex", "serde", "serde_derive", - "toml 0.7.3", - "zerocopy", + "toml 0.7.8", + "zerocopy 0.6.6", ] [[package]] @@ -621,14 +614,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]] @@ -649,7 +642,7 @@ dependencies = [ "caliptra-image-gen", "caliptra-image-types", "caliptra-lms-types", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -657,13 +650,13 @@ name = "caliptra-image-gen" version = "0.1.0" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-image-types", "caliptra-lms-types", "fips204", "memoffset 0.8.0", "rand", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -673,7 +666,7 @@ dependencies = [ "anyhow", "caliptra-image-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -686,7 +679,7 @@ dependencies = [ "caliptra-error", "caliptra-lms-types", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -694,14 +687,14 @@ dependencies = [ name = "caliptra-image-verify" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-cfi-derive", "caliptra-cfi-lib", "caliptra-drivers", "caliptra-image-types", "caliptra_common", "memoffset 0.8.0", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -711,7 +704,7 @@ dependencies = [ "caliptra-drivers", "caliptra-lms-types", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -721,7 +714,7 @@ dependencies = [ "arbitrary", "caliptra-cfi-derive", "caliptra-cfi-lib", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -763,14 +756,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", ] @@ -783,10 +776,10 @@ dependencies = [ "caliptra-registers", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "ufmt", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -796,7 +789,7 @@ dependencies = [ "caliptra-cpu", "caliptra-drivers", "caliptra-image-types", - "cfg-if 1.0.0", + "cfg-if", "ufmt", ] @@ -805,7 +798,7 @@ name = "caliptra-runtime" version = "0.1.0" dependencies = [ "arrayvec", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-api", "caliptra-auth-man-gen", "caliptra-auth-man-types", @@ -830,7 +823,7 @@ dependencies = [ "caliptra-test", "caliptra-x509", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "cms", "crypto", "dpe", @@ -842,7 +835,7 @@ dependencies = [ "ureg", "wycheproof", "x509-parser", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -857,9 +850,9 @@ dependencies = [ "caliptra-runtime", "caliptra-test-harness", "caliptra_common", - "cfg-if 1.0.0", + "cfg-if", "ufmt", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -904,7 +897,7 @@ dependencies = [ "rand", "regex", "ureg", - "zerocopy", + "zerocopy 0.6.6", ] [[package]] @@ -912,7 +905,7 @@ name = "caliptra-test-harness" version = "0.1.0" dependencies = [ "caliptra-drivers", - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -947,7 +940,7 @@ name = "caliptra_common" version = "0.1.0" dependencies = [ "bitfield", - "bitflags 2.4.0", + "bitflags 2.8.0", "caliptra-api", "caliptra-cpu", "caliptra-drivers", @@ -955,7 +948,7 @@ dependencies = [ "caliptra-image-verify", "caliptra-registers", "ufmt", - "zerocopy", + "zerocopy 0.6.6", "zeroize", ] @@ -981,12 +974,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", @@ -999,19 +992,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "c7777341816418c02e033934a09f20dc0ccaf65a5201ef8a450ae0105a573fda" 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" @@ -1020,16 +1007,16 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.32" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets", ] [[package]] @@ -1050,7 +1037,7 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.3", "textwrap", ] @@ -1075,16 +1062,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" @@ -1093,7 +1070,7 @@ dependencies = [ "caliptra-emu-cpu", "caliptra-emu-types", "clap", - "getrandom", + "getrandom 0.2.15", ] [[package]] @@ -1104,9 +1081,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" @@ -1119,15 +1096,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.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] @@ -1164,58 +1141,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", @@ -1223,15 +1156,15 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "575f75dfd25738df5b91b8e43e14d44bda14637a58fae779fd2b064f8bf3e010" [[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", @@ -1256,30 +1189,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.98", ] [[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.98", ] [[package]] @@ -1296,28 +1232,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.98", ] [[package]] name = "dpe" version = "0.1.0" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.8.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", ] @@ -1337,9 +1273,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" @@ -1362,24 +1298,27 @@ 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.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys", ] [[package]] name = "fastrand" -version = "1.9.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "ff" @@ -1405,9 +1344,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" @@ -1436,9 +1375,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", @@ -1451,9 +1390,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", @@ -1461,15 +1400,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", @@ -1478,27 +1417,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", @@ -1513,12 +1452,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", @@ -1548,13 +1487,25 @@ 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", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets", ] [[package]] @@ -1575,16 +1526,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.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hex" @@ -1594,9 +1551,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", ] @@ -1612,124 +1569,105 @@ 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.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "8c9c992b02b5b4c94ea26e32fe5bccb7aa7d9f390ab5c1221ff895bc7ea8b652" dependencies = [ - "cfg-if 1.0.0", + "equivalent", + "hashbrown 0.15.2", ] [[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.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "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.169" 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 = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a" [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[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", @@ -1737,12 +1675,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "04cbf5b083de1c7e0222a7a51dbfdba1cbe1c6ab0b15e29fff3f6c077fd9cd9f" [[package]] name = "managed" @@ -1752,9 +1687,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" @@ -1790,29 +1725,15 @@ dependencies = [ [[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]] @@ -1827,30 +1748,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", ] @@ -1866,18 +1791,18 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "61cfb4e166a8bb8c9b55c500bc2308550148ece889be90f609377e58140f42c6" dependencies = [ - "bitflags 2.4.0", - "cfg-if 1.0.0", + "bitflags 2.8.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -1887,29 +1812,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.98", ] [[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.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "8b22d5b84be05a8d6947c7cb71f7c849aa0f112acd4bf51c2a7c1c988ac0a9dc" dependencies = [ "cc", "libc", @@ -1926,9 +1851,9 @@ checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" [[package]] name = "p384" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" dependencies = [ "ecdsa", "elliptic-curve", @@ -1938,9 +1863,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", @@ -1948,22 +1873,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" @@ -1976,9 +1901,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1998,24 +1923,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" @@ -2028,18 +1962,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.35" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] @@ -2071,23 +2005,23 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "03a862b389f93e68874fbf580b9de08dd02facb9a788ebadaf4a3fd33cf58834" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.8.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", @@ -2097,9 +2031,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", @@ -2108,9 +2042,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" @@ -2133,23 +2067,28 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.27" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.8.0", "errno", - "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys", ] +[[package]] +name = "rustversion" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" + [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "scopeguard" @@ -2157,12 +2096,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" @@ -2179,40 +2112,41 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.217" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.98", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "d434192e7da787e94a6ea7e9670b26a036d0ca41e0b7efb2676dd32bae872949" 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", ] @@ -2239,7 +2173,7 @@ checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.98", ] [[package]] @@ -2248,7 +2182,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", ] @@ -2263,6 +2197,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" @@ -2275,18 +2215,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" @@ -2318,17 +2258,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" @@ -2343,9 +2277,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", @@ -2366,24 +2300,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", - "redox_syscall", + "getrandom 0.3.1", + "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", ] [[package]] @@ -2394,32 +2320,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.98", ] [[package]] name = "time" -version = "0.3.29" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -2433,10 +2361,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" dependencies = [ + "num-conv", "time-core", ] @@ -2466,9 +2395,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", @@ -2478,20 +2407,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.7.1", "serde", "serde_spanned", "toml_datetime", @@ -2500,9 +2429,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" @@ -2530,38 +2459,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.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "a210d160f08b701c8721ba1c726c11662f877ea6b7094007e1ca9a1041945034" [[package]] name = "unicode-segmentation" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" - -[[package]] -name = "unicode-width" -version = "0.1.10" +version = "1.12.0" 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" @@ -2604,52 +2527,56 @@ 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" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "void" -version = "1.0.2" +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.13.3+wasi-0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.98", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2657,22 +2584,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.98", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "winapi" @@ -2690,15 +2620,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" @@ -2706,229 +2627,112 @@ 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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" +name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets", ] [[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", -] - -[[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" -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" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "windows_i686_gnu" -version = "0.48.5" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -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" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" +name = "winnow" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] [[package]] -name = "winnow" -version = "0.3.6" +name = "wit-bindgen-rt" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d020b441f92996c80d94ae9166e8501e59c7bb56121189dc9eab3bd8216966" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ - "memchr", + "bitflags 2.8.0", ] [[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", ] @@ -2968,7 +2772,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]] @@ -2979,14 +2793,25 @@ checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.98", +] + +[[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.98", ] [[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", ] @@ -2999,5 +2824,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.98", ] diff --git a/api/src/soc_mgr.rs b/api/src/soc_mgr.rs index 6171f0f027..9de684f1ba 100644 --- a/api/src/soc_mgr.rs +++ b/api/src/soc_mgr.rs @@ -316,8 +316,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 7426e527a9..8818f3b151 100644 --- a/builder/src/lib.rs +++ b/builder/src/lib.rs @@ -193,9 +193,15 @@ pub fn build_firmware_elfs_uncached<'a>( .arg("target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"); } + // cmd.env("RUSTFLAGS", "--emit asm"); + cmd.arg("--config") + .arg("target.'cfg(all())'.rustflags = [\"-Dwarnings\"]"); cmd.arg("build") + // cmd.arg("fix") .arg("--quiet") .arg("--locked") + // .arg("--allow-dirty") + // .arg("--allow-staged") .arg("--target") .arg(TARGET) .arg("--features") @@ -388,7 +394,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 +404,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 +446,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 +457,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/lib.rs b/common/src/lib.rs index 11c3c4467e..9dcc768103 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -39,7 +39,7 @@ pub use fuse::{FuseLogEntry, FuseLogEntryId}; pub use pcr::{PcrLogEntry, PcrLogEntryId, RT_FW_CURRENT_PCR, RT_FW_JOURNEY_PCR}; pub const FMC_ORG: u32 = 0x40000000; -pub const FMC_SIZE: u32 = 21 * 1024; +pub const FMC_SIZE: u32 = 22 * 1024; pub const RUNTIME_ORG: u32 = FMC_ORG + FMC_SIZE; pub const RUNTIME_SIZE: u32 = 128 * 1024; diff --git a/common/src/verifier.rs b/common/src/verifier.rs index b5a75a134f..cda25916dd 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/common/src/x509.rs b/common/src/x509.rs index d95b072ab0..e0eead283e 100644 --- a/common/src/x509.rs +++ b/common/src/x509.rs @@ -13,7 +13,6 @@ Abstract: --*/ use caliptra_drivers::*; use core::mem::size_of; -use core::usize; use zerocopy::AsBytes; use crate::crypto::PubKey; diff --git a/coverage/src/lib.rs b/coverage/src/lib.rs index 13065fcd0e..5edd20c0a1 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"); @@ -110,7 +110,7 @@ pub fn get_bitvec_paths(dir: &str) -> Result, Box) -> 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 4602772b84..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"] @@ -45,4 +47,3 @@ caliptra-hw-model-types.workspace = true caliptra-hw-model.workspace = true caliptra-test.workspace = true openssl.workspace = true -caliptra_common.workspace = true diff --git a/drivers/src/dma.rs b/drivers/src/dma.rs index afd1073413..253ffd7d5e 100644 --- a/drivers/src/dma.rs +++ b/drivers/src/dma.rs @@ -438,7 +438,7 @@ impl<'a> DmaMmio<'a> { } } -impl<'a> Mmio for &DmaMmio<'a> { +impl Mmio for &DmaMmio<'_> { #[inline(always)] unsafe fn read_volatile(&self, src: *const T) -> T { // we only support 32-bit reads @@ -453,7 +453,7 @@ impl<'a> Mmio for &DmaMmio<'a> { } } -impl<'a> MmioMut for &DmaMmio<'a> { +impl MmioMut for &DmaMmio<'_> { #[inline(always)] unsafe fn write_volatile(&self, dst: *mut T, src: T) { // we only support 32-bit writes diff --git a/drivers/src/ecc384.rs b/drivers/src/ecc384.rs index b98b07efd5..3b33ab1197 100644 --- a/drivers/src/ecc384.rs +++ b/drivers/src/ecc384.rs @@ -59,7 +59,7 @@ impl From for Ecc384Seed<'_> { } } -/// ECC-384 Private Key output +/// ECC-384 Public Key output #[derive(Debug)] pub enum Ecc384PrivKeyOut<'a> { /// Array @@ -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 ecb93d91e3..fd1cbd0e0b 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) @@ -178,7 +177,7 @@ impl Hmac { trng: &mut Trng, mut tag: HmacTag<'a>, hmac_mode: HmacMode, - ) -> CaliptraResult { + ) -> CaliptraResult> { let hmac = self.hmac.regs_mut(); let mut csr_mode = false; @@ -636,7 +635,7 @@ pub struct HmacOp<'a> { csr_mode: bool, } -impl<'a> HmacOp<'a> { +impl HmacOp<'_> { /// /// Update the digest with data /// diff --git a/drivers/src/lib.rs b/drivers/src/lib.rs index 735dd642e0..6a0289012f 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; diff --git a/drivers/src/memory_layout.rs b/drivers/src/memory_layout.rs index 4e2a381fb0..4089132715 100644 --- a/drivers/src/memory_layout.rs +++ b/drivers/src/memory_layout.rs @@ -90,8 +90,8 @@ 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_ENVELOP_SIZE: u32 = 9 * 1024; -pub const DATA_SIZE: u32 = 95 * 1024; -pub const STACK_SIZE: u32 = 64 * 1024; +pub const DATA_SIZE: u32 = 91 * 1024; +pub const STACK_SIZE: u32 = 68 * 1024; pub const ROM_STACK_SIZE: u32 = 61 * 1024; pub const ESTACK_SIZE: u32 = 1024; pub const ROM_ESTACK_SIZE: u32 = 1024; diff --git a/drivers/src/printer.rs b/drivers/src/printer.rs index 4b6d86c97d..70c804a0f8 100644 --- a/drivers/src/printer.rs +++ b/drivers/src/printer.rs @@ -68,8 +68,20 @@ impl uDisplay for HexBytes<'_> { where W: uWrite + ?Sized, { - for byte in self.0.iter() { - ufmt::uwrite!(f, "{:02X}", *byte)?; + // Rust can't prove the indexes are correct in a ufmt uwrite! macro. + for &x in self.0.iter() { + let c = x >> 4; + if c < 10 { + f.write_char((c + b'0') as char)?; + } else { + f.write_char((c - 10 + b'A') as char)?; + } + let c = x & 0xf; + if c < 10 { + f.write_char((c + b'0') as char)?; + } else { + f.write_char((c - 10 + b'A') as char)?; + } } Ok(()) } 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 b766effae3..8667ac4243 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 5b031612ff..2d593d7fb2 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/Cargo.toml b/drivers/test-fw/Cargo.toml index 09d3c91085..bf9fda9fcf 100644 --- a/drivers/test-fw/Cargo.toml +++ b/drivers/test-fw/Cargo.toml @@ -28,6 +28,7 @@ fpga_realtime = [] # --profile=firmware \ # --features riscv riscv = ["caliptra-test-harness/riscv"] +runtime = [] [[bin]] name = "mbox_send_txn_drop" 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/fmc/src/flow/dice.rs b/fmc/src/flow/dice.rs index 0ba87eee8a..b2bd42c002 100644 --- a/fmc/src/flow/dice.rs +++ b/fmc/src/flow/dice.rs @@ -40,9 +40,11 @@ pub struct DiceInput { pub mldsa_auth_key_pair: MlDsaKeyPair, /// MLDSA Authority Serial Number + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_auth_sn: [u8; 64], /// MLDSA Authority Key Identifier + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_auth_key_id: [u8; 20], } @@ -62,11 +64,14 @@ pub struct DiceOutput { pub ecc_subj_key_id: [u8; 20], /// MLDSA Subject key pair for this layer + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_subj_key_pair: MlDsaKeyPair, /// MLDSA Subject Serial Number + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_subj_sn: [u8; 64], /// MLDSA Subject Key Identifier + #[allow(dead_code)] // [TODO][CAP2] remove when used pub mldsa_subj_key_id: [u8; 20], } diff --git a/hw-model/c-binding/src/caliptra_model.rs b/hw-model/c-binding/src/caliptra_model.rs index 1e08bb9d49..52aa2bedc8 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 75de3883d4..16c943bc47 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 }) } @@ -186,7 +185,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() @@ -226,7 +225,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(), @@ -269,7 +268,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(), @@ -468,7 +467,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 041f3d6945..7bf0e8b916 100644 --- a/hw-model/src/model_emulated.rs +++ b/hw-model/src/model_emulated.rs @@ -34,7 +34,7 @@ pub struct EmulatedApbBus<'a> { model: &'a mut ModelEmulated, } -impl<'a> Bus for EmulatedApbBus<'a> { +impl Bus for EmulatedApbBus<'_> { 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/tests/model_tests.rs b/hw-model/tests/model_tests.rs index 6b64bf3dcc..7fed1955aa 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 4303493438..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,33 +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("vendor_pk_hash", &HexSlice(&self.0.vendor_pk_hash)) - .field("fuse_ecc_revocation", &self.0.fuse_ecc_revocation) - .field("owner_pk_hash", &HexSlice(&self.0.owner_pk_hash)) - .field("firmware_svn", &HexSlice(&self.0.fw_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("fuse_mldsa_revocation", &self.0.fuse_mldsa_revocation) - .field("soc_stepping_id", &self.0.soc_stepping_id) - .field("fuse_pqc_key_type", &self.0.fuse_pqc_key_type) - .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]) { @@ -152,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 ef4db31c02..1e91154991 100644 --- a/image/elf/src/lib.rs +++ b/image/elf/src/lib.rs @@ -64,7 +64,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/image/gen/src/lib.rs b/image/gen/src/lib.rs index 26a254ad7c..1af69c7b18 100644 --- a/image/gen/src/lib.rs +++ b/image/gen/src/lib.rs @@ -96,7 +96,7 @@ pub trait ImageGeneratorCrypto { } /// Image Generator Vendor Configuration -#[derive(Default, Clone)] +#[derive(Default, Clone, Copy)] pub struct ImageGeneratorVendorConfig { pub ecc_key_count: u32, 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/src/flow/cold_reset/dice.rs b/rom/dev/src/flow/cold_reset/dice.rs index 98afca43cc..78612570d9 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 c6acf03914..aab8a0ca07 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. @@ -788,7 +788,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 e0ef18e281..68bc4956c1 100644 --- a/rom/dev/src/flow/cold_reset/mod.rs +++ b/rom/dev/src/flow/cold_reset/mod.rs @@ -108,7 +108,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::EccLdevid => { persistent_data.fht.ecc_ldevid_tbs_size = tbs.len() as u16; diff --git a/rom/dev/src/flow/fake.rs b/rom/dev/src/flow/fake.rs index ba60af9a8e..b6b996610d 100644 --- a/rom/dev/src/flow/fake.rs +++ b/rom/dev/src/flow/fake.rs @@ -216,7 +216,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.ecc_ldevid_tbs_size = u16::try_from(tbs.len()).unwrap(); - let Some(dst) = env.persistent_data.get_mut().ecc_ldevid_tbs.get_mut(..tbs.len()) else { + let Some(dst) = env + .persistent_data + .get_mut() + .ecc_ldevid_tbs + .get_mut(..tbs.len()) + else { return Err(CaliptraError::ROM_GLOBAL_UNSUPPORTED_LDEVID_TBS_SIZE); }; dst.copy_from_slice(tbs); @@ -236,7 +241,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.ecc_fmcalias_tbs_size = u16::try_from(tbs.len()).unwrap(); - let Some(dst) = env.persistent_data.get_mut().ecc_fmcalias_tbs.get_mut(..tbs.len()) else { + let Some(dst) = env + .persistent_data + .get_mut() + .ecc_fmcalias_tbs + .get_mut(..tbs.len()) + else { return Err(CaliptraError::ROM_GLOBAL_UNSUPPORTED_FMCALIAS_TBS_SIZE); }; dst.copy_from_slice(tbs); diff --git a/rom/dev/src/main.rs b/rom/dev/src/main.rs index fa121603a6..50dbeb9326 100644 --- a/rom/dev/src/main.rs +++ b/rom/dev/src/main.rs @@ -148,19 +148,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_env.rs b/rom/dev/src/rom_env.rs index 36df10406d..daf3f43836 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, Dma, 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, @@ -103,7 +99,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/tests/rom_integration_tests/test_image_validation.rs b/rom/dev/tests/rom_integration_tests/test_image_validation.rs index e38858de9d..1e2de7b649 100644 --- a/rom/dev/tests/rom_integration_tests/test_image_validation.rs +++ b/rom/dev/tests/rom_integration_tests/test_image_validation.rs @@ -136,7 +136,7 @@ fn test_invalid_manifest_size() { fn test_invalid_pqc_key_type() { let (mut hw, mut image_bundle) = helpers::build_hw_model_and_image_bundle(Fuses::default(), ImageOptions::default()); - for pqc_key_type in 0..std::u8::MAX { + for pqc_key_type in 0..u8::MAX { if pqc_key_type == FwVerificationPqcKeyType::LMS as u8 || pqc_key_type == FwVerificationPqcKeyType::MLDSA as u8 { @@ -496,7 +496,7 @@ fn test_preamble_vendor_ecc_pubkey_revocation() { }; let rom = caliptra_builder::build_firmware_rom(firmware::rom_from_env()).unwrap(); const LAST_KEY_IDX: u32 = VENDOR_ECC_MAX_KEY_COUNT - 1; - const VENDOR_CONFIG_LIST: [ImageGeneratorVendorConfig; VENDOR_ECC_MAX_KEY_COUNT as usize] = [ + static VENDOR_CONFIG_LIST: [ImageGeneratorVendorConfig; VENDOR_ECC_MAX_KEY_COUNT as usize] = [ VENDOR_CONFIG_KEY_0, VENDOR_CONFIG_KEY_1, VENDOR_CONFIG_KEY_2, diff --git a/rom/dev/tools/test-fmc/src/main.rs b/rom/dev/tools/test-fmc/src/main.rs index ac33d05485..b5d65ee10f 100644 --- a/rom/dev/tools/test-fmc/src/main.rs +++ b/rom/dev/tools/test-fmc/src/main.rs @@ -372,7 +372,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 774c6225a6..87f7592100 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, 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. @@ -137,6 +118,10 @@ impl AuthorizeAndStashCmd { .image_metadata_list .binary_search_by(|metadata| metadata.fw_id.cmp(&cmd_fw_id)) .ok() - .map(|index| &auth_manifest_image_metadata_col.image_metadata_list[index]) + .map(|index| { + auth_manifest_image_metadata_col + .image_metadata_list + .get(index) + })? } } 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 f67349e706..8c29cbfd75 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 3d46845164..491b9c0af3 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 b8ba9cc78d..d32b368cb7 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 5c3f398325..3df7b14764 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::recovery_flow::RecoveryFlow; use crate::{ dice, CptraDpeTypes, DisableAttestationCmd, DpeCrypto, DpePlatform, Mailbox, DPE_SUPPORT, @@ -24,35 +24,21 @@ use crate::{ }; use arrayvec::ArrayVec; -use caliptra_auth_man_types::AuthorizationManifest; -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::Dma; 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::axi_dma::AxiDmaReg; 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}; @@ -62,13 +48,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)] @@ -218,7 +203,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 @@ -232,13 +217,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 { @@ -259,7 +244,7 @@ impl Drivers { } } } else { - let pl0_pauser = drivers.persistent_data.get().manifest1.header.pl0_pauser; + 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()) { @@ -305,7 +290,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); @@ -343,13 +328,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); @@ -397,7 +382,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, @@ -602,7 +587,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..aa56b85815 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())?; @@ -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 b98344b917..e53585ec61 100644 --- a/runtime/src/get_idev_csr.rs +++ b/runtime/src/get_idev_csr.rs @@ -3,54 +3,44 @@ 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::{GetIdevCsrResp, MailboxResp}; use caliptra_error::{CaliptraError, CaliptraResult}; use caliptra_drivers::Ecc384IdevIdCsr; -use zerocopy::{AsBytes, 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_envelop.ecc_csr; - - match csr_persistent_mem.get_csr_len() { - Ecc384IdevIdCsr::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)) - } + pub(crate) fn execute(drivers: &mut Drivers, _cmd_args: &[u8]) -> CaliptraResult { + let csr_persistent_mem = &drivers.persistent_data.get().idevid_csr_envelop.ecc_csr; + + match csr_persistent_mem.get_csr_len() { + Ecc384IdevIdCsr::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 d7fb561b34..1ea04f429f 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 1c61188bc0..9bbd6ddc07 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..b17173e95c 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,11 @@ 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 _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 023be559aa..d672fc4ff7 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; @@ -40,7 +40,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; @@ -75,15 +74,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, @@ -264,7 +260,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 { @@ -343,5 +339,5 @@ pub fn handle_mailbox_commands(drivers: &mut Drivers) -> CaliptraResult<()> { cfi_assert!(!cmd_ready); } } - Ok(()) + // 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/recovery_flow.rs b/runtime/src/recovery_flow.rs index 125e77cbc0..e1845266aa 100644 --- a/runtime/src/recovery_flow.rs +++ b/runtime/src/recovery_flow.rs @@ -13,20 +13,11 @@ Abstract: --*/ use crate::Drivers; -use caliptra_auth_man_types::{ - AuthManifestImageMetadataCollection, AuthManifestPreamble, AuthorizationManifest, - AUTH_MANIFEST_PREAMBLE_SIZE, -}; -use caliptra_cfi_derive_git::{cfi_impl_fn, cfi_mod_fn}; -use caliptra_drivers::{AxiAddr, Dma, DmaReadTarget, DmaReadTransaction, DmaRecovery}; +use caliptra_auth_man_types::AuthorizationManifest; +use caliptra_cfi_derive_git::cfi_impl_fn; +use caliptra_drivers::DmaRecovery; use caliptra_kat::{CaliptraError, CaliptraResult}; -use caliptra_registers::i3ccsr::RegisterBlock; -use core::{ - any::TypeId, - cell::{Cell, RefCell}, -}; -use ureg::{Mmio, MmioMut, Uint, UintType}; -use zerocopy::{AsBytes, FromBytes}; +use zerocopy::FromBytes; pub enum RecoveryFlow {} @@ -43,7 +34,9 @@ impl RecoveryFlow { // // download SoC manifest let _soc_size_bytes = dma_recovery.download_image_to_mbox(SOC_MANIFEST_INDEX)?; - let Some(manifest) = AuthorizationManifest::read_from_prefix(drivers.mbox.raw_mailbox_contents()) else { + let Some(manifest) = + AuthorizationManifest::read_from_prefix(drivers.mbox.raw_mailbox_contents()) + else { return Err(CaliptraError::IMAGE_VERIFIER_ERR_MANIFEST_SIZE_MISMATCH); }; // [TODO][CAP2]: authenticate SoC manifest using keys available through Caliptra Image diff --git a/runtime/src/set_auth_manifest.rs b/runtime/src/set_auth_manifest.rs index 4bb5eae26c..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, 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..7c1d69f79d 100644 --- a/runtime/test-fw/Cargo.toml +++ b/runtime/test-fw/Cargo.toml @@ -6,6 +6,7 @@ version = "0.1.0" edition = "2021" [features] +std = [] runtime = ["caliptra-test-harness/runtime"] riscv = [ "caliptra-cpu/riscv", 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_certs.rs b/runtime/tests/runtime_integration_tests/test_certs.rs index e9ceb24224..186823d4a8 100644 --- a/runtime/tests/runtime_integration_tests/test_certs.rs +++ b/runtime/tests/runtime_integration_tests/test_certs.rs @@ -489,8 +489,8 @@ pub fn test_all_measurement_apis() { DpeResult::Success, ); let Some(Response::DeriveContext(_derive_ctx_resp)) = resp else { - panic!("Wrong response type!"); - }; + panic!("Wrong response type!"); + }; // Get DPE cert let dpe_cert_resp = get_dpe_leaf_cert(&mut hw); diff --git a/runtime/tests/runtime_integration_tests/test_pauser_privilege_levels.rs b/runtime/tests/runtime_integration_tests/test_pauser_privilege_levels.rs index b06e1c7f26..d705987dc8 100644 --- a/runtime/tests/runtime_integration_tests/test_pauser_privilege_levels.rs +++ b/runtime/tests/runtime_integration_tests/test_pauser_privilege_levels.rs @@ -132,8 +132,8 @@ fn test_pl1_derive_context_dpe_context_thresholds() { DpeResult::Success, ); let Some(Response::InitCtx(init_ctx_resp)) = resp else { - panic!("Wrong response type!"); - }; + panic!("Wrong response type!"); + }; let mut handle = init_ctx_resp.handle; // Call DeriveContext with PL1 enough times to breach the threshold on the last iteration. @@ -170,8 +170,8 @@ fn test_pl1_derive_context_dpe_context_thresholds() { DpeResult::Success, ); let Some(Response::DeriveContext(derive_context_resp)) = resp else { - panic!("Wrong response type!"); - }; + panic!("Wrong response type!"); + }; handle = derive_context_resp.handle; } } @@ -258,8 +258,8 @@ fn test_pl1_init_ctx_dpe_context_thresholds() { DpeResult::Success, ); let Some(Response::InitCtx(_)) = resp else { - panic!("Wrong response type!"); - }; + panic!("Wrong response type!"); + }; } } } @@ -440,8 +440,8 @@ fn test_derive_context_cannot_be_called_from_pl1_if_changes_locality_to_pl0() { DpeResult::Success, ); let Some(Response::InitCtx(init_ctx_resp)) = resp else { - panic!("Wrong response type!"); - }; + panic!("Wrong response type!"); + }; let derive_context_cmd = DeriveContextCmd { handle: init_ctx_resp.handle, 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..c6964b41f0 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.84" 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 36d32df6c5..bd9c8d4354 100644 --- a/sw-emulator/app/src/main.rs +++ b/sw-emulator/app/src/main.rs @@ -453,7 +453,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 b4aae462c2..87ea129edf 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/csrng/health_test.rs b/sw-emulator/lib/periph/src/csrng/health_test.rs index 241f0c3358..c13be50814 100644 --- a/sw-emulator/lib/periph/src/csrng/health_test.rs +++ b/sw-emulator/lib/periph/src/csrng/health_test.rs @@ -110,7 +110,7 @@ impl RepetitionCountTester { _ => unreachable!("bit {i} of nibble={nibble} should only be 0 or 1"), }; - let is_repeat = self.prev_nibble[i].map_or(false, |prev_bit| prev_bit == bit); + let is_repeat = self.prev_nibble[i] == Some(bit); if is_repeat { self.repetition_count[i] += 1; 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 7ed88709a1..5315b14fe4 100644 --- a/sw-emulator/lib/periph/src/hmac.rs +++ b/sw-emulator/lib/periph/src/hmac.rs @@ -832,7 +832,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 49d1ecaf6f..3de8f155e2 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,7 @@ pub struct MailboxRegs { /// Trigger interrupt irq: bool, - /// + /// Timer timer: Timer, } @@ -490,8 +489,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 +508,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 ba9cb057fc..10d16f00ef 100644 --- a/sw-emulator/lib/periph/src/root_bus.rs +++ b/sw-emulator/lib/periph/src/root_bus.rs @@ -67,7 +67,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 427e3ee152..5b31c16b22 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 b1f2cf4747..1ce1bd4864 100644 --- a/test/tests/caliptra_integration_tests/jtag_test.rs +++ b/test/tests/caliptra_integration_tests/jtag_test.rs @@ -125,6 +125,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 73826d576c..d28abe7b0e 100755 --- a/test/tests/fips_test_suite/common.rs +++ b/test/tests/fips_test_suite/common.rs @@ -130,7 +130,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")] @@ -161,7 +161,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(); @@ -223,7 +223,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/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_fw_svn: &'a [u8; 1usize], pub tcb_info_fw_svn_fuses: &'a [u8; 1usize], } -impl<'a> FmcAliasCertTbsEcc384Params<'a> { +impl FmcAliasCertTbsEcc384Params<'_> { 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/fmc_alias_cert_tbs_mldsa_87.rs b/x509/build/fmc_alias_cert_tbs_mldsa_87.rs index 40287bca7a..cff22eba01 100644 --- a/x509/build/fmc_alias_cert_tbs_mldsa_87.rs +++ b/x509/build/fmc_alias_cert_tbs_mldsa_87.rs @@ -5,9 +5,7 @@ Licensed under the Apache-2.0 license. Abstract: --"] - // TODO generate when x509 libraries support MLDSA - pub struct FmcAliasCertTbsMlDsa87Params<'a> { pub public_key: &'a [u8; 2592usize], pub subject_sn: &'a [u8; 64usize], @@ -26,7 +24,7 @@ pub struct FmcAliasCertTbsMlDsa87Params<'a> { } #[allow(dead_code)] -impl<'a> FmcAliasCertTbsMlDsa87Params<'a> { +impl FmcAliasCertTbsMlDsa87Params<'_> { pub const PUBLIC_KEY_LEN: usize = 2592usize; pub const SUBJECT_SN_LEN: usize = 64usize; pub const ISSUER_SN_LEN: usize = 64usize; diff --git a/x509/build/init_dev_id_csr_tbs_ecc_384.rs b/x509/build/init_dev_id_csr_tbs_ecc_384.rs index 04b0542f8e..baad0612d4 100644 --- a/x509/build/init_dev_id_csr_tbs_ecc_384.rs +++ b/x509/build/init_dev_id_csr_tbs_ecc_384.rs @@ -12,7 +12,7 @@ pub struct InitDevIdCsrTbsEcc384Params<'a> { pub public_key: &'a [u8; 97usize], pub subject_sn: &'a [u8; 64usize], } -impl<'a> InitDevIdCsrTbsEcc384Params<'a> { +impl InitDevIdCsrTbsEcc384Params<'_> { 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/init_dev_id_csr_tbs_mldsa_87.rs b/x509/build/init_dev_id_csr_tbs_mldsa_87.rs index 3e0c2b0708..48c93b9244 100644 --- a/x509/build/init_dev_id_csr_tbs_mldsa_87.rs +++ b/x509/build/init_dev_id_csr_tbs_mldsa_87.rs @@ -14,7 +14,7 @@ pub struct InitDevIdCsrTbsMlDsa87Params<'a> { } #[allow(dead_code)] -impl<'a> InitDevIdCsrTbsMlDsa87Params<'a> { +impl InitDevIdCsrTbsMlDsa87Params<'_> { pub const UEID_LEN: usize = 17usize; pub const PUBLIC_KEY_LEN: usize = 2592usize; pub const SUBJECT_SN_LEN: usize = 64usize; diff --git a/x509/build/local_dev_id_cert_tbs_ecc_384.rs b/x509/build/local_dev_id_cert_tbs_ecc_384.rs index cb4622260c..8bb540b008 100644 --- a/x509/build/local_dev_id_cert_tbs_ecc_384.rs +++ b/x509/build/local_dev_id_cert_tbs_ecc_384.rs @@ -18,7 +18,7 @@ pub struct LocalDevIdCertTbsEcc384Params<'a> { pub not_before: &'a [u8; 15usize], pub not_after: &'a [u8; 15usize], } -impl<'a> LocalDevIdCertTbsEcc384Params<'a> { +impl LocalDevIdCertTbsEcc384Params<'_> { 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/local_dev_id_cert_tbs_mldsa_87.rs b/x509/build/local_dev_id_cert_tbs_mldsa_87.rs index 7645b1b535..f34b5bad54 100644 --- a/x509/build/local_dev_id_cert_tbs_mldsa_87.rs +++ b/x509/build/local_dev_id_cert_tbs_mldsa_87.rs @@ -7,9 +7,7 @@ Abstract: Regenerate the template by building caliptra-x509-build with the generate-templates flag. --"] - // TODO generate when x509 libraries support MLDSA - #[allow(dead_code)] pub struct LocalDevIdCertTbsMlDsa87Params<'a> { pub public_key: &'a [u8; 2592usize], @@ -23,7 +21,7 @@ pub struct LocalDevIdCertTbsMlDsa87Params<'a> { pub not_after: &'a [u8; 15usize], } #[allow(dead_code)] -impl<'a> LocalDevIdCertTbsMlDsa87Params<'a> { +impl LocalDevIdCertTbsMlDsa87Params<'_> { 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_ecc_384.rs b/x509/build/rt_alias_cert_tbs_ecc_384.rs index 84a23d1905..e896d1f01c 100644 --- a/x509/build/rt_alias_cert_tbs_ecc_384.rs +++ b/x509/build/rt_alias_cert_tbs_ecc_384.rs @@ -20,7 +20,7 @@ pub struct RtAliasCertTbsEcc384Params<'a> { pub not_after: &'a [u8; 15usize], pub tcb_info_fw_svn: &'a [u8; 1usize], } -impl<'a> RtAliasCertTbsEcc384Params<'a> { +impl RtAliasCertTbsEcc384Params<'_> { 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_mldsa_87.rs b/x509/build/rt_alias_cert_tbs_mldsa_87.rs index bf944e0fc2..f3585bb132 100644 --- a/x509/build/rt_alias_cert_tbs_mldsa_87.rs +++ b/x509/build/rt_alias_cert_tbs_mldsa_87.rs @@ -7,9 +7,7 @@ Abstract: Regenerate the template by building caliptra-x509-build with the generate-templates flag. --"] - // TODO generate when x509 libraries support MLDSA - #[allow(dead_code)] pub struct RtAliasCertTbsMlDsa87Params<'a> { pub public_key: &'a [u8; 2592usize], @@ -25,7 +23,7 @@ pub struct RtAliasCertTbsMlDsa87Params<'a> { pub tcb_info_rt_svn: &'a [u8; 1usize], } #[allow(dead_code)] -impl<'a> RtAliasCertTbsMlDsa87Params<'a> { +impl RtAliasCertTbsMlDsa87Params<'_> { pub const PUBLIC_KEY_LEN: usize = 2592usize; 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 52759c50bc..e86f1ff4a1 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<4641> for Mldsa87Signature { fn to_der(&self, buf: &mut [u8; 4641]) -> 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