mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Merge pull request #3055 from aaronjamt/patch-cmac-padding
Fix CMAC padding for ARM
This commit is contained in:
+1
-3
@@ -63,11 +63,9 @@ static void generate_subkeys(mbedtls_des3_context *ctx, uint8_t *K1, uint8_t *K2
|
||||
|
||||
// Pad the last block (adds 0x80 followed by zeros)
|
||||
static void padding(const uint8_t *lastb, uint8_t *pad, size_t len) {
|
||||
memset(pad, 0x00, len);
|
||||
memcpy(pad, lastb, len);
|
||||
pad[len] = 0x80;
|
||||
for (size_t i = len + 1; i < 16; i++) {
|
||||
pad[i] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
// CMAC implementation
|
||||
|
||||
+1
-3
@@ -89,11 +89,9 @@ static void generate_subkeys(mbedtls_aes_context *ctx, uint8_t *K1, uint8_t *K2)
|
||||
|
||||
// Pad the last block (adds 0x80 followed by zeros)
|
||||
static void padding(const uint8_t *lastb, uint8_t *pad, size_t len) {
|
||||
memset(pad, 0x00, len);
|
||||
memcpy(pad, lastb, len);
|
||||
pad[len] = 0x80;
|
||||
for (size_t i = len + 1; i < 16; i++) {
|
||||
pad[i] = 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
// CMAC implementation
|
||||
|
||||
Reference in New Issue
Block a user