Merge pull request #3065 from aaronjamt/patch-minor-cleanup

[hf seos] Minor cleanup
This commit is contained in:
Iceman authored and GitHub committed 2025-12-23 23:31:01 +01:00
commit 50a55c21ae
1 file changed
+5 -7
+5 -7
View File
@@ -515,8 +515,7 @@ static void create_mutual_auth_key(uint8_t *KEYIFD, uint8_t *KEYICC, uint8_t *RN
// PrintAndLogEx(SUCCESS, "RandomIFD........................ " _YELLOW_("%s"), sprint_hex_inrow(RNDIFD, 8));
// PrintAndLogEx(SUCCESS, "hash Input....................... " _YELLOW_("%s"), sprint_hex_inrow(hash_in,ARRAYLEN(hash_in)));
uint8_t output[128]; // Buffer to store the two 32-byte keys
uint8_t hashedOutput[128];
uint8_t output[32]; // Buffer to store the two 16-byte keys
uint32_t counter = 1;
// Generate the first key
@@ -524,17 +523,16 @@ static void create_mutual_auth_key(uint8_t *KEYIFD, uint8_t *KEYICC, uint8_t *RN
// PrintAndLogEx(SUCCESS, "key_out_temp..................... " _YELLOW_("%s"), sprint_hex_inrow(hash_in,ARRAYLEN(hash_in)));
if (HashingAlgorithm == 0x06) {
sha1hash(hash_in, sizeof(hash_in), hashedOutput);
sha1hash(hash_in, sizeof(hash_in), output);
//PrintAndLogEx(SUCCESS, "key_out_temp..................... " _YELLOW_("%s"), sprint_hex_inrow(hash_in,ARRAYLEN(hash_in)));
memcpy(output, hashedOutput, 20);
counter++;
set_counter_big_endian(hash_in, counter);
uint8_t hashedOutput[20];
sha1hash(hash_in, sizeof(hash_in), hashedOutput);
memcpy(output + 20, hashedOutput, 20);
memcpy(output + 20, hashedOutput, 12);
//PrintAndLogEx(SUCCESS, "key_out_temp..................... " _YELLOW_("%s"), sprint_hex_inrow(hash_in,ARRAYLEN(hash_in)));
} else if (HashingAlgorithm == 0x07) {
sha256hash(hash_in, sizeof(hash_in), hashedOutput);
memcpy(output, hashedOutput, 32);
sha256hash(hash_in, sizeof(hash_in), output);
} else {
// Yes they generate their encryption keys and mac keys in a weird way for no fucking reason, the 2nd cycle isn't required.
PrintAndLogEx(ERR, _RED_("Unknown Hashing Algorithm"));