Skip to content

Commit 1d8198d

Browse files
author
Johannes Draaijer
committed
Add no_security security context
1 parent 984f379 commit 1d8198d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mac/frame/security/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ mod auxiliary_security_header;
161161
pub mod default;
162162
mod security_control;
163163

164+
use self::default::Unimplemented;
165+
164166
use super::{FooterMode, Frame, Header};
165167
use crate::mac::{Address, FrameType, FrameVersion};
166168
use byte::BytesExt;
@@ -275,6 +277,18 @@ where
275277
}
276278
}
277279

280+
impl SecurityContext<Unimplemented, Unimplemented> {
281+
/// A security context that is not actually capable of providing any security
282+
pub fn no_security() -> Self {
283+
Self {
284+
euid: 0,
285+
frame_counter: 0,
286+
key_provider: Unimplemented {},
287+
phantom_data: PhantomData,
288+
}
289+
}
290+
}
291+
278292
fn calculate_nonce(source_addr: u64, frame_counter: u32, sec_level: SecurityLevel) -> [u8; 13] {
279293
let mut output = [0u8; 13];
280294
for i in 0..8 {

0 commit comments

Comments
 (0)