-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMAC Encryption/Decryption Added #52
Conversation
dccutrig
commented
Jan 7, 2022
- Added support CMAC enc/dec
- Added UTs for above
- Changed cipher/authentication suites to enums
- Some changes to SA Struct for pointers (ecs, abm)
…ge in checking field lengths now and ARC length now matters
Codecov Report
@@ Coverage Diff @@
## collab_main #52 +/- ##
===============================================
+ Coverage 60.76% 61.95% +1.19%
===============================================
Files 20 22 +2
Lines 3362 3746 +384
===============================================
+ Hits 2043 2321 +278
- Misses 1319 1425 +106
Continue to review full report at Codecov.
|
@@ -213,8 +220,9 @@ int32_t Crypto_TC_ApplySecurity(const uint8_t *p_in_frame, const uint16_t in_fra | |||
case SA_AUTHENTICATION: | |||
// Ingest length + spi_index (2) + shivf_len (varies) + shsnf_len (varies) | |||
// + shplf_len + arc_len + pad_size + stmacf_len | |||
// TODO: If ARC is transmitted in the SHSNF field (as in CMAC... don't double count those bytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should make sure we create an issue for the couple of TODOs you've already identified
} | ||
|
||
// Need to copy the data over, since authentication won't change/move the data directly | ||
memcpy(data_out, data_in, len_data_in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sanity check on the data_out ptr to ensure it's not NULL prior to use?
} | ||
|
||
// Need to copy the data over, since authentication won't change/move the data directly | ||
memcpy(data_out, data_in, len_data_in); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
@@ -68,8 +68,8 @@ typedef struct | |||
uint8_t shsnf_len : 6; // Sec. Header SN Field Length | |||
uint8_t shplf_len : 2; // Sec. Header PL Field Length | |||
uint8_t stmacf_len : 8; // Sec. Trailer MAC Field Length | |||
uint8_t *ecs; // Encryption Cipher Suite (algorithm / mode ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialize pointers to NULL when applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed changes. built and ran tests on local CentOS 8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍 ... The only thing weird is the way we work with the ECS field as a bit-field, but I get that that's because it's also used in some of the EP PDU handling. This PR is ready to merge by my account.