MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / decrypt_f_opts_mac_commands

Method decrypt_f_opts_mac_commands

chirpstack/src/uplink/data.rs:572–589  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

570 }
571
572 fn decrypt_f_opts_mac_commands(&mut self) -> Result<()> {
573 trace!("Decrypting mac-commands");
574 let ds = self.device.as_ref().unwrap().get_device_session()?;
575 if ds.mac_version().to_string().starts_with("1.0") {
576 if let Err(e) = self.phy_payload.decode_f_opts_to_mac_commands() {
577 // This avoids failing in case of a corrupted mac-command in the frm_payload.
578 warn!(error = %e.full(), "Decoding f_opts mac-commands failed");
579 }
580 } else {
581 let nwk_s_enc_key = AES128Key::from_slice(&ds.nwk_s_enc_key)?;
582 if let Err(e) = self.phy_payload.decrypt_f_opts(&nwk_s_enc_key) {
583 // This avoids failing in case of a corrupted mac-command in the frm_payload.
584 warn!(error = %e.full(), "Decrypting f_opts mac-commands failed");
585 }
586 }
587
588 Ok(())
589 }
590
591 fn decrypt_frm_payload(&mut self) -> Result<()> {
592 trace!("Decrypting FRMPayload");

Callers 2

_handleMethod · 0.80
_handle_relayedMethod · 0.80

Calls 6

get_device_sessionMethod · 0.80
unwrapMethod · 0.80
as_refMethod · 0.80
to_stringMethod · 0.80
decrypt_f_optsMethod · 0.80

Tested by

no test coverage detected