Skip to content

Commit

Permalink
fixed checksum calc error in get usn
Browse files Browse the repository at this point in the history
  • Loading branch information
EricB-ADI committed Jun 20, 2024
1 parent 2a9b954 commit 3a2465d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me12.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
// Set NULL Key
MXC_AES_SetExtKey((const void *)aes_key, MXC_AES_128BITS);

uint8_t usn_copy[MXC_SYS_USN_LEN] = {0};
memcpy(usn_copy, usn, MXC_SYS_USN_LEN);
// Compute Checksum
mxc_aes_req_t aes_req;
aes_req.length = MXC_SYS_USN_CHECKSUM_LEN / 4;
aes_req.inputData = (uint32_t *)usn;
aes_req.inputData = (uint32_t *)usn_copy;
aes_req.resultData = (uint32_t *)check_csum;
aes_req.keySize = MXC_AES_128BITS;
aes_req.encryption = MXC_AES_ENCRYPT_EXT_KEY;
Expand Down
5 changes: 4 additions & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me15.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,13 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
// Set NULL Key
MXC_AES_SetExtKey((const void *)aes_key, MXC_AES_128BITS);

uint8_t usn_copy[MXC_SYS_USN_LEN] = {0};
memcpy(usn_copy, usn, MXC_SYS_USN_LEN);

// Compute Checksum
mxc_aes_req_t aes_req;
aes_req.length = MXC_SYS_USN_CHECKSUM_LEN / 4;
aes_req.inputData = (uint32_t *)usn;
aes_req.inputData = (uint32_t *)usn_copy;
aes_req.resultData = (uint32_t *)check_csum;
aes_req.keySize = MXC_AES_128BITS;
aes_req.encryption = MXC_AES_ENCRYPT_EXT_KEY;
Expand Down
5 changes: 4 additions & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me17.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,13 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
// Set NULL Key
MXC_AES_SetExtKey((const void *)aes_key, MXC_AES_128BITS);

uint8_t usn_copy[MXC_SYS_USN_LEN] = {0};
memcpy(usn_copy, usn, MXC_SYS_USN_LEN);

// Compute Checksum
mxc_aes_req_t aes_req;
aes_req.length = MXC_SYS_USN_CHECKSUM_LEN / 4;
aes_req.inputData = (uint32_t *)usn;
aes_req.inputData = (uint32_t *)usn_copy;
aes_req.resultData = (uint32_t *)check_csum;
aes_req.keySize = MXC_AES_128BITS;
aes_req.encryption = MXC_AES_ENCRYPT_EXT_KEY;
Expand Down
5 changes: 4 additions & 1 deletion Libraries/PeriphDrivers/Source/SYS/sys_me21.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum)
// Set NULL Key
MXC_AES_SetExtKey((const void *)aes_key, MXC_AES_128BITS);

uint8_t usn_copy[MXC_SYS_USN_LEN] = {0};
memcpy(usn_copy, usn, MXC_SYS_USN_LEN);

// Compute Checksum
mxc_aes_req_t aes_req;
aes_req.length = MXC_SYS_USN_CHECKSUM_LEN / 4;
aes_req.inputData = (uint32_t *)usn;
aes_req.inputData = (uint32_t *)usn_copy;
aes_req.resultData = (uint32_t *)check_csum;
aes_req.keySize = MXC_AES_128BITS;
aes_req.encryption = MXC_AES_ENCRYPT_EXT_KEY;
Expand Down

0 comments on commit 3a2465d

Please sign in to comment.