diff --git a/Cargo.lock b/Cargo.lock index a5d02c3c4..cd1eed484 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,12 +4,12 @@ version = 4 [[package]] name = "aead" -version = "0.5.2" +version = "0.6.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +checksum = "6b657e772794c6b04730ea897b66a058ccd866c16d1967da05eeeecec39043fe" dependencies = [ "crypto-common", - "generic-array", + "inout", ] [[package]] @@ -86,6 +86,78 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "ariel-os-debug" +version = "0.2.0" +source = "git+https://github.com/ariel-os/ariel-os.git?tag=v0.2.1#1d9062d957168d8ac0a3c9536123480114186163" +dependencies = [ + "ariel-os-debug-log", + "ariel-os-utils", + "const-str", +] + +[[package]] +name = "ariel-os-debug-log" +version = "0.2.0" +source = "git+https://github.com/ariel-os/ariel-os.git?tag=v0.2.1#1d9062d957168d8ac0a3c9536123480114186163" +dependencies = [ + "featurecomb", +] + +[[package]] +name = "ariel-os-lock" +version = "0.1.0" +source = "git+https://github.com/SimonIT/ariel-os-lock#abceb97f3fb37a3e6dfcdc03fe7fb93015981ef0" +dependencies = [ + "ariel-os-threads", + "lock_api", +] + +[[package]] +name = "ariel-os-runqueue" +version = "0.2.0" +source = "git+https://github.com/ariel-os/ariel-os.git?tag=v0.2.1#1d9062d957168d8ac0a3c9536123480114186163" +dependencies = [ + "hax-lib", +] + +[[package]] +name = "ariel-os-threads" +version = "0.2.0" +source = "git+https://github.com/ariel-os/ariel-os.git?tag=v0.2.1#1d9062d957168d8ac0a3c9536123480114186163" +dependencies = [ + "ariel-os-debug", + "ariel-os-runqueue", + "ariel-os-utils", + "cfg-if", + "cortex-m", + "cortex-m-rt", + "cortex-m-semihosting", + "critical-section", + "esp-hal", + "linkme", + "panic-semihosting", + "paste", + "static_cell", + "xtensa-lx-rt", +] + +[[package]] +name = "ariel-os-utils" +version = "0.2.0" +source = "git+https://github.com/ariel-os/ariel-os.git?tag=v0.2.1#1d9062d957168d8ac0a3c9536123480114186163" +dependencies = [ + "const-str", + "const_panic", + "konst", +] + [[package]] name = "arrayvec" version = "0.7.6" @@ -98,12 +170,48 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" +[[package]] +name = "bare-metal" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5deb64efa5bd81e31fcd1938615a6d98c82eafcbcd787162b6f63b91d6bac5b3" +dependencies = [ + "rustc_version 0.2.3", +] + [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "basic-toml" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba62675e8242a4c4e806d12f11d136e626e6c8361d6b829310732241652a178a" +dependencies = [ + "serde", +] + +[[package]] +name = "bitfield" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" + +[[package]] +name = "bitfield" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f798d2d157e547aa99aab0967df39edd0b70307312b6f8bd2848e6abe40896e0" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + [[package]] name = "bitflags" version = "2.11.1" @@ -112,20 +220,20 @@ checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" [[package]] name = "blake2" -version = "0.10.6" +version = "0.11.0-rc.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +checksum = "061f1a09225e328e1ffbb378d2d49923c0ca5fee19fb5ac1cc9c1e9d52b93690" dependencies = [ "digest", ] [[package]] name = "block-buffer" -version = "0.10.4" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "cdd35008169921d80bc60d3d0ab416eecb028c4cd653352907921d95084790be" dependencies = [ - "generic-array", + "hybrid-array", ] [[package]] @@ -133,10 +241,14 @@ name = "boringtun" version = "0.7.1" dependencies = [ "aead", + "ariel-os-lock", "base64", "blake2", "chacha20poly1305", "criterion", + "defmt 1.0.1", + "embassy-embedded-time", + "embedded-time 0.13.0 (git+https://github.com/SimonIT/embedded-time.git?branch=update-defmt)", "etherparse", "hex", "hmac", @@ -144,13 +256,15 @@ dependencies = [ "ip_network_table", "jni", "libc", - "mock_instant", + "lock_api", "nix", + "once_cell", "parking_lot", "portable-atomic", - "rand_core", + "rand_core 0.9.5", "ring", "socket2", + "std-embedded-time", "thiserror 1.0.69", "tracing", "tracing-subscriber", @@ -182,6 +296,18 @@ version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" +[[package]] +name = "bytemuck" +version = "1.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.11.1" @@ -224,26 +350,34 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chacha20" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" +checksum = "6f8d983286843e49675a4b7a2d174efe136dc93a18d69130dd18198a6c167601" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.3.0", ] [[package]] name = "chacha20poly1305" -version = "0.10.1" +version = "0.11.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" +checksum = "1c9ed179664f12fd6f155f6dd632edf5f3806d48c228c67ff78366f2a0eb6b5e" dependencies = [ "aead", "chacha20", "cipher", "poly1305", - "zeroize", +] + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "num-traits", ] [[package]] @@ -275,13 +409,13 @@ dependencies = [ [[package]] name = "cipher" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "e34d8227fe1ba289043aeb13792056ff80fd6de1a9f49137a5f499de8e8c78ea" dependencies = [ + "block-buffer", "crypto-common", "inout", - "zeroize", ] [[package]] @@ -311,6 +445,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" +[[package]] +name = "cmov" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f88a43d011fc4a6876cb7344703e297c71dda42494fee094d5f7c76bf13f746" + [[package]] name = "colorchoice" version = "1.0.5" @@ -327,6 +467,62 @@ dependencies = [ "memchr", ] +[[package]] +name = "const-str" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "451d0640545a0553814b4c646eb549343561618838e9b42495f466131fe3ad49" + +[[package]] +name = "const_panic" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e262cdaac42494e3ae34c43969f9cdeb7da178bdb4b66fa6a1ea2edb4c8ae652" +dependencies = [ + "typewit", +] + +[[package]] +name = "cortex-m" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ec610d8f49840a5b376c69663b6369e71f4b34484b9b2eb29fb918d92516cb9" +dependencies = [ + "bare-metal", + "bitfield 0.13.2", + "embedded-hal 0.2.7", + "volatile-register", +] + +[[package]] +name = "cortex-m-rt" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee84e813d593101b1723e13ec38b6ab6abbdbaaa4546553f5395ed274079ddb1" +dependencies = [ + "cortex-m-rt-macros", +] + +[[package]] +name = "cortex-m-rt-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f6f3e36f203cfedbc78b357fb28730aa2c6dc1ab060ee5c2405e843988d3c7" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cortex-m-semihosting" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c23234600452033cc77e4b761e740e02d2c4168e11dbf36ab14a0f58973592b0" +dependencies = [ + "cortex-m", +] + [[package]] name = "cpufeatures" version = "0.2.17" @@ -336,6 +532,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "criterion" version = "0.8.2" @@ -371,6 +576,12 @@ dependencies = [ "itertools", ] +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + [[package]] name = "crossbeam-channel" version = "0.5.15" @@ -413,26 +624,35 @@ checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.7" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "77727bb15fa921304124b128af125e7e3b968275d1b108b379190264f4423710" dependencies = [ - "generic-array", - "rand_core", - "typenum", + "getrandom 0.4.2", + "hybrid-array", + "rand_core 0.10.1", +] + +[[package]] +name = "ctutils" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +dependencies = [ + "cmov", ] [[package]] name = "curve25519-dalek" -version = "4.1.3" +version = "5.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +checksum = "6f9200d1d13637f15a6acb71e758f64624048d85b31a5fdbfd8eca1e2687d0b7" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "curve25519-dalek-derive", "fiat-crypto", - "rustc_version", + "rustc_version 0.4.1", "subtle", "zeroize", ] @@ -445,7 +665,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -459,174 +679,970 @@ dependencies = [ ] [[package]] -name = "deranged" -version = "0.5.8" +name = "darling" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "powerfmt", + "darling_core 0.20.11", + "darling_macro 0.20.11", ] [[package]] -name = "digest" -version = "0.10.7" +name = "darling" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "block-buffer", - "crypto-common", - "subtle", + "darling_core 0.21.3", + "darling_macro 0.21.3", ] [[package]] -name = "either" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" - -[[package]] -name = "etherparse" -version = "0.13.0" +name = "darling" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827292ea592108849932ad8e30218f8b1f21c0dfd0696698a18b5d0aed62d990" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ - "arrayvec", + "darling_core 0.23.0", + "darling_macro 0.23.0", ] [[package]] -name = "fiat-crypto" -version = "0.2.9" +name = "darling_core" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] [[package]] -name = "find-msvc-tools" -version = "0.1.9" +name = "darling_core" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "syn 2.0.117", +] [[package]] -name = "futures-core" -version = "0.3.32" +name = "darling_core" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.117", +] [[package]] -name = "futures-task" -version = "0.3.32" +name = "darling_macro" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.117", +] [[package]] -name = "futures-util" -version = "0.3.32" +name = "darling_macro" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ - "futures-core", - "futures-task", - "pin-project-lite", - "slab", + "darling_core 0.21.3", + "quote", + "syn 2.0.117", ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "darling_macro" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ - "typenum", - "version_check", + "darling_core 0.23.0", + "quote", + "syn 2.0.117", ] [[package]] -name = "getrandom" -version = "0.2.17" +name = "defmt" +version = "0.3.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +checksum = "f0963443817029b2024136fc4dd07a5107eb8f977eaf18fcd1fdeb11306b64ad" dependencies = [ - "cfg-if", - "libc", - "wasi", + "defmt 1.0.1", ] [[package]] -name = "half" -version = "2.7.1" +name = "defmt" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +checksum = "548d977b6da32fa1d1fda2876453da1e7df63ad0304c8b3dae4dbe7b96f39b78" dependencies = [ - "cfg-if", - "crunchy", - "zerocopy", + "bitflags 1.3.2", + "defmt-macros", ] [[package]] -name = "hex" -version = "0.4.3" +name = "defmt-macros" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "3d4fc12a85bcf441cfe44344c4b72d58493178ce635338a3f3b78943aceb258e" +dependencies = [ + "defmt-parser", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.117", +] [[package]] -name = "hmac" -version = "0.12.1" +name = "defmt-parser" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +checksum = "10d60334b3b2e7c9d91ef8150abfb6fa4c1c39ebbcf4a81c2e346aad939fee3e" dependencies = [ - "digest", + "thiserror 2.0.18", ] [[package]] -name = "inout" -version = "0.1.4" +name = "delegate" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +checksum = "780eb241654bf097afb00fc5f054a09b687dad862e485fdcf8399bb056565370" dependencies = [ - "generic-array", + "proc-macro2", + "quote", + "syn 2.0.117", ] [[package]] -name = "ip_network" -version = "0.4.1" +name = "deranged" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", +] [[package]] -name = "ip_network_table" -version = "0.2.0" +name = "digest" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4099b7cfc5c5e2fe8c5edf3f6f7adf7a714c9cc697534f63a5a5da30397cb2c0" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" dependencies = [ - "ip_network", - "ip_network_table-deps-treebitmap", + "block-buffer", + "crypto-common", + "ctutils", ] [[package]] -name = "ip_network_table-deps-treebitmap" -version = "0.5.0" +name = "document-features" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e537132deb99c0eb4b752f0346b6a836200eaaa3516dd7e5514b63930a09e5d" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs 1.0.0", +] [[package]] -name = "is_terminal_polyfill" -version = "1.70.2" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] -name = "itertools" -version = "0.13.0" +name = "embassy-embedded-hal" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "8c62a3bf127e03832fb97d8b01a058775e617653bc89e2a12c256485a7fb54c1" dependencies = [ - "either", + "embassy-embedded-hal 0.4.0", + "embassy-futures", + "embassy-sync 0.6.2", + "embassy-time", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", ] [[package]] -name = "itoa" -version = "1.0.18" +name = "embassy-embedded-hal" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" +checksum = "d1611b7a7ab5d1fbed84c338df26d56fd9bded58006ebb029075112ed2c5e039" +dependencies = [ + "embassy-futures", + "embassy-hal-internal", + "embassy-sync 0.7.2", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-storage", + "embedded-storage-async", + "nb 1.1.0", +] + +[[package]] +name = "embassy-embedded-time" +version = "0.1.0" +source = "git+https://github.com/SimonIT/embassy-embedded-time.git?branch=release%2Fv0.13.0#28038a2be0413b8cc59acbf3271dcb0900e0e750" +dependencies = [ + "defmt 1.0.1", + "embassy-time", + "embedded-time 0.13.0 (git+https://github.com/SimonIT/embedded-time.git?branch=update-defmt)", +] + +[[package]] +name = "embassy-futures" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc2d050bdc5c21e0862a89256ed8029ae6c290a93aecefc73084b3002cdebb01" + +[[package]] +name = "embassy-hal-internal" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95285007a91b619dc9f26ea8f55452aa6c60f7115a4edc05085cd2bd3127cd7a" +dependencies = [ + "num-traits", +] + +[[package]] +name = "embassy-sync" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d2c8cdff05a7a51ba0087489ea44b0b1d97a296ca6b1d6d1a33ea7423d34049" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-sink", + "futures-util", + "heapless", +] + +[[package]] +name = "embassy-sync" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73974a3edbd0bd286759b3d483540f0ebef705919a5f56f4fc7709066f71689b" +dependencies = [ + "cfg-if", + "critical-section", + "embedded-io-async", + "futures-core", + "futures-sink", + "heapless", +] + +[[package]] +name = "embassy-time" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f820157f198ada183ad62e0a66f554c610cdcd1a9f27d4b316358103ced7a1f8" +dependencies = [ + "cfg-if", + "critical-section", + "defmt 0.3.100", + "document-features", + "embassy-time-driver", + "embedded-hal 0.2.7", + "embedded-hal 1.0.0", + "embedded-hal-async", + "futures-util", +] + +[[package]] +name = "embassy-time-driver" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee71af1b3a0deaa53eaf2d39252f83504c853646e472400b763060389b9fcc9" +dependencies = [ + "document-features", +] + +[[package]] +name = "embassy-usb-driver" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "340c5ce591ef58c6449e43f51d2c53efe1bf0bb6a40cbf80afa0d259c7d52c76" +dependencies = [ + "embedded-io-async", +] + +[[package]] +name = "embassy-usb-synopsys-otg" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08e753b23799329780c7ac434264026d0422044d6649ed70a73441b14a6436d7" +dependencies = [ + "critical-section", + "embassy-sync 0.6.2", + "embassy-usb-driver", +] + +[[package]] +name = "embedded-can" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9d2e857f87ac832df68fa498d18ddc679175cf3d2e4aa893988e5601baf9438" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "embedded-hal" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35949884794ad573cf46071e41c9b60efb0cb311e3ca01f7af807af1debc66ff" +dependencies = [ + "nb 0.1.3", + "void", +] + +[[package]] +name = "embedded-hal" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "361a90feb7004eca4019fb28352a9465666b24f840f5c3cddf0ff13920590b89" + +[[package]] +name = "embedded-hal-async" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4c685bbef7fe13c3c6dd4da26841ed3980ef33e841cddfa15ce8a8fb3f1884" +dependencies = [ + "embedded-hal 1.0.0", +] + +[[package]] +name = "embedded-hal-nb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba4268c14288c828995299e59b12babdbe170f6c6d73731af1b4648142e8605" +dependencies = [ + "embedded-hal 1.0.0", + "nb 1.1.0", +] + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "embedded-io-async" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ff09972d4073aa8c299395be75161d582e7629cd663171d62af73c8d50dba3f" +dependencies = [ + "embedded-io", +] + +[[package]] +name = "embedded-storage" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a21dea9854beb860f3062d10228ce9b976da520a73474aed3171ec276bc0c032" + +[[package]] +name = "embedded-storage-async" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1763775e2323b7d5f0aa6090657f5e21cfa02ede71f5dc40eead06d64dcd15cc" +dependencies = [ + "embedded-storage", +] + +[[package]] +name = "embedded-time" +version = "0.13.0" +source = "git+https://github.com/FluenTech/embedded-time.git?branch=release%2Fv0.13.0#e313ce96f5fa19e15266fefe33e86f0f3163764e" +dependencies = [ + "num", +] + +[[package]] +name = "embedded-time" +version = "0.13.0" +source = "git+https://github.com/SimonIT/embedded-time.git?branch=update-defmt#7f182813748a6a88ce5f663e8340650262025af6" +dependencies = [ + "defmt 1.0.1", + "num", +] + +[[package]] +name = "enum-as-inner" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "enumset" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25b07a8dfbbbfc0064c0a6bdf9edcf966de6b1c33ce344bdeca3b41615452634" +dependencies = [ + "enumset_derive", +] + +[[package]] +name = "enumset_derive" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43e744e4ea338060faee68ed933e46e722fb7f3617e722a5772d7e856d8b3ce" +dependencies = [ + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "esp-build" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aa1c8f9954c9506699cf1ca10a2adcc226ff10b6ae3cb9e875cf2c6a0b9a372" +dependencies = [ + "quote", + "syn 2.0.117", + "termcolor", +] + +[[package]] +name = "esp-config" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "158dba334d3a2acd8d93873c0ae723ca1037cc78eefe5d6b4c5919b0ca28e38e" +dependencies = [ + "document-features", +] + +[[package]] +name = "esp-hal" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a573175c540fd1d21a9cf07b0dee286b5a8f4cfde4b35da0f4f4657de7942c45" +dependencies = [ + "basic-toml", + "bitfield 0.17.0", + "bitflags 2.11.1", + "bytemuck", + "cfg-if", + "chrono", + "critical-section", + "delegate", + "document-features", + "embassy-embedded-hal 0.3.2", + "embassy-futures", + "embassy-sync 0.6.2", + "embassy-usb-driver", + "embassy-usb-synopsys-otg", + "embedded-can", + "embedded-hal 1.0.0", + "embedded-hal-async", + "embedded-hal-nb", + "embedded-io", + "embedded-io-async", + "enumset", + "esp-build", + "esp-config", + "esp-hal-procmacros", + "esp-metadata", + "esp-riscv-rt", + "esp-synopsys-usb-otg", + "esp32", + "esp32c3", + "esp32c6", + "esp32s3", + "fugit", + "instability", + "nb 1.1.0", + "paste", + "portable-atomic", + "rand_core 0.6.4", + "riscv", + "serde", + "strum", + "ufmt-write", + "usb-device", + "void", + "xtensa-lx", + "xtensa-lx-rt", +] + +[[package]] +name = "esp-hal-procmacros" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a3297005c2b31cd00e2ba50037edc9bddf99da3afe1c97a2d1b0165a312eab" +dependencies = [ + "darling 0.20.11", + "document-features", + "litrs 0.4.2", + "object", + "proc-macro-crate", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "esp-metadata" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb15c17e50f4cccb0d88305c19eae2d5533d750f0a05b6a05f1c99864974758e" +dependencies = [ + "anyhow", + "basic-toml", + "serde", + "strum", +] + +[[package]] +name = "esp-riscv-rt" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94aca65db6157aa5f42d9df6595b21462f28207ca4230b799aa3620352ef6a72" +dependencies = [ + "document-features", + "riscv", + "riscv-rt-macros", +] + +[[package]] +name = "esp-synopsys-usb-otg" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8938451cb19032f13365328ea66ab38c8d16deecdf322067442297110eb74468" +dependencies = [ + "critical-section", + "embedded-hal 0.2.7", + "ral-registers", + "usb-device", + "vcell", +] + +[[package]] +name = "esp32" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d3bff1d268a4b8d34b494c0e88466cd59a827bb330189773db299ff525ea13" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c3" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61655d48e45039dfac5ae769581fb50ea7f61dea3227b4b744a1a900d03fbbd4" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32c6" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd38a7771b65cb640cc4a79324a6301ba4ac3bf2987caca5d3aa34492238fdb9" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "esp32s3" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f0ab39d5ae3b61b3a83f5616a03220a7dc9c4d6e4ed16d2da73d50bf8d798d7" +dependencies = [ + "critical-section", + "vcell", +] + +[[package]] +name = "etherparse" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "827292ea592108849932ad8e30218f8b1f21c0dfd0696698a18b5d0aed62d990" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "featurecomb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f153f6b80e9a75303a62296e48cb4b908030c6aaa3362872e29e8999132a1c4d" +dependencies = [ + "featurecomb-schema", + "proc-macro2", + "quote", + "serde", + "toml", +] + +[[package]] +name = "featurecomb-schema" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c486f63dbdcad99caa45f900ee8b51c8213483e7f53ff8992aa2b0c4d971362" +dependencies = [ + "indexmap", + "serde", +] + +[[package]] +name = "fiat-crypto" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cd1e32ddd350061ae6edb1b082d7c54915b5c672c389143b9a63403a109f24" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "fugit" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e639847d312d9a82d2e75b0edcc1e934efcc64e6cb7aa94f0b1fbec0bc231d6" +dependencies = [ + "gcd", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", + "wasip2", + "wasip3", +] + +[[package]] +name = "half" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b" +dependencies = [ + "cfg-if", + "crunchy", + "zerocopy", +] + +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f467dd6dccf739c208452f8014c75c18bb8301b050ad1cfb27153803edb0f51" + +[[package]] +name = "hax-lib" +version = "0.1.0-pre.1" +source = "git+https://github.com/hacspec/hax?rev=cc29a3f8c0eee80a1682be78cb3b0447a0257d5b#cc29a3f8c0eee80a1682be78cb3b0447a0257d5b" +dependencies = [ + "hax-lib-macros", + "num-bigint", + "num-traits", +] + +[[package]] +name = "hax-lib-macros" +version = "0.1.0-pre.1" +source = "git+https://github.com/hacspec/hax?rev=cc29a3f8c0eee80a1682be78cb3b0447a0257d5b#cc29a3f8c0eee80a1682be78cb3b0447a0257d5b" +dependencies = [ + "hax-lib-macros-types", + "paste", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "hax-lib-macros-types" +version = "0.1.0-pre.1" +source = "git+https://github.com/hacspec/hax?rev=cc29a3f8c0eee80a1682be78cb3b0447a0257d5b#cc29a3f8c0eee80a1682be78cb3b0447a0257d5b" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest", +] + +[[package]] +name = "hybrid-array" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d46837a0ed51fe95bd3b05de33cd64a1ee88fc797477ca48446872504507c5" +dependencies = [ + "typenum", +] + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.0", + "serde", + "serde_core", +] + +[[package]] +name = "indoc" +version = "2.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706" +dependencies = [ + "rustversion", +] + +[[package]] +name = "inout" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "instability" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb2d60ef19920a3a9193c3e371f726ec1dafc045dac788d0fb3704272458971" +dependencies = [ + "darling 0.23.0", + "indoc", + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "ip_network" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2f047c0a98b2f299aa5d6d7088443570faae494e9ae1305e48be000c9e0eb1" + +[[package]] +name = "ip_network_table" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4099b7cfc5c5e2fe8c5edf3f6f7adf7a714c9cc697534f63a5a5da30397cb2c0" +dependencies = [ + "ip_network", + "ip_network_table-deps-treebitmap", +] + +[[package]] +name = "ip_network_table-deps-treebitmap" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e537132deb99c0eb4b752f0346b6a836200eaaa3516dd7e5514b63930a09e5d" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "jni" @@ -667,7 +1683,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" dependencies = [ "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -682,18 +1698,79 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "konst" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97feab15b395d1860944abe6a8dd8ed9f8eadfae01750fada8427abda531d887" +dependencies = [ + "const_panic", + "konst_kernel", + "typewit", +] + +[[package]] +name = "konst_kernel" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b1eb7788f3824c629b1116a7a9060d6e898c358ebff59070093d51103dcc3c" +dependencies = [ + "typewit", +] + [[package]] name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" version = "0.2.186" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" +[[package]] +name = "linkme" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83272d46373fb8decca684579ac3e7c8f3d71d4cc3aa693df8759e260ae41cf" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32d59e20403c7d08fe62b4376edfe5c7fb2ef1e6b1465379686d0f21c8df444b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "litrs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5e54036fe321fd421e10d732f155734c4e4afd610dd556d9a82833ab3ee0bed" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.14" @@ -716,10 +1793,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] -name = "mock_instant" -version = "0.3.2" +name = "memo-map" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d1115007560874e373613744c6fba374c17688327a71c1476d1a5954cc857b" + +[[package]] +name = "minijinja" +version = "2.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "805bfd7352166bae857ee569628b52bcd85a1cecf7810861ebceb1686b72b75d" +dependencies = [ + "memo-map", + "serde", +] + +[[package]] +name = "nb" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f" +dependencies = [ + "nb 1.1.0", +] + +[[package]] +name = "nb" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9366861eb2a2c436c20b12c8dbec5f798cea6b47ad99216be0282942e2c81ea0" +checksum = "8d5439c4ad607c3c23abf66de8c8bf57ba8adcd1f129e699851a6e43935d339d" [[package]] name = "nix" @@ -727,7 +1829,7 @@ version = "0.31.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d6d0705320c1e6ba1d912b5e37cf18071b6c2e9b7fa8215a1e8a7651966f5d3" dependencies = [ - "bitflags", + "bitflags 2.11.1", "cfg-if", "cfg_aliases", "libc", @@ -742,12 +1844,75 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", +] + [[package]] name = "num-conv" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -757,11 +1922,24 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" +dependencies = [ + "critical-section", + "portable-atomic", +] [[package]] name = "once_cell_polyfill" @@ -775,12 +1953,6 @@ version = "11.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6790f58c7ff633d8771f42965289203411a5e5c68388703c06e14f24770b41e" -[[package]] -name = "opaque-debug" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" - [[package]] name = "page_size" version = "0.6.0" @@ -791,6 +1963,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "panic-semihosting" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8a3e1233d9073d76a870223512ce4eeea43c067a94a445c13bd6d792d7b1ab" +dependencies = [ + "cortex-m", + "cortex-m-semihosting", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -814,6 +1996,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -850,12 +2038,11 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.8.0" +version = "0.9.0-rc.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" +checksum = "19feddcbdf17fad33f40041c7f9e768faf19455f32a6d52ba1b8b65ffc7b1cae" dependencies = [ - "cpufeatures", - "opaque-debug", + "cpufeatures 0.3.0", "universal-hash", ] @@ -871,6 +2058,71 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn 2.0.117", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.11+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "proc-macro2" version = "1.0.106" @@ -889,15 +2141,51 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "r0" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7a31eed1591dcbc95d92ad7161908e72f4677f8fabf2a32ca49b4237cbf211" + +[[package]] +name = "ral-registers" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46b71a9d9206e8b46714c74255adcaea8b11e0350c1d8456165073c3f75fc81a" + [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ - "getrandom", + "getrandom 0.3.4", ] +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + [[package]] name = "rayon" version = "1.12.0" @@ -924,7 +2212,7 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags", + "bitflags 2.11.1", ] [[package]] @@ -960,14 +2248,64 @@ checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" name = "ring" version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "riscv" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea8ff73d3720bdd0a97925f0bf79ad2744b6da8ff36be3840c48ac81191d7a7" +dependencies = [ + "critical-section", + "embedded-hal 1.0.0", + "paste", + "riscv-macros", + "riscv-pac", +] + +[[package]] +name = "riscv-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f265be5d634272320a7de94cea15c22a3bfdd4eb42eb43edc528415f066a1f25" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "riscv-pac" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8188909339ccc0c68cfb5a04648313f09621e8b87dc03095454f1a11f6c5d436" + +[[package]] +name = "riscv-rt-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30f19a85fe107b65031e0ba8ec60c34c2494069fe910d6c297f5e7cb5a6f76d0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.117", +] + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "untrusted", - "windows-sys 0.52.0", + "semver 0.9.0", ] [[package]] @@ -976,7 +2314,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "semver", + "semver 1.0.28", ] [[package]] @@ -1000,12 +2338,27 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.228" @@ -1033,7 +2386,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1049,6 +2402,15 @@ dependencies = [ "zmij", ] +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + [[package]] name = "sharded-slab" version = "0.1.7" @@ -1086,12 +2448,57 @@ dependencies = [ "winapi", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_cell" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0530892bb4fa575ee0da4b86f86c667132a94b74bb72160f58ee5a4afec74c23" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "std-embedded-time" +version = "0.1.0" +source = "git+https://github.com/SimonIT/std-embedded-time.git?branch=release%2Fv0.13.0#2c4b90174c841b075fde0e53b270385d5a5198a7" +dependencies = [ + "embedded-time 0.13.0 (git+https://github.com/FluenTech/embedded-time.git?branch=release%2Fv0.13.0)", +] + [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "strum" +version = "0.26.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.117", +] + [[package]] name = "subtle" version = "2.6.1" @@ -1104,6 +2511,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7973cce6668464ea31f176d85b13c7ab3bba2cb3b77a2ed26abd7801688010a" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.117" @@ -1115,6 +2533,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -1141,7 +2568,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1152,7 +2579,7 @@ checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1205,6 +2632,77 @@ dependencies = [ "serde_json", ] +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.1+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow 0.7.15", +] + +[[package]] +name = "toml_edit" +version = "0.25.11+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b59c4d22ed448339746c59b905d24568fcbb3ab65a500494f7b8c3e97739f2b" +dependencies = [ + "indexmap", + "toml_datetime 1.1.1+spec-1.1.0", + "toml_parser", + "winnow 1.0.2", +] + +[[package]] +name = "toml_parser" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" +dependencies = [ + "winnow 1.0.2", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + [[package]] name = "tracing" version = "0.1.44" @@ -1237,7 +2735,7 @@ checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1281,20 +2779,47 @@ version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" +[[package]] +name = "typewit" +version = "1.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "214ca0b2191785cbc06209b9ca1861e048e39b5ba33574b3cedd58363d5bb5f6" +dependencies = [ + "typewit_proc_macros", +] + +[[package]] +name = "typewit_proc_macros" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e36a83ea2b3c704935a01b4642946aadd445cea40b10935e3f8bd8052b8193d6" + +[[package]] +name = "ufmt-write" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e87a2ed6b42ec5e28cc3b94c09982969e9227600b2e3dcbc1db927a84c06bd69" + [[package]] name = "unicode-ident" version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + [[package]] name = "universal-hash" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +checksum = "f4987bdc12753382e0bec4a65c50738ffaabc998b9cdd1f952fb5f39b0048a96" dependencies = [ "crypto-common", - "subtle", + "ctutils", ] [[package]] @@ -1303,24 +2828,66 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "usb-device" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98816b1accafbb09085168b90f27e93d790b4bfa19d883466b5e53315b5f06a6" +dependencies = [ + "heapless", + "portable-atomic", +] + [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" +[[package]] +name = "uuid" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +dependencies = [ + "getrandom 0.4.2", + "js-sys", + "wasm-bindgen", +] + [[package]] name = "valuable" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" +[[package]] +name = "vcell" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77439c1b53d2303b20d9459b1ade71a83c716e3f9c34f3228c00e6f185d6c002" + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" + +[[package]] +name = "volatile-register" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de437e2a6208b014ab52972a27e59b33fa2920d3e00fe05026167a1c509d19cc" +dependencies = [ + "vcell", +] + [[package]] name = "walkdir" version = "2.5.0" @@ -1337,6 +2904,24 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + [[package]] name = "wasm-bindgen" version = "0.2.120" @@ -1369,7 +2954,7 @@ dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn", + "syn 2.0.117", "wasm-bindgen-shared", ] @@ -1382,6 +2967,40 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.1", + "hashbrown 0.15.5", + "indexmap", + "semver 1.0.28", +] + [[package]] name = "web-sys" version = "0.3.97" @@ -1511,18 +3130,170 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ee1708bef14716a11bae175f579062d4554d95be2c6829f518df847b7b3fdd0" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.1", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver 1.0.28", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "x25519-dalek" -version = "2.0.1" +version = "3.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +checksum = "3a45998121837fd8c92655d2334aa8f3e5ef0645cdfda5b321b13760c548fd55" dependencies = [ "curve25519-dalek", - "rand_core", + "rand_core 0.9.5", "serde", "zeroize", ] +[[package]] +name = "xtensa-lx" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51cbb46c78cfd284c9378070ab90bae9d14d38b3766cb853a97c0a137f736d5b" +dependencies = [ + "critical-section", + "document-features", +] + +[[package]] +name = "xtensa-lx-rt" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "689c2ef159d9cd4fc9503603e9999968a84a30db9bde0f0f880d0cceea0190a9" +dependencies = [ + "anyhow", + "document-features", + "enum-as-inner", + "minijinja", + "r0", + "serde", + "strum", + "toml", + "xtensa-lx", + "xtensa-lx-rt-proc-macros", +] + +[[package]] +name = "xtensa-lx-rt-proc-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11277b1e4cbb7ffe44678c668518b249c843c81df249b8f096701757bc50d7ee" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.117", +] + [[package]] name = "zerocopy" version = "0.8.48" @@ -1540,7 +3311,7 @@ checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.117", ] [[package]] @@ -1548,20 +3319,6 @@ name = "zeroize" version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] [[package]] name = "zmij" diff --git a/Cargo.toml b/Cargo.toml index d6f8adeac..eb6dad617 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,3 +8,6 @@ codegen-units = 1 # Use only 1 codegen-unit to enable full optimizations. [profile.bench] lto = true # Enable full link-time optimization. codegen-units = 1 # Use only 1 codegen-unit to enable full optimizations. + +[patch.crates-io] +ariel-os-threads = { git = "https://github.com/ariel-os/ariel-os.git", tag = "v0.2.1" } diff --git a/boringtun-cli/src/main.rs b/boringtun-cli/src/main.rs index b35812b7d..5e4c1041f 100644 --- a/boringtun-cli/src/main.rs +++ b/boringtun-cli/src/main.rs @@ -128,7 +128,7 @@ fn main() { let log = matches.get_one::("log").unwrap(); let log_file = - File::create(log).unwrap_or_else(|_| panic!("Could not create log file {}", log)); + File::create(log).unwrap_or_else(|_| panic!("Could not create log file {log}")); let (non_blocking, guard) = tracing_appender::non_blocking(log_file); diff --git a/boringtun/Cargo.toml b/boringtun/Cargo.toml index 9fb56f598..732817b7e 100644 --- a/boringtun/Cargo.toml +++ b/boringtun/Cargo.toml @@ -14,38 +14,47 @@ documentation = "https://docs.rs/boringtun/0.7.1/boringtun/" edition = "2018" [features] -default = [] -device = ["socket2", "thiserror"] -jni-bindings = ["ffi-bindings", "jni"] -ffi-bindings = ["tracing-subscriber"] -# mocks std::time::Instant with mock_instant -mock-instant = ["mock_instant"] +default = ["std"] +alloc = [] +std = ["alloc", "dep:parking_lot", "dep:std-embedded-time", "once_cell/std"] +ariel-os = ["dep:ariel-os-lock", "dep:embassy-embedded-time", "once_cell/critical-section"] +device = ["std", "socket2", "thiserror"] +jni-bindings = ["std", "ffi-bindings", "jni"] +ffi-bindings = ["std", "tracing-subscriber"] +defmt = ["dep:defmt", "embedded-time/defmt", "embassy-embedded-time/defmt"] [dependencies] -base64 = "0.22" -hex = "0.4" +base64 = { version = "0.22.1", default-features = false, features = ["alloc"] } +hex = { version = "0.4", default-features = false, features = ["alloc"] } untrusted = "0.9.0" -libc = "0.2" -parking_lot = "0.12" +libc = { version = "0.2", default-features = false } +parking_lot = { version = "0.12.4", optional = true } +ariel-os-lock = { git = "https://github.com/SimonIT/ariel-os-lock", optional = true } +lock_api = "0.4.13" +once_cell = { version = "1.19.0", default-features = false } portable-atomic = { version = "1.13.1", features = ["fallback"] } -tracing = "0.1.40" +tracing = { version = "0.1.40", default-features = false } tracing-subscriber = { version = "0.3", features = ["fmt"], optional = true } -ip_network = "0.4.1" -ip_network_table = "0.2.0" -ring = "0.17" -x25519-dalek = { version = "2.0.1", features = [ +ip_network = { version = "0.4.1", default-features = false } +ip_network_table = { version = "0.2.0", default-features = false } +ring = { version = "0.17.14", default-features = false } +x25519-dalek = { version = "3.0.0-pre.1", features = [ "reusable_secrets", "static_secrets", + "os_rng" ] } -rand_core = { version = "0.6.4", features = ["getrandom"] } -chacha20poly1305 = "0.10.0-pre.1" -aead = "0.5.0-pre.2" -blake2 = "0.10" -hmac = "0.12" +rand_core = { version = "0.9.3", features = ["os_rng"] } +chacha20poly1305 = "0.11.0-rc.1" +aead = "0.6.0-rc.2" +blake2 = "0.11.0-rc.2" +hmac = "0.13.0-rc.1" jni = { version = "0.19.0", optional = true } -mock_instant = { version = "0.3", optional = true } socket2 = { version = "0.4.7", features = ["all"], optional = true } thiserror = { version = "1", optional = true } +embedded-time = { git = "https://github.com/SimonIT/embedded-time.git", branch = "update-defmt" } +std-embedded-time = { git = "https://github.com/SimonIT/std-embedded-time.git", branch = "release/v0.13.0", optional = true } +embassy-embedded-time = { git = "https://github.com/SimonIT/embassy-embedded-time.git", branch = "release/v0.13.0", optional = true } +defmt = { version = "1.0.1", optional = true } [target.'cfg(unix)'.dependencies] nix = { version = "0.31", default-features = false, features = [ @@ -59,7 +68,7 @@ tracing-subscriber = "0.3" criterion = { version = "0.8.2", features = ["html_reports"] } [lib] -crate-type = ["staticlib", "cdylib", "rlib"] +crate-type = ["cdylib", "rlib"] [[bench]] name = "crypto_benches" diff --git a/boringtun/src/device/api.rs b/boringtun/src/device/api.rs index 0486de68b..fb6ec219b 100644 --- a/boringtun/src/device/api.rs +++ b/boringtun/src/device/api.rs @@ -6,9 +6,12 @@ use super::drop_privileges::get_saved_ids; use super::{AllowedIP, Device, Error, SocketAddr}; use crate::device::Action; use crate::serialization::KeyBytes; +use crate::sleepyinstant::ClockUnit; use crate::x25519; +use embedded_time::duration::{Nanoseconds, Seconds}; use hex::encode as encode_hex; use libc::*; +use std::convert::TryFrom; use std::fs::{create_dir, remove_file}; use std::io::{BufRead, BufReader, BufWriter, Write}; use std::os::unix::io::{AsRawFd, FromRawFd}; @@ -69,7 +72,7 @@ impl Device { _ => EIO, }; // The protocol requires to return an error code as the response, or zero on success - writeln!(writer, "errno={}\n", status).ok(); + writeln!(writer, "errno={status}\n").ok(); } Action::Continue // Indicates the worker thread should continue as normal }), @@ -99,7 +102,7 @@ impl Device { _ => EIO, }; // The protocol requires to return an error code as the response, or zero on success - writeln!(writer, "errno={}\n", status).ok(); + writeln!(writer, "errno={status}\n").ok(); } else { // The remote side is likely closed; we should trigger an exit. d.trigger_exit(); @@ -165,7 +168,7 @@ fn api_get(writer: &mut BufWriter<&UnixStream>, d: &Device) -> i32 { } if let Some(fwmark) = d.fwmark { - writeln!(writer, "fwmark={}", fwmark); + writeln!(writer, "fwmark={fwmark}"); } for (k, p) in d.peers.iter() { @@ -177,26 +180,28 @@ fn api_get(writer: &mut BufWriter<&UnixStream>, d: &Device) -> i32 { } if let Some(keepalive) = p.persistent_keepalive() { - writeln!(writer, "persistent_keepalive_interval={}", keepalive); + writeln!(writer, "persistent_keepalive_interval={keepalive}"); } if let Some(ref addr) = p.endpoint().addr { - writeln!(writer, "endpoint={}", addr); + writeln!(writer, "endpoint={addr}"); } for (ip, cidr) in p.allowed_ips() { - writeln!(writer, "allowed_ip={}/{}", ip, cidr); + writeln!(writer, "allowed_ip={ip}/{cidr}"); } if let Some(time) = p.time_since_last_handshake() { - writeln!(writer, "last_handshake_time_sec={}", time.as_secs()); - writeln!(writer, "last_handshake_time_nsec={}", time.subsec_nanos()); + let secs = Seconds::::try_from(time).unwrap(); + writeln!(writer, "last_handshake_time_sec={secs}"); + let sub = Nanoseconds::::try_from(time).unwrap() % Seconds(1u32); + writeln!(writer, "last_handshake_time_nsec={sub}"); } let (_, tx_bytes, rx_bytes, ..) = p.tunnel.stats(); - writeln!(writer, "rx_bytes={}", rx_bytes); - writeln!(writer, "tx_bytes={}", tx_bytes); + writeln!(writer, "rx_bytes={rx_bytes}"); + writeln!(writer, "tx_bytes={tx_bytes}"); } 0 } @@ -260,7 +265,7 @@ fn api_set(reader: &mut BufReader<&UnixStream>, d: &mut LockReadGuard) - reader, device, x25519::PublicKey::from(key_bytes.0), - ) + ); } Err(_) => return EINVAL, }, diff --git a/boringtun/src/device/dev_lock.rs b/boringtun/src/device/dev_lock.rs index 1a700fab9..6076a2f63 100644 --- a/boringtun/src/device/dev_lock.rs +++ b/boringtun/src/device/dev_lock.rs @@ -26,7 +26,7 @@ impl Lock { impl Lock { /// Acquire a read lock pub fn read(&self) -> LockReadGuard { - let (ref lock, ref cvar) = &self.wants_write; + let (lock, cvar) = &self.wants_write; let mut wants_write = lock.lock(); while *wants_write { // We have a writer and we want to wait for it to go away @@ -64,7 +64,7 @@ impl<'a, T: ?Sized> LockReadGuard<'a, T> { ) -> Option { // First tell everyone that we want to write now, this will prevent any new reader from starting until we are done. { - let &(ref lock, cvar) = &self.wants_write; + let &(lock, cvar) = &self.wants_write; let mut wants_write = lock.lock(); RwLockReadGuard::unlocked(&mut self.inner, move || { @@ -90,7 +90,7 @@ impl<'a, T: ?Sized> LockReadGuard<'a, T> { })); // Finally signal other threads - let (ref lock, ref cvar) = &self.wants_write; + let (lock, cvar) = &self.wants_write; let mut wants_write = lock.lock(); *wants_write = false; cvar.notify_all(); diff --git a/boringtun/src/device/epoll.rs b/boringtun/src/device/epoll.rs index b6ecaf0b9..4cd810edc 100644 --- a/boringtun/src/device/epoll.rs +++ b/boringtun/src/device/epoll.rs @@ -301,7 +301,7 @@ impl EventPoll { unsafe { write( notification_event.trigger, - &(std::u64::MAX - 1).to_ne_bytes()[0] as *const u8 as _, + &(u64::MAX - 1).to_ne_bytes()[0] as *const u8 as _, 8, ) }; diff --git a/boringtun/src/device/integration_tests/mod.rs b/boringtun/src/device/integration_tests/mod.rs index b4e360c3d..0e877e437 100644 --- a/boringtun/src/device/integration_tests/mod.rs +++ b/boringtun/src/device/integration_tests/mod.rs @@ -87,7 +87,7 @@ mod tests { /// Create a new peer with a given endpoint and a list of allowed IPs fn new(endpoint: SocketAddr, allowed_ips: Vec) -> Peer { Peer { - key: StaticSecret::random_from_rng(OsRng), + key: StaticSecret::random(), endpoint, allowed_ips, container_name: None, @@ -463,7 +463,7 @@ mod tests { } #[test] - #[ignore] + /// Test if wireguard starts and creates a unix socket that we can read from fn test_wireguard_get() { let wg = WGHandle::init("192.0.2.0".parse().unwrap(), "::2".parse().unwrap()); @@ -472,11 +472,11 @@ mod tests { } #[test] - #[ignore] + /// Test if wireguard starts and creates a unix socket that we can use to set settings fn test_wireguard_set() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let own_public_key = PublicKey::from(&private_key); let wg = WGHandle::init("192.0.2.0".parse().unwrap(), "::2".parse().unwrap()); @@ -494,7 +494,7 @@ mod tests { ) ); - let peer_key = StaticSecret::random_from_rng(OsRng); + let peer_key = StaticSecret::random(); let peer_pub_key = PublicKey::from(&peer_key); let endpoint = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(172, 0, 0, 1)), 50001); let allowed_ips = [ @@ -540,10 +540,10 @@ mod tests { /// Test if wireguard can handle simple ipv4 connections, don't use a connected socket #[test] - #[ignore] + fn test_wg_start_ipv4_non_connected() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -587,10 +587,10 @@ mod tests { /// Test if wireguard can handle simple ipv4 connections #[test] - #[ignore] + fn test_wg_start_ipv4() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -622,11 +622,11 @@ mod tests { } #[test] - #[ignore] + /// Test if wireguard can handle simple ipv6 connections fn test_wg_start_ipv6() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -658,11 +658,10 @@ mod tests { /// Test if wireguard can handle connection with an ipv6 endpoint #[test] - #[ignore] #[cfg(target_os = "linux")] // Can't make docker work with ipv6 on macOS ATM fn test_wg_start_ipv6_endpoint() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -697,11 +696,10 @@ mod tests { /// Test if wireguard can handle connection with an ipv6 endpoint #[test] - #[ignore] #[cfg(target_os = "linux")] // Can't make docker work with ipv6 on macOS ATM fn test_wg_start_ipv6_endpoint_not_connected() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -747,10 +745,10 @@ mod tests { /// Test many concurrent connections #[test] - #[ignore] + fn test_wg_concurrent() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); @@ -798,10 +796,10 @@ mod tests { /// Test many concurrent connections #[test] - #[ignore] + fn test_wg_concurrent_v6() { let port = next_port(); - let private_key = StaticSecret::random_from_rng(OsRng); + let private_key = StaticSecret::random(); let public_key = PublicKey::from(&private_key); let addr_v4 = next_ip(); let addr_v6 = next_ip_v6(); diff --git a/boringtun/src/device/mod.rs b/boringtun/src/device/mod.rs index b250f5e5d..fd333eec2 100644 --- a/boringtun/src/device/mod.rs +++ b/boringtun/src/device/mod.rs @@ -44,7 +44,7 @@ use allowed_ips::AllowedIps; use parking_lot::Mutex; use peer::{AllowedIP, Peer}; use poll::{EventPoll, EventRef, WaitResult}; -use rand_core::{OsRng, RngCore}; +use rand_core::{OsRng, TryRngCore}; use socket2::{Domain, Protocol, Type}; use tun::TunSocket; @@ -316,7 +316,7 @@ impl Device { } // Update an existing peer - if self.peers.get(&pub_key).is_some() { + if self.peers.contains_key(&pub_key) { // We already have a peer, we need to merge the existing config into the newly created one panic!("Modifying existing peers is not yet supported. Remove and add again instead."); } @@ -726,7 +726,7 @@ impl Device { &mut t.dst_buf[..], ) { TunnResult::Done => {} - TunnResult::Err(e) => eprintln!("Decapsulate error {:?}", e), + TunnResult::Err(e) => eprintln!("Decapsulate error {e:?}"), TunnResult::WriteToNetwork(packet) => { flush = true; let _: Result<_, _> = udp.send(packet); @@ -787,11 +787,11 @@ impl Device { if ek == io::ErrorKind::Interrupted || ek == io::ErrorKind::WouldBlock { break; } - eprintln!("Fatal read error on tun interface: {:?}", e); + eprintln!("Fatal read error on tun interface: {e:?}"); return Action::Exit; } Err(e) => { - eprintln!("Unexpected error on tun interface: {:?}", e); + eprintln!("Unexpected error on tun interface: {e:?}"); return Action::Exit; } }; @@ -852,7 +852,7 @@ impl IndexLfsr { fn random_index() -> u32 { const LFSR_MAX: u32 = 0xffffff; // 24-bit seed loop { - let i = OsRng.next_u32() & LFSR_MAX; + let i = OsRng.try_next_u32().unwrap() & LFSR_MAX; if i > 0 { // LFSR seed must be non-zero return i; diff --git a/boringtun/src/device/peer.rs b/boringtun/src/device/peer.rs index 3bf3655bb..033e6601f 100644 --- a/boringtun/src/device/peer.rs +++ b/boringtun/src/device/peer.rs @@ -4,11 +4,11 @@ use parking_lot::RwLock; use socket2::{Domain, Protocol, Type}; -use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, SocketAddrV4, SocketAddrV6}; -use std::str::FromStr; - use crate::device::{AllowedIps, Error}; use crate::noise::{Tunn, TunnResult}; +use crate::sleepyinstant::ClockDuration; +use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, SocketAddrV4, SocketAddrV6}; +use std::str::FromStr; #[derive(Default, Debug)] pub struct Endpoint { @@ -152,7 +152,7 @@ impl Peer { self.allowed_ips.iter().map(|(_, ip, cidr)| (ip, cidr)) } - pub fn time_since_last_handshake(&self) -> Option { + pub fn time_since_last_handshake(&self) -> Option { self.tunnel.time_since_last_handshake() } diff --git a/boringtun/src/ffi/mod.rs b/boringtun/src/ffi/mod.rs index 1e5a2a9f3..45d231c4c 100644 --- a/boringtun/src/ffi/mod.rs +++ b/boringtun/src/ffi/mod.rs @@ -11,19 +11,26 @@ use crate::x25519::{PublicKey, StaticSecret}; use base64::{decode, encode}; use hex::encode as encode_hex; use libc::{raise, SIGSEGV}; -use parking_lot::Mutex; +use lock_api::Mutex; +use parking_lot::RawMutex; use rand_core::OsRng; use tracing; use tracing_subscriber::fmt; use crate::serialization::KeyBytes; -use std::ffi::{CStr, CString}; +use crate::sleepyinstant::ClockImpl; +use core::ffi::CStr; +use core::ptr; +use core::ptr::null_mut; +use core::slice; +use embedded_time::duration::Seconds; +use embedded_time::fixed_point::FixedPoint; +use embedded_time::Clock; +use std::convert::TryFrom; +use std::ffi::CString; use std::io::{Error, ErrorKind, Write}; use std::os::raw::c_char; use std::panic; -use std::ptr; -use std::ptr::null_mut; -use std::slice; use std::sync::Once; static PANIC_HOOK: Once = Once::new(); @@ -247,7 +254,7 @@ pub unsafe extern "C" fn new_tunnel( preshared_key: *const c_char, keep_alive: u16, index: u32, -) -> *mut Mutex { +) -> *mut Mutex { let c_str = CStr::from_ptr(static_private); let static_private = match c_str.to_str() { Err(_) => return ptr::null_mut(), @@ -313,7 +320,7 @@ pub unsafe extern "C" fn new_tunnel( /// Drops the Tunn object #[no_mangle] -pub unsafe extern "C" fn tunnel_free(tunnel: *mut Mutex) { +pub unsafe extern "C" fn tunnel_free(tunnel: *mut Mutex) { drop(Box::from_raw(tunnel)); } @@ -321,7 +328,7 @@ pub unsafe extern "C" fn tunnel_free(tunnel: *mut Mutex) { /// For more details check noise::tunnel_to_network functions. #[no_mangle] pub unsafe extern "C" fn wireguard_write( - tunnel: *const Mutex, + tunnel: *const Mutex, src: *const u8, src_size: u32, dst: *mut u8, @@ -338,7 +345,7 @@ pub unsafe extern "C" fn wireguard_write( /// For more details check noise::network_to_tunnel functions. #[no_mangle] pub unsafe extern "C" fn wireguard_read( - tunnel: *const Mutex, + tunnel: *const Mutex, src: *const u8, src_size: u32, dst: *mut u8, @@ -355,7 +362,7 @@ pub unsafe extern "C" fn wireguard_read( /// Recommended interval: 100ms. #[no_mangle] pub unsafe extern "C" fn wireguard_tick( - tunnel: *const Mutex, + tunnel: *const Mutex, dst: *mut u8, dst_size: u32, ) -> wireguard_result { @@ -368,7 +375,7 @@ pub unsafe extern "C" fn wireguard_tick( /// Force the tunnel to initiate a new handshake, dst buffer must be at least 148 byte long. #[no_mangle] pub unsafe extern "C" fn wireguard_force_handshake( - tunnel: *const Mutex, + tunnel: *const Mutex, dst: *mut u8, dst_size: u32, ) -> wireguard_result { @@ -383,11 +390,13 @@ pub unsafe extern "C" fn wireguard_force_handshake( /// Number of data bytes encapsulated /// Number of data bytes decapsulated #[no_mangle] -pub unsafe extern "C" fn wireguard_stats(tunnel: *const Mutex) -> stats { +pub unsafe extern "C" fn wireguard_stats(tunnel: *const Mutex) -> stats { let tunnel = tunnel.as_ref().unwrap().lock(); let (time, tx_bytes, rx_bytes, estimated_loss, estimated_rtt) = tunnel.stats(); stats { - time_since_last_handshake: time.map(|t| t.as_secs() as i64).unwrap_or(-1), + time_since_last_handshake: time + .map(|t| Seconds::::try_from(t).unwrap().integer() as i64) + .unwrap_or(-1), tx_bytes, rx_bytes, estimated_loss, diff --git a/boringtun/src/jni.rs b/boringtun/src/jni.rs index 7bc2bdcd7..58718f5b1 100644 --- a/boringtun/src/jni.rs +++ b/boringtun/src/jni.rs @@ -4,9 +4,9 @@ // temporary, we need to do some verification around these bindings later #![allow(clippy::missing_safety_doc)] +use core::ptr; /// JNI bindings for BoringTun library use std::os::raw::c_char; -use std::ptr; use jni::objects::{JByteBuffer, JClass, JString}; use jni::strings::JNIStr; @@ -62,7 +62,7 @@ pub unsafe extern "C" fn generate_public_key1( } let secret_key = x25519_key { - key: std::mem::transmute::<[i8; 32], [u8; 32]>(key_inner), + key: core::mem::transmute::<[i8; 32], [u8; 32]>(key_inner), }; match env.byte_array_from_slice(&x25519_public_key(secret_key).key) { @@ -86,7 +86,7 @@ pub unsafe extern "C" fn convert_x25519_key_to_hex( } let x25519_key = x25519_key { - key: std::mem::transmute::<[i8; 32], [u8; 32]>(key), + key: core::mem::transmute::<[i8; 32], [u8; 32]>(key), }; let output = match env.new_string(JNIStr::from_ptr(x25519_key_to_hex(x25519_key)).to_owned()) { @@ -112,7 +112,7 @@ pub unsafe extern "C" fn convert_x25519_key_to_base64( } let x25519_key = x25519_key { - key: std::mem::transmute::<[i8; 32], [u8; 32]>(key), + key: core::mem::transmute::<[i8; 32], [u8; 32]>(key), }; let output = match env.new_string(JNIStr::from_ptr(x25519_key_to_base64(x25519_key)).to_owned()) diff --git a/boringtun/src/lib.rs b/boringtun/src/lib.rs index 6ab410dc3..6609978f8 100644 --- a/boringtun/src/lib.rs +++ b/boringtun/src/lib.rs @@ -5,6 +5,12 @@ //! //! git clone https://github.com/cloudflare/boringtun.git +// Set `no_std` where `std` feature is disabled +#![cfg_attr(not(feature = "std"), no_std)] + +#[cfg(feature = "alloc")] +extern crate alloc; + #[cfg(feature = "device")] pub mod device; @@ -14,7 +20,6 @@ pub mod ffi; pub mod jni; pub mod noise; -#[cfg(not(feature = "mock-instant"))] pub(crate) mod sleepyinstant; pub(crate) mod serialization; diff --git a/boringtun/src/noise/errors.rs b/boringtun/src/noise/errors.rs index 10513aefe..cf5626ab7 100644 --- a/boringtun/src/noise/errors.rs +++ b/boringtun/src/noise/errors.rs @@ -1,6 +1,7 @@ // Copyright (c) 2019 Cloudflare, Inc. All rights reserved. // SPDX-License-Identifier: BSD-3-Clause +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[derive(Debug)] pub enum WireGuardError { DestinationBufferTooSmall, diff --git a/boringtun/src/noise/handshake.rs b/boringtun/src/noise/handshake.rs index 40ed8037d..6d6264d4e 100644 --- a/boringtun/src/noise/handshake.rs +++ b/boringtun/src/noise/handshake.rs @@ -4,20 +4,20 @@ use super::{HandshakeInit, HandshakeResponse, PacketCookieReply}; use crate::noise::errors::WireGuardError; use crate::noise::session::Session; -#[cfg(not(feature = "mock-instant"))] -use crate::sleepyinstant::Instant; +use crate::sleepyinstant::{ClockDuration, ClockUnit, Instant, BORING_CLOCK}; use crate::x25519; use aead::{Aead, Payload}; +use alloc::borrow::ToOwned; +use blake2::digest::consts::{U16, U24}; use blake2::digest::{FixedOutput, KeyInit}; use blake2::{Blake2s256, Blake2sMac, Digest}; use chacha20poly1305::XChaCha20Poly1305; -use rand_core::OsRng; +use core::convert::TryFrom; +use core::convert::TryInto; +use embedded_time::duration::{Milliseconds, Nanoseconds, Seconds}; +use embedded_time::fixed_point::FixedPoint; +use embedded_time::Clock; use ring::aead::{Aad, LessSafeKey, Nonce, UnboundKey, CHACHA20_POLY1305}; -use std::convert::TryInto; -use std::time::{Duration, SystemTime}; - -#[cfg(feature = "mock-instant")] -use mock_instant::Instant; pub(crate) const LABEL_MAC1: &[u8; 8] = b"mac1----"; pub(crate) const LABEL_COOKIE: &[u8; 8] = b"cookie--"; @@ -67,21 +67,21 @@ pub(crate) fn b2s_hmac2(key: &[u8], data1: &[u8], data2: &[u8]) -> [u8; 32] { #[inline] pub(crate) fn b2s_keyed_mac_16(key: &[u8], data1: &[u8]) -> [u8; 16] { - let mut hmac = Blake2sMac::new_from_slice(key).unwrap(); + let mut hmac = Blake2sMac::::new_from_slice(key).unwrap(); blake2::digest::Update::update(&mut hmac, data1); hmac.finalize_fixed().into() } #[inline] pub(crate) fn b2s_keyed_mac_16_2(key: &[u8], data1: &[u8], data2: &[u8]) -> [u8; 16] { - let mut hmac = Blake2sMac::new_from_slice(key).unwrap(); + let mut hmac = Blake2sMac::::new_from_slice(key).unwrap(); blake2::digest::Update::update(&mut hmac, data1); blake2::digest::Update::update(&mut hmac, data2); hmac.finalize_fixed().into() } pub(crate) fn b2s_mac_24(key: &[u8], data1: &[u8]) -> [u8; 24] { - let mut hmac = Blake2sMac::new_from_slice(key).unwrap(); + let mut hmac = Blake2sMac::::new_from_slice(key).unwrap(); blake2::digest::Update::update(&mut hmac, data1); hmac.finalize_fixed().into() } @@ -168,7 +168,7 @@ struct Tai64N { #[derive(Debug)] /// This struct computes a [Tai64N](https://cr.yp.to/libtai/tai64.html) timestamp from current system time struct TimeStamper { - duration_at_start: Duration, + duration_at_start: ClockDuration, instant_at_start: Instant, } @@ -176,9 +176,7 @@ impl TimeStamper { /// Create a new TimeStamper pub fn new() -> TimeStamper { TimeStamper { - duration_at_start: SystemTime::now() - .duration_since(SystemTime::UNIX_EPOCH) - .unwrap(), + duration_at_start: BORING_CLOCK.try_now().unwrap().duration_since_epoch(), instant_at_start: Instant::now(), } } @@ -188,8 +186,10 @@ impl TimeStamper { const TAI64_BASE: u64 = (1u64 << 62) + 37; let mut ext_stamp = [0u8; 12]; let stamp = Instant::now().duration_since(self.instant_at_start) + self.duration_at_start; - ext_stamp[0..8].copy_from_slice(&(stamp.as_secs() + TAI64_BASE).to_be_bytes()); - ext_stamp[8..12].copy_from_slice(&stamp.subsec_nanos().to_be_bytes()); + let secs = Seconds::::try_from(stamp).unwrap(); + ext_stamp[0..8].copy_from_slice(&(secs.integer() + TAI64_BASE).to_be_bytes()); + let sub = Nanoseconds::::try_from(stamp).unwrap() % Seconds(1u32); + ext_stamp[8..12].copy_from_slice(&(sub.integer() as u32).to_be_bytes()); ext_stamp } } @@ -206,7 +206,7 @@ impl Tai64N { return Err(WireGuardError::InvalidTai64nTimestamp); } - let (sec_bytes, nano_bytes) = buf.split_at(std::mem::size_of::()); + let (sec_bytes, nano_bytes) = buf.split_at(size_of::()); let secs = u64::from_be_bytes(sec_bytes.try_into().unwrap()); let nano = u32::from_be_bytes(nano_bytes.try_into().unwrap()); @@ -244,8 +244,8 @@ struct NoiseParams { preshared_key: Option<[u8; KEY_LEN]>, } -impl std::fmt::Debug for NoiseParams { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for NoiseParams { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("NoiseParams") .field("static_public", &self.static_public) .field("static_private", &"") @@ -265,8 +265,8 @@ struct HandshakeInitSentState { time_sent: Instant, } -impl std::fmt::Debug for HandshakeInitSentState { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl core::fmt::Debug for HandshakeInitSentState { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { f.debug_struct("HandshakeInitSentState") .field("local_index", &self.local_index) .field("hash", &self.hash) @@ -549,7 +549,7 @@ impl Handshake { // initiator.hash = HASH(initiator.hash || msg.encrypted_timestamp) hash = b2s_hash(&hash, packet.encrypted_timestamp); - self.previous = std::mem::replace( + self.previous = core::mem::replace( &mut self.state, HandshakeState::InitReceived { chaining_key, @@ -634,7 +634,8 @@ impl Handshake { let temp3 = b2s_hmac2(&temp1, &temp2, &[0x02]); let rtt_time = Instant::now().duration_since(state.time_sent); - self.last_rtt = Some(rtt_time.as_millis() as u32); + let millis = Milliseconds::try_from(rtt_time).unwrap(); + self.last_rtt = Some(millis.integer()); if is_previous { self.previous = HandshakeState::None; @@ -668,7 +669,7 @@ impl Handshake { }; let plaintext = XChaCha20Poly1305::new_from_slice(&key) .unwrap() - .decrypt(packet.nonce.into(), payload) + .decrypt(packet.nonce.try_into().unwrap(), payload) .map_err(|_| WireGuardError::InvalidAeadTag)?; let cookie = plaintext @@ -728,7 +729,7 @@ impl Handshake { let mut hash = INITIAL_CHAIN_HASH; hash = b2s_hash(&hash, self.params.peer_static_public.as_bytes()); // initiator.ephemeral_private = DH_GENERATE() - let ephemeral_private = x25519::ReusableSecret::random_from_rng(OsRng); + let ephemeral_private = x25519::ReusableSecret::random(); // msg.message_type = 1 // msg.reserved_zero = { 0, 0, 0 } message_type.copy_from_slice(&super::HANDSHAKE_INIT.to_le_bytes()); @@ -772,7 +773,7 @@ impl Handshake { hash = b2s_hash(&hash, encrypted_timestamp); let time_now = Instant::now(); - self.previous = std::mem::replace( + self.previous = core::mem::replace( &mut self.state, HandshakeState::InitSent(HandshakeInitSentState { local_index, @@ -794,7 +795,7 @@ impl Handshake { return Err(WireGuardError::DestinationBufferTooSmall); } - let state = std::mem::replace(&mut self.state, HandshakeState::None); + let state = core::mem::replace(&mut self.state, HandshakeState::None); let (mut chaining_key, mut hash, peer_ephemeral_public, peer_index) = match state { HandshakeState::InitReceived { chaining_key, @@ -814,7 +815,7 @@ impl Handshake { let (encrypted_nothing, _) = rest.split_at_mut(16); // responder.ephemeral_private = DH_GENERATE() - let ephemeral_private = x25519::ReusableSecret::random_from_rng(OsRng); + let ephemeral_private = x25519::ReusableSecret::random(); let local_index = self.inc_index(); // msg.message_type = 2 // msg.reserved_zero = { 0, 0, 0 } @@ -882,7 +883,11 @@ impl Handshake { #[cfg(test)] mod tests { + extern crate std; + use super::*; + use alloc::vec; + use std::eprintln; #[test] fn chacha20_seal_rfc7530_test_vector() { diff --git a/boringtun/src/noise/mod.rs b/boringtun/src/noise/mod.rs index 76e377b63..b0a114f78 100644 --- a/boringtun/src/noise/mod.rs +++ b/boringtun/src/noise/mod.rs @@ -14,11 +14,12 @@ use crate::noise::rate_limiter::RateLimiter; use crate::noise::timers::{TimerName, Timers}; use crate::x25519; -use std::collections::VecDeque; -use std::convert::{TryFrom, TryInto}; -use std::net::{IpAddr, Ipv4Addr, Ipv6Addr}; -use std::sync::Arc; -use std::time::Duration; +use crate::sleepyinstant::ClockDuration; +use alloc::collections::VecDeque; +use alloc::sync::Arc; +use alloc::vec::Vec; +use core::convert::{TryFrom, TryInto}; +use core::net::{IpAddr, Ipv4Addr, Ipv6Addr}; /// The default value to use for rate limiting, when no other rate limiter is defined const PEER_HANDSHAKE_RATE_LIMIT: u64 = 10; @@ -41,6 +42,7 @@ const MAX_QUEUE_DEPTH: usize = 256; /// number of sessions in the ring, better keep a PoT const N_SESSIONS: usize = 8; +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[derive(Debug)] pub enum TunnResult<'a> { Done, @@ -153,7 +155,7 @@ impl Tunn { nonce: &src[8..32], encrypted_cookie: &src[32..64], }), - (DATA, DATA_OVERHEAD_SZ..=std::usize::MAX) => Packet::PacketData(PacketData { + (DATA, DATA_OVERHEAD_SZ..=usize::MAX) => Packet::PacketData(PacketData { receiver_idx: u32::from_le_bytes(src[4..8].try_into().unwrap()), counter: u64::from_le_bytes(src[8..16].try_into().unwrap()), encrypted_encapsulated_packet: &src[16..], @@ -574,7 +576,7 @@ impl Tunn { /// * Time since last handshake in seconds /// * Data bytes sent /// * Data bytes received - pub fn stats(&self) -> (Option, usize, usize, f32, Option) { + pub fn stats(&self) -> (Option, usize, usize, f32, Option) { let time = self.time_since_last_handshake(); let tx_bytes = self.tx_bytes; let rx_bytes = self.rx_bytes; @@ -587,20 +589,22 @@ impl Tunn { #[cfg(test)] mod tests { - #[cfg(feature = "mock-instant")] - use crate::noise::timers::{REKEY_AFTER_TIME, REKEY_TIMEOUT}; + extern crate std; + + use std::vec; + use std::vec::Vec; use super::*; - use rand_core::{OsRng, RngCore}; + use rand_core::{OsRng, TryRngCore}; fn create_two_tuns() -> (Tunn, Tunn) { - let my_secret_key = x25519_dalek::StaticSecret::random_from_rng(OsRng); + let my_secret_key = x25519_dalek::StaticSecret::random(); let my_public_key = x25519_dalek::PublicKey::from(&my_secret_key); - let my_idx = OsRng.next_u32(); + let my_idx = OsRng.try_next_u32().unwrap(); - let their_secret_key = x25519_dalek::StaticSecret::random_from_rng(OsRng); + let their_secret_key = x25519_dalek::StaticSecret::random(); let their_public_key = x25519_dalek::PublicKey::from(&their_secret_key); - let their_idx = OsRng.next_u32(); + let their_idx = OsRng.try_next_u32().unwrap(); let my_tun = Tunn::new(my_secret_key, their_public_key, None, None, my_idx, None); @@ -675,20 +679,6 @@ mod tests { packet } - #[cfg(feature = "mock-instant")] - fn update_timer_results_in_handshake(tun: &mut Tunn) { - let mut dst = vec![0u8; 2048]; - let result = tun.update_timers(&mut dst); - assert!(matches!(result, TunnResult::WriteToNetwork(_))); - let packet_data = if let TunnResult::WriteToNetwork(data) = result { - data - } else { - unreachable!(); - }; - let packet = Tunn::parse_incoming_packet(packet_data).unwrap(); - assert!(matches!(packet, Packet::HandshakeInit(_))); - } - #[test] fn create_two_tunnels_linked_to_eachother() { let (_my_tun, _their_tun) = create_two_tuns(); @@ -729,43 +719,6 @@ mod tests { assert!(matches!(their_tun.update_timers(&mut []), TunnResult::Done)); } - #[test] - #[cfg(feature = "mock-instant")] - fn new_handshake_after_two_mins() { - let (mut my_tun, mut their_tun) = create_two_tuns_and_handshake(); - let mut my_dst = [0u8; 1024]; - - // Advance time 1 second and "send" 1 packet so that we send a handshake - // after the timeout - mock_instant::MockClock::advance(Duration::from_secs(1)); - assert!(matches!(their_tun.update_timers(&mut []), TunnResult::Done)); - assert!(matches!( - my_tun.update_timers(&mut my_dst), - TunnResult::Done - )); - let sent_packet_buf = create_ipv4_udp_packet(); - let data = my_tun.encapsulate(&sent_packet_buf, &mut my_dst); - assert!(matches!(data, TunnResult::WriteToNetwork(_))); - - //Advance to timeout - mock_instant::MockClock::advance(REKEY_AFTER_TIME); - assert!(matches!(their_tun.update_timers(&mut []), TunnResult::Done)); - update_timer_results_in_handshake(&mut my_tun); - } - - #[test] - #[cfg(feature = "mock-instant")] - fn handshake_no_resp_rekey_timeout() { - let (mut my_tun, _their_tun) = create_two_tuns(); - - let init = create_handshake_init(&mut my_tun); - let packet = Tunn::parse_incoming_packet(&init).unwrap(); - assert!(matches!(packet, Packet::HandshakeInit(_))); - - mock_instant::MockClock::advance(REKEY_TIMEOUT); - update_timer_results_in_handshake(&mut my_tun) - } - #[test] fn one_ip_packet() { let (mut my_tun, mut their_tun) = create_two_tuns_and_handshake(); diff --git a/boringtun/src/noise/rate_limiter.rs b/boringtun/src/noise/rate_limiter.rs index 421d5680f..b3cf6afd5 100644 --- a/boringtun/src/noise/rate_limiter.rs +++ b/boringtun/src/noise/rate_limiter.rs @@ -2,27 +2,31 @@ use super::handshake::{b2s_hash, b2s_keyed_mac_16, b2s_keyed_mac_16_2, b2s_mac_2 use crate::noise::handshake::{LABEL_COOKIE, LABEL_MAC1}; use crate::noise::{HandshakeInit, HandshakeResponse, Packet, Tunn, TunnResult, WireGuardError}; -#[cfg(feature = "mock-instant")] -use mock_instant::Instant; +use core::convert::TryFrom; +use core::net::IpAddr; use portable_atomic::{AtomicU64, Ordering}; -use std::net::IpAddr; -#[cfg(not(feature = "mock-instant"))] -use crate::sleepyinstant::Instant; +use crate::sleepyinstant::{ClockUnit, Instant}; -use aead::generic_array::GenericArray; -use aead::{AeadInPlace, KeyInit}; +use aead::array::Array; +use aead::{AeadInOut, KeyInit}; +#[cfg(feature = "ariel-os")] +use ariel_os_lock::RawMutex; use chacha20poly1305::{Key, XChaCha20Poly1305}; -use parking_lot::Mutex; -use rand_core::{OsRng, RngCore}; +use embedded_time::duration::Seconds; +use embedded_time::fixed_point::FixedPoint; +use lock_api::Mutex; +#[cfg(feature = "std")] +use parking_lot::RawMutex; +use rand_core::{OsRng, TryRngCore}; use ring::constant_time::verify_slices_are_equal; -const COOKIE_REFRESH: u64 = 128; // Use 128 and not 120 so the compiler can optimize out the division +const COOKIE_REFRESH: Seconds = Seconds(128); // Use 128 and not 120 so the compiler can optimize out the division const COOKIE_SIZE: usize = 16; const COOKIE_NONCE_SIZE: usize = 24; /// How often should reset count in seconds -const RESET_PERIOD: u64 = 1; +const RESET_PERIOD: Seconds = Seconds(1); type Cookie = [u8; COOKIE_SIZE]; @@ -40,7 +44,7 @@ pub struct RateLimiter { /// The key we use to derive the cookie secret_key: [u8; 16], start_time: Instant, - /// A single 64 bit counter (should suffice for many years) + /// A single usize bit counter (should suffice for many years) nonce_ctr: AtomicU64, mac1_key: [u8; 32], cookie_key: Key, @@ -48,13 +52,13 @@ pub struct RateLimiter { /// The counter since last reset count: AtomicU64, /// The time last reset was performed on this rate limiter - last_reset: Mutex, + last_reset: Mutex, } impl RateLimiter { pub fn new(public_key: &crate::x25519::PublicKey, limit: u64) -> Self { let mut secret_key = [0u8; 16]; - OsRng.fill_bytes(&mut secret_key); + OsRng.try_fill_bytes(&mut secret_key).unwrap(); RateLimiter { nonce_key: Self::rand_bytes(), secret_key, @@ -70,7 +74,7 @@ impl RateLimiter { fn rand_bytes() -> [u8; 32] { let mut key = [0u8; 32]; - OsRng.fill_bytes(&mut key); + OsRng.try_fill_bytes(&mut key).unwrap(); key } @@ -79,7 +83,7 @@ impl RateLimiter { // The rate limiter is not very accurate, but at the scale we care about it doesn't matter much let current_time = Instant::now(); let mut last_reset_time = self.last_reset.lock(); - if current_time.duration_since(*last_reset_time).as_secs() >= RESET_PERIOD { + if current_time.duration_since(*last_reset_time) >= RESET_PERIOD { self.count.store(0, Ordering::SeqCst); *last_reset_time = current_time; } @@ -96,10 +100,16 @@ impl RateLimiter { // The current cookie for a given IP is the MAC(responder.changing_secret_every_two_minutes, initiator.ip_address) // First we derive the secret from the current time, the value of cur_counter would change with time. - let cur_counter = Instant::now().duration_since(self.start_time).as_secs() / COOKIE_REFRESH; + let cur_counter = + Seconds::::try_from(Instant::now().duration_since(self.start_time)).unwrap() + / COOKIE_REFRESH.integer() as ClockUnit; // Next we derive the cookie - b2s_keyed_mac_16_2(&self.secret_key, &cur_counter.to_le_bytes(), &addr_bytes) + b2s_keyed_mac_16_2( + &self.secret_key, + &cur_counter.integer().to_le_bytes(), + &addr_bytes, + ) } fn nonce(&self) -> [u8; COOKIE_NONCE_SIZE] { @@ -137,11 +147,11 @@ impl RateLimiter { let cipher = XChaCha20Poly1305::new(&self.cookie_key); - let iv = GenericArray::from_slice(nonce); + let iv = Array::from_slice(nonce); encrypted_cookie[..16].copy_from_slice(&cookie); let tag = cipher - .encrypt_in_place_detached(iv, mac1, &mut encrypted_cookie[..16]) + .encrypt_inout_detached(&iv, mac1, (&mut encrypted_cookie[..16]).into()) .map_err(|_| WireGuardError::DestinationBufferTooSmall)?; encrypted_cookie[16..].copy_from_slice(&tag); diff --git a/boringtun/src/noise/session.rs b/boringtun/src/noise/session.rs index d547b9819..4bac9f5dc 100644 --- a/boringtun/src/noise/session.rs +++ b/boringtun/src/noise/session.rs @@ -3,7 +3,11 @@ use super::PacketData; use crate::noise::errors::WireGuardError; -use parking_lot::Mutex; +#[cfg(feature = "ariel-os")] +use ariel_os_lock::RawMutex; +use lock_api::Mutex; +#[cfg(feature = "std")] +use parking_lot::RawMutex; use portable_atomic::{AtomicU64, Ordering}; use ring::aead::{Aad, LessSafeKey, Nonce, UnboundKey, CHACHA20_POLY1305}; @@ -13,11 +17,11 @@ pub struct Session { receiver: LessSafeKey, sender: LessSafeKey, sending_key_counter: AtomicU64, - receiving_key_counter: Mutex, + receiving_key_counter: Mutex, } -impl std::fmt::Debug for Session { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Debug for Session { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { write!( f, "Session: {}<- ->{}", diff --git a/boringtun/src/noise/timers.rs b/boringtun/src/noise/timers.rs index 6b91d5767..28ff36a9f 100644 --- a/boringtun/src/noise/timers.rs +++ b/boringtun/src/noise/timers.rs @@ -3,25 +3,20 @@ use super::errors::WireGuardError; use crate::noise::{Tunn, TunnResult}; -use std::mem; -use std::ops::{Index, IndexMut}; - -use std::time::Duration; - -#[cfg(feature = "mock-instant")] -use mock_instant::Instant; - -#[cfg(not(feature = "mock-instant"))] use crate::sleepyinstant::Instant; +use crate::sleepyinstant::{ClockDuration, ClockUnit}; +use core::mem; +use core::ops::{Index, IndexMut}; +use embedded_time::duration::Seconds; // Some constants, represent time in seconds // https://www.wireguard.com/papers/wireguard.pdf#page=14 -pub(crate) const REKEY_AFTER_TIME: Duration = Duration::from_secs(120); -const REJECT_AFTER_TIME: Duration = Duration::from_secs(180); -const REKEY_ATTEMPT_TIME: Duration = Duration::from_secs(90); -pub(crate) const REKEY_TIMEOUT: Duration = Duration::from_secs(5); -const KEEPALIVE_TIMEOUT: Duration = Duration::from_secs(10); -const COOKIE_EXPIRATION_TIME: Duration = Duration::from_secs(120); +pub(crate) const REKEY_AFTER_TIME: Seconds = Seconds(120); +const REJECT_AFTER_TIME: Seconds = Seconds(180); +const REKEY_ATTEMPT_TIME: Seconds = Seconds(90); +pub(crate) const REKEY_TIMEOUT: Seconds = Seconds(5); +const KEEPALIVE_TIMEOUT: Seconds = Seconds(10); +const COOKIE_EXPIRATION_TIME: Seconds = Seconds(120); #[derive(Debug)] pub enum TimerName { @@ -48,14 +43,15 @@ pub enum TimerName { use self::TimerName::*; +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[derive(Debug)] pub struct Timers { /// Is the owner of the timer the initiator or the responder for the last handshake? is_initiator: bool, /// Start time of the tunnel time_started: Instant, - timers: [Duration; TimerName::Top as usize], - pub(super) session_timers: [Duration; super::N_SESSIONS], + timers: [ClockDuration; TimerName::Top as usize], + pub(super) session_timers: [ClockDuration; super::N_SESSIONS], /// Did we receive data without sending anything back? want_keepalive: bool, /// Did we send data without hearing back? @@ -96,14 +92,14 @@ impl Timers { } impl Index for Timers { - type Output = Duration; - fn index(&self, index: TimerName) -> &Duration { + type Output = ClockDuration; + fn index(&self, index: TimerName) -> &ClockDuration { &self.timers[index as usize] } } impl IndexMut for Timers { - fn index_mut(&mut self, index: TimerName) -> &mut Duration { + fn index_mut(&mut self, index: TimerName) -> &mut ClockDuration { &mut self.timers[index as usize] } } @@ -149,7 +145,7 @@ impl Tunn { self.timers.clear(); } - fn update_session_timers(&mut self, time_now: Duration) { + fn update_session_timers(&mut self, time_now: ClockDuration) { let timers = &mut self.timers; for (i, t) in timers.session_timers.iter_mut().enumerate() { @@ -290,7 +286,7 @@ impl Tunn { // Persistent KEEPALIVE if persistent_keepalive > 0 && (now - self.timers[TimePersistentKeepalive] - >= Duration::from_secs(persistent_keepalive as _)) + >= Seconds::(persistent_keepalive as _)) { tracing::debug!("KEEPALIVE(PERSISTENT_KEEPALIVE)"); self.timer_tick(TimePersistentKeepalive); @@ -311,7 +307,7 @@ impl Tunn { TunnResult::Done } - pub fn time_since_last_handshake(&self) -> Option { + pub fn time_since_last_handshake(&self) -> Option { let current_session = self.current; if self.sessions[current_session % super::N_SESSIONS].is_some() { let duration_since_tun_start = Instant::now().duration_since(self.timers.time_started); diff --git a/boringtun/src/serialization.rs b/boringtun/src/serialization.rs index e6920f8b6..24175d5df 100644 --- a/boringtun/src/serialization.rs +++ b/boringtun/src/serialization.rs @@ -1,6 +1,6 @@ pub(crate) struct KeyBytes(pub [u8; 32]); -impl std::str::FromStr for KeyBytes { +impl core::str::FromStr for KeyBytes { type Err = &'static str; /// Can parse a secret key from a hex or base64 encoded string. diff --git a/boringtun/src/sleepyinstant/mod.rs b/boringtun/src/sleepyinstant/mod.rs index 542beea38..a927a68e9 100644 --- a/boringtun/src/sleepyinstant/mod.rs +++ b/boringtun/src/sleepyinstant/mod.rs @@ -1,18 +1,23 @@ #![forbid(unsafe_code)] //! Attempts to provide the same functionality as std::time::Instant, except it //! uses a timer which accounts for time when the system is asleep -use std::time::Duration; -#[cfg(target_os = "windows")] -mod windows; -#[cfg(target_os = "windows")] -use windows as inner; +use embedded_time::duration::Generic; +use embedded_time::Clock; +#[cfg(all(windows, not(feature = "ariel-os")))] +use std_embedded_time::StandardClock as ClockImpl; -#[cfg(unix)] +#[cfg(all(unix, not(feature = "ariel-os")))] mod unix; -#[cfg(unix)] +#[cfg(all(unix, not(feature = "ariel-os")))] +use inner::UnixClock as ClockImpl; +#[cfg(all(unix, not(feature = "ariel-os")))] use unix as inner; +#[cfg(feature = "ariel-os")] +use embassy_embedded_time::EmbassyClock as ClockImpl; +use once_cell::sync::Lazy; + /// A measurement of a monotonically nondecreasing clock. /// Opaque and useful only with [`Duration`]. /// @@ -34,16 +39,26 @@ use unix as inner; /// The size of an `Instant` struct may vary depending on the target operating /// system. /// +#[cfg_attr(feature = "defmt", derive(defmt::Format))] #[derive(Clone, Copy, Debug)] pub struct Instant { - t: inner::Instant, + t: embedded_time::Instant, } +/// The underlying unit of time for the clock. +pub type ClockUnit = ::T; + +/// A span of time between two instants of the clock. +pub type ClockDuration = Generic; + +/// A global clock instance +pub static BORING_CLOCK: Lazy = Lazy::new(ClockImpl::default); + impl Instant { /// Returns an instant corresponding to "now". pub fn now() -> Self { Self { - t: inner::Instant::now(), + t: BORING_CLOCK.try_now().unwrap(), } } @@ -53,25 +68,29 @@ impl Instant { /// # Panics /// /// panics when `earlier` was later than `self`. - pub fn duration_since(&self, earlier: Instant) -> Duration { - self.t.duration_since(earlier.t) + pub fn duration_since(&self, earlier: Instant) -> ClockDuration { + self.t.checked_duration_since(&earlier.t).unwrap() } /// Returns the amount of time elapsed since this instant was created. - pub fn elapsed(&self) -> Duration { + pub fn elapsed(&self) -> ClockDuration { Self::now().duration_since(*self) } } #[cfg(test)] mod tests { + extern crate std; + use super::*; + use core::convert::TryInto; + use embedded_time::duration::Milliseconds; #[test] fn time_increments_after_sleep() { - let sleep_time = Duration::from_millis(10); + let sleep_time = Milliseconds(10u32); let start = Instant::now(); - std::thread::sleep(sleep_time); + std::thread::sleep(sleep_time.try_into().unwrap()); assert!(start.elapsed() >= sleep_time); } } diff --git a/boringtun/src/sleepyinstant/unix.rs b/boringtun/src/sleepyinstant/unix.rs index 1c17c2e5e..f2f2d8097 100644 --- a/boringtun/src/sleepyinstant/unix.rs +++ b/boringtun/src/sleepyinstant/unix.rs @@ -1,6 +1,7 @@ -use std::time::Duration; - -use nix::sys::time::TimeSpec; +use core::ops::Add; +use embedded_time::duration::Seconds; +use embedded_time::rate::Fraction; +use embedded_time::{Clock, Instant}; use nix::time::{clock_gettime, ClockId}; #[cfg(any( @@ -18,41 +19,18 @@ const CLOCK_ID: ClockId = ClockId::CLOCK_MONOTONIC; )))] const CLOCK_ID: ClockId = ClockId::CLOCK_BOOTTIME; -#[derive(Clone, Copy, Debug)] -pub(crate) struct Instant { - t: TimeSpec, -} +#[derive(Copy, Clone, Debug, Default)] +pub struct UnixClock; -impl Instant { - pub(crate) fn now() -> Self { - // std::time::Instant unwraps as well, so feel safe doing so here - let t = clock_gettime(CLOCK_ID).unwrap(); - Self { t } - } +impl Clock for UnixClock { + type T = u64; - fn checked_duration_since(&self, earlier: Instant) -> Option { - const NANOSECOND: nix::libc::c_long = 1_000_000_000; - let (tv_sec, tv_nsec) = if self.t.tv_nsec() < earlier.t.tv_nsec() { - ( - self.t.tv_sec() - earlier.t.tv_sec() - 1, - self.t.tv_nsec() - earlier.t.tv_nsec() + NANOSECOND, - ) - } else { - ( - self.t.tv_sec() - earlier.t.tv_sec(), - self.t.tv_nsec() - earlier.t.tv_nsec(), - ) - }; + const SCALING_FACTOR: Fraction = Fraction::new(1, 1_000_000_000); - if tv_sec < 0 { - None - } else { - Some(Duration::new(tv_sec as _, tv_nsec as _)) - } - } - - pub(crate) fn duration_since(&self, earlier: Instant) -> Duration { - self.checked_duration_since(earlier) - .unwrap_or(Duration::ZERO) + fn try_now(&self) -> Result, embedded_time::clock::Error> { + let t = clock_gettime(CLOCK_ID).unwrap(); + let mut i = Instant::new(t.tv_nsec() as u64); + i = i.add(Seconds(t.tv_sec() as u64)); + Ok(i) } } diff --git a/boringtun/src/sleepyinstant/windows.rs b/boringtun/src/sleepyinstant/windows.rs deleted file mode 100644 index ac852292f..000000000 --- a/boringtun/src/sleepyinstant/windows.rs +++ /dev/null @@ -1 +0,0 @@ -pub(crate) use std::time::Instant;