Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProtectionProfile::AeadAes256Gcm => 16 for JetKVM #656

Open
davehorner opened this issue Mar 3, 2025 · 2 comments
Open

ProtectionProfile::AeadAes256Gcm => 16 for JetKVM #656

davehorner opened this issue Mar 3, 2025 · 2 comments

Comments

@davehorner
Copy link

davehorner commented Mar 3, 2025

https://crates.io/crates/jetkvm_control
I'm working on releasing this crate and when you install via cargo, it doesn't use my forked version of webrtc so it is broken for users that try to install that route.

If I use the webrtc crate as is and try to connect the user gets:

assertion `left == right` failed
  left: 32
 right: 16

my patch:
84d763f

    ProtectionProfile::AeadAes256Gcm => 16,

I have to set this to 16 for it to work with JetKVM.

Someone told me that
https://github.com/pion/webrtc/blob/98a00250830c8c5cea5a858dd4e3b652743c0b69/constants.go#L47-L53 are the default profiles in the library, and imagines it tries them first to last.

I really don't want to maintain a fork of webrtc for a key length patch. Is there a way to specify the protection profile to be used?

#649 - has the code I was looking for to select the desired profiles.

        let mut setting_engine = webrtc::api::setting_engine::SettingEngine::default();
        setting_engine.set_srtp_protection_profiles(vec![
            SrtpProtectionProfile::Srtp_Aead_Aes_128_Gcm,
            SrtpProtectionProfile::Srtp_Aes128_Cm_Hmac_Sha1_80,
        ]);
        let media_engine = MediaEngine::default();
        let api = APIBuilder::new()
                   .with_setting_engine(setting_engine)
                   .with_media_engine(media_engine
).build();

I need to test more and I will come back to close this ticket; still the question of the hard assert.

the webrtc crate should probably not panic when faced with weird input from the network?

I'm not sure if the JetKVM is doing something wrong. But it it is valid for IV to be 16 bytes. A similar issue in Rust land denoland/deno#13689

my issue has been solved. the settings change above allows my client to work with stock webrtc. this can be closed if a hard assert is the proper response.

thread 'tokio-runtime-worker' panicked at /.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/generic-array-0.14.7/src/lib.rs:572:9:
assertion `left == right` failed
  left: 32
 right: 16
stack backtrace:
   0:        0x103583220 - std::backtrace_rs::backtrace::libunwind::trace::hdeb4a7dc08e71cfa
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:117:9
   1:        0x103583220 - std::backtrace_rs::backtrace::trace_unsynchronized::hb5bb0ef580f71170
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:14
   2:        0x103583220 - std::sys::backtrace::_print_fmt::h52e473ef18ea3a12
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/sys/backtrace.rs:66:9
   3:        0x103583220 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1d0544db2962a360
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/sys/backtrace.rs:39:26
   4:        0x1035a1c54 - core::fmt::rt::Argument::fmt::he0edef1efc408bd2
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/fmt/rt.rs:177:76
   5:        0x1035a1c54 - core::fmt::write::h02719b18c231f5cb
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/fmt/mod.rs:1449:21
   6:        0x1035803b4 - std::io::Write::write_fmt::heb1a7867308df7f2
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/io/mod.rs:1890:15
   7:        0x1035830d4 - std::sys::backtrace::BacktraceLock::print::hfedb1cf8814423f3
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/sys/backtrace.rs:42:9
   8:        0x103583fb8 - std::panicking::default_hook::{{closure}}::he67cf5a80c05adcd
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:298:22
   9:        0x103583df4 - std::panicking::default_hook::h7376dfbdeb8cc0fa
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:325:9
  10:        0x103584ae8 - std::panicking::rust_panic_with_hook::h090d5adfa800980b
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:831:13
  11:        0x1035846b4 - std::panicking::begin_panic_handler::{{closure}}::hb9b8f4748654e0de
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:704:13
  12:        0x1035836d4 - std::sys::backtrace::__rust_end_short_backtrace::h862bf37740777f5d
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/sys/backtrace.rs:168:18
  13:        0x10358436c - rust_begin_unwind
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/panicking.rs:695:5
  14:        0x1035dd3ac - core::panicking::panic_fmt::hfdf01efff97f783d
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/panicking.rs:75:14
  15:        0x1035dd770 - core::panicking::assert_failed_inner::h96736719abc73c24
  16:        0x1035dd668 - core::panicking::assert_failed::he8a90bb45eb91043
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/core/src/panicking.rs:380:5
  17:        0x102b48a60 - <&generic_array::GenericArray<T,N> as core::convert::From<&[T]>>::from::h89c0441dddff3651
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/generic-array-0.14.7/src/lib.rs:572:9
  18:        0x102b4a7ac - <T as core::convert::Into<U>>::into::h864b24774d6ab93f
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/convert/mod.rs:761:9
  19:        0x102b49c54 - generic_array::GenericArray<T,N>::from_slice::h453a73deff79afb1
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/generic-array-0.14.7/src/lib.rs:550:9
  20:        0x102b435e4 - webrtc_srtp::key_derivation::aes_cm_key_derivation::h5992f661c5e7ce69
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-srtp-0.14.0/src/key_derivation.rs:43:15
  21:        0x102b36d9c - webrtc_srtp::cipher::cipher_aead_aes_gcm::CipherAeadAesGcm::new::h18d9f71383559455
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-srtp-0.14.0/src/cipher/cipher_aead_aes_gcm.rs:154:32
  22:        0x102b3e5a8 - webrtc_srtp::context::Context::new::he3783dc9281815d1
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-srtp-0.14.0/src/context/mod.rs:127:26
  23:        0x1024cabe4 - webrtc_srtp::session::Session::new::{{closure}}::h23a0f0bf28624efa
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-srtp-0.14.0/src/session/mod.rs:44:29
  24:        0x102443040 - webrtc::dtls_transport::RTCDtlsTransport::start_srtp::{{closure}}::he1d2d57e4149136f
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/dtls_transport/mod.rs:217:26
  25:        0x102449798 - webrtc::dtls_transport::RTCDtlsTransport::start::{{closure}}::h9e3c3a1c3a84791d
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/dtls_transport/mod.rs:475:27
  26:        0x10251287c - webrtc::peer_connection::peer_connection_internal::PeerConnectionInternal::start_transports::{{closure}}::hbb7af8c93c83e5c1
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/peer_connection/peer_connection_internal.rs:708:14
  27:        0x10248a154 - webrtc::peer_connection::RTCPeerConnection::set_remote_description::{{closure}}::{{closure}}::{{closure}}::ha4c0bf46018ba980
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/peer_connection/mod.rs:1610:34
  28:        0x102aefe70 - <core::pin::Pin<P> as core::future::future::Future>::poll::hcd250b39889157b8
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:124:9
  29:        0x102a12b14 - webrtc::peer_connection::operation::Operations::start::{{closure}}::h6c345c3d8fbedb7d
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/peer_connection/operation/mod.rs:124:34
  30:        0x102a124e0 - webrtc::peer_connection::operation::Operations::new::{{closure}}::h8032973507662a5d
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/webrtc-0.12.0/src/peer_connection/operation/mod.rs:57:60
  31:        0x1029da714 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h50d1f0ed66ce7398
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/core.rs:331:17
  32:        0x1029d94a8 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h1dadbf0f6d5500b7
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/loom/std/unsafe_cell.rs:16:9
  33:        0x1029d94a8 - tokio::runtime::task::core::Core<T,S>::poll::hc93d89240f9d695a
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/core.rs:320:13
  34:        0x1029a6f74 - tokio::runtime::task::harness::poll_future::{{closure}}::h84a30a03a19ac849
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:532:19
  35:        0x102a8eb80 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hefbac9edb96fa88c
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  36:        0x1029ef504 - std::panicking::try::do_call::h8c37e7a24452877f
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  37:        0x102ab0c90 - ___rust_try
  38:        0x102aa8c90 - std::panicking::try::h148b78c5bebcedec
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  39:        0x102aa8c90 - std::panic::catch_unwind::h31f42e026663a347
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  40:        0x1029a522c - tokio::runtime::task::harness::poll_future::hf08d354f40a0f41d
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:520:18
  41:        0x1029ab104 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::he227ac7f947aa55c
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:209:27
  42:        0x1029b2868 - tokio::runtime::task::harness::Harness<T,S>::poll::hdddad4997d4f20c0
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:154:15
  43:        0x102a76b64 - tokio::runtime::task::raw::poll::h37c7efef68c70e32
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/raw.rs:271:5
  44:        0x10339e36c - tokio::runtime::task::raw::RawTask::poll::h66faaab2fa15d55f
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/raw.rs:201:18
  45:        0x10336f130 - tokio::runtime::task::LocalNotified<S>::run::h832a4f62a73ac2ca
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/mod.rs:449:9
  46:        0x1033b1d44 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::{{closure}}::h3fae11371f436549
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:659:17
  47:        0x1033b1628 - tokio::runtime::coop::with_budget::ha450344db70fd930
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/coop.rs:107:5
  48:        0x1033b1628 - tokio::runtime::coop::budget::hed27e3e659c38dba
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/coop.rs:73:5
  49:        0x1033b1628 - tokio::runtime::scheduler::multi_thread::worker::Context::run_task::h4a753742e5546e35
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:595:9
  50:        0x1033b0e7c - tokio::runtime::scheduler::multi_thread::worker::Context::run::h34576763f1614e1e
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:546:24
  51:        0x1033b0ab0 - tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::{{closure}}::h4a1c5a464d6af975
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:511:21
  52:        0x10336dc78 - tokio::runtime::context::scoped::Scoped<T>::set::h242691c9bf30362a
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/context/scoped.rs:40:9
  53:        0x1033955cc - tokio::runtime::context::set_scheduler::{{closure}}::h6849429b75285dd7
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/context.rs:180:26
  54:        0x10337c550 - std::thread::local::LocalKey<T>::try_with::h809c7341ef44749a
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:310:12
  55:        0x10337b880 - std::thread::local::LocalKey<T>::with::h5b87fb474edd7649
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:274:15
  56:        0x103395550 - tokio::runtime::context::set_scheduler::h2f38c34e31148236
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/context.rs:180:9
  57:        0x1033b09d4 - tokio::runtime::scheduler::multi_thread::worker::run::{{closure}}::h3786e1a0bf764f99
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:506:9
  58:        0x1033b918c - tokio::runtime::context::runtime::enter_runtime::h4519d92a66404875
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/context/runtime.rs:65:16
  59:        0x1033b0824 - tokio::runtime::scheduler::multi_thread::worker::run::ha381e87e8a8c3d20
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:498:5
  60:        0x1033b05e4 - tokio::runtime::scheduler::multi_thread::worker::Launch::launch::{{closure}}::h8967d843e9667aa6
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/scheduler/multi_thread/worker.rs:464:45
  61:        0x1033cc370 - <tokio::runtime::blocking::task::BlockingTask<T> as core::future::future::Future>::poll::h63aa8bb1506642c7
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/blocking/task.rs:42:21
  62:        0x103372e44 - tokio::runtime::task::core::Core<T,S>::poll::{{closure}}::h8460933e75e9f2f8
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/core.rs:331:17
  63:        0x103372830 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h824d960666b35cfb
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/loom/std/unsafe_cell.rs:16:9
  64:        0x103372830 - tokio::runtime::task::core::Core<T,S>::poll::h10d79e451631bc0f
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/core.rs:320:13
  65:        0x103363b10 - tokio::runtime::task::harness::poll_future::{{closure}}::h550f1167aad00dbe
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:532:19
  66:        0x10337aa34 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h155d3ce5ff131ea3
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  67:        0x1033698d8 - std::panicking::try::do_call::hac7bf6089d735ffc
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  68:        0x1033b9688 - ___rust_try
  69:        0x1033b7c6c - std::panicking::try::hccff9cad84e123fa
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  70:        0x1033b7c6c - std::panic::catch_unwind::h7c4042fd7fbef685
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  71:        0x103363894 - tokio::runtime::task::harness::poll_future::hfe2dd31fe90718d9
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:520:18
  72:        0x103361150 - tokio::runtime::task::harness::Harness<T,S>::poll_inner::h6c30096b603c0645
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:209:27
  73:        0x103360d84 - tokio::runtime::task::harness::Harness<T,S>::poll::ha6c08f94c7b2a831
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/harness.rs:154:15
  74:        0x10339e6a4 - tokio::runtime::task::raw::poll::h5c8bc02e6ed0e3f0
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/raw.rs:271:5
  75:        0x10339e36c - tokio::runtime::task::raw::RawTask::poll::h66faaab2fa15d55f
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/raw.rs:201:18
  76:        0x10336f1f4 - tokio::runtime::task::UnownedTask<S>::run::h7555c14772886c8b
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/task/mod.rs:486:9
  77:        0x1033a3848 - tokio::runtime::blocking::pool::Task::run::he671a1e13b90173a
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/blocking/pool.rs:161:9
  78:        0x1033a5d30 - tokio::runtime::blocking::pool::Inner::run::hd2ca64eb5e09d1a4
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/blocking/pool.rs:511:17
  79:        0x1033a5a98 - tokio::runtime::blocking::pool::Spawner::spawn_thread::{{closure}}::h860c5634b5033e99
                               at /Users/dhorner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/tokio-1.43.0/src/runtime/blocking/pool.rs:469:13
  80:        0x10339f0ec - std::sys::backtrace::__rust_begin_short_backtrace::h1b66cebf59fe7ee1
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18
  81:        0x1033a02ac - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::h857304d84bfed451
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:559:17
  82:        0x10337aa6c - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h241360de34a5332d
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9
  83:        0x10336941c - std::panicking::try::do_call::h3cd06e90924f0b65
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:587:40
  84:        0x1033a66d0 - ___rust_try
  85:        0x10339fe44 - std::panicking::try::h92fcf3ecdc2291d6
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panicking.rs:550:19
  86:        0x10339fe44 - std::panic::catch_unwind::h8ba4c4d46641cf33
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/panic.rs:358:14
  87:        0x10339fe44 - std::thread::Builder::spawn_unchecked_::{{closure}}::h80cced803d2ba0de
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/mod.rs:557:30
  88:        0x10338bcbc - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3ec4d6b9c246e245
                               at /Users/dhorner/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5
  89:        0x103586ab0 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6025c089083892d4
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/alloc/src/boxed.rs:1976:9
  90:        0x103586ab0 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc04cbe86776a9593
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/alloc/src/boxed.rs:1976:9
  91:        0x103586ab0 - std::sys::pal::unix::thread::Thread::new::thread_start::hb13f25f2fc2a740f
                               at /rustc/9cd60bd2ccc41bc898d2ad86728f14035d2df72d/library/std/src/sys/pal/unix/thread.rs:106:17
  92:        0x19c0742e4 - __pthread_deallocate
@nagisa
Copy link

nagisa commented Mar 3, 2025

So I was the person helping to troubleshoot this over discord. For the most part the most major issue would seem that it is possible to cause a panic based on data coming from the network.

Going off the stack trace the source of panic is roughly

let key = GenericArray::from_slice(master_key);
let block = Aes128::new(key);

though it isn't super clear if the overarching problem is the fact that this panics when given unexpected(ly sized) input or that the unexpected(ly sized) input gets to here at all. The code seems to be written under an assumption of 128-bit AES both in the code above and in the call site of this function

let srtp_session_key = aes_cm_key_derivation(
LABEL_SRTP_ENCRYPTION,
master_key,
master_salt,
0,
master_key.len(),
)?;
let srtp_block = GenericArray::from_slice(&srtp_session_key);
let srtp_cipher = Aes128Gcm::new(srtp_block);

even though the session and config code supposedly understands 256-bit AES keys are 32-bits long.

@edisontim
Copy link

I also ran into this issue, thanks for the fork @davehorner. Indeed it would be nice to have a fix merged into the main repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants