-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #777 from ReFirmLabs/encrpted_img
Added encrpted_img signature
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use crate::signatures::common::{ | ||
SignatureError, SignatureResult, CONFIDENCE_LOW, CONFIDENCE_MEDIUM, | ||
}; | ||
|
||
/// Human readable description | ||
pub const DESCRIPTION: &str = "D-Link Encrpted Image"; | ||
|
||
/// encrpted_img firmware images always start with these bytes | ||
pub fn encrpted_img_magic() -> Vec<Vec<u8>> { | ||
vec![b"encrpted_img".to_vec()] | ||
} | ||
|
||
/// Validates the encrpted_img header | ||
pub fn encrpted_img_parser( | ||
_file_data: &[u8], | ||
offset: usize, | ||
) -> Result<SignatureResult, SignatureError> { | ||
// Successful return value | ||
let mut result = SignatureResult { | ||
offset, | ||
description: DESCRIPTION.to_string(), | ||
confidence: CONFIDENCE_MEDIUM, | ||
..Default::default() | ||
}; | ||
|
||
// Nothing to really validate here | ||
if offset != 0 { | ||
result.confidence = CONFIDENCE_LOW; | ||
} | ||
|
||
Ok(result) | ||
} |