pub struct Dot11CCMP {
pub offset: usize,
}Expand description
CCMP (Counter Mode CBC-MAC Protocol / AES-CCM) encryption wrapper.
Format:
[PN0(1)] [PN1(1)] [Rsvd(1)] [KeyID/ExtIV(1)] [PN2(1)] [PN3(1)] [PN4(1)] [PN5(1)]
[Encrypted Data ...]
[MIC (8 bytes)]The KeyID/ExtIV byte:
- Bits 0-4: Reserved
- Bit 5:
ExtIVflag (always 1 for CCMP) - Bits 6-7: Key ID
PN (Packet Number) is a 48-bit value constructed from PN0..PN5.
Fields§
§offset: usizeImplementations§
Source§impl Dot11CCMP
impl Dot11CCMP
pub fn new(offset: usize) -> Self
Sourcepub fn validate(buf: &[u8], offset: usize) -> Result<(), FieldError>
pub fn validate(buf: &[u8], offset: usize) -> Result<(), FieldError>
Validate buffer length for CCMP header.
Sourcepub fn reserved(&self, buf: &[u8]) -> Result<u8, FieldError>
pub fn reserved(&self, buf: &[u8]) -> Result<u8, FieldError>
Reserved byte (byte 2, should be 0).
Sourcepub fn ext_iv(&self, buf: &[u8]) -> Result<bool, FieldError>
pub fn ext_iv(&self, buf: &[u8]) -> Result<bool, FieldError>
ExtIV flag (bit 5 of byte 3, always 1 for CCMP).
Sourcepub fn pn(&self, buf: &[u8]) -> Result<u64, FieldError>
pub fn pn(&self, buf: &[u8]) -> Result<u64, FieldError>
Full 48-bit Packet Number (PN). PN = PN0 | (PN1 << 8) | (PN2 << 16) | (PN3 << 24) | (PN4 << 32) | (PN5 << 40)
Sourcepub fn mic(&self, buf: &[u8], frame_end: usize) -> Result<[u8; 8], FieldError>
pub fn mic(&self, buf: &[u8], frame_end: usize) -> Result<[u8; 8], FieldError>
MIC (Message Integrity Code) — 8 bytes at the end of the encrypted data.
Sourcepub fn header_len(&self) -> usize
pub fn header_len(&self) -> usize
Header length (always 8 bytes for CCMP).
Sourcepub fn trailer_len(&self) -> usize
pub fn trailer_len(&self) -> usize
Trailer length (MIC = 8 bytes).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dot11CCMP
impl RefUnwindSafe for Dot11CCMP
impl Send for Dot11CCMP
impl Sync for Dot11CCMP
impl Unpin for Dot11CCMP
impl UnsafeUnpin for Dot11CCMP
impl UnwindSafe for Dot11CCMP
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more