Skip to content

Remove deprecated GenericArray usage#100

Merged
brocaar merged 1 commit intochirpstack:masterfrom
Wifx:remove-genericarray
Jan 28, 2026
Merged

Remove deprecated GenericArray usage#100
brocaar merged 1 commit intochirpstack:masterfrom
Wifx:remove-genericarray

Conversation

@mullerch
Copy link
Contributor

This pull request refactors the AES-128 encryption code to simplify usage of the aes crate and improve code clarity. The main changes remove unnecessary dependencies on GenericArray, update cipher initialization to use the more idiomatic new_from_slice method, and make minor improvements to buffer handling.

AES-128 cipher usage improvements:

  • Replaced manual use of GenericArray with direct use of Aes128::new_from_slice for cipher initialization in src/aes128.rs and src/packets.rs, making the code more concise and idiomatic.
  • Updated block creation and encryption to use Block::from and Block::from_mut_slice as appropriate, further simplifying the code and improving readability.

Code clarity and correctness:

  • Changed buffer initialization from Vec<u8> to [u8; 16] arrays and replaced clone_from_slice with copy_from_slice for better type safety and clarity in src/packets.rs.
  • Updated CMAC initialization to use fully qualified syntax for clarity: <Cmac<Aes128> as Mac>::new_from_slice.

Signed-off-by: Christian Müller <christian.muller@wifx.net>
@brocaar brocaar merged commit 912cb8a into chirpstack:master Jan 28, 2026
2 checks passed
@brocaar
Copy link
Contributor

brocaar commented Jan 28, 2026

Thanks @mullerch

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

Successfully merging this pull request may close these issues.

2 participants

Comments