cleanup: hca subkeys

This commit is contained in:
bnnm 2021-07-29 17:35:02 +02:00
parent e525bd1456
commit 079370b2a1
2 changed files with 15 additions and 8 deletions

View File

@ -1,6 +1,7 @@
#include "meta.h" #include "meta.h"
#include "hca_keys.h" #include "hca_keys.h"
#include "../coding/coding.h" #include "../coding/coding.h"
#include <clHCA.h>
//#define HCA_BRUTEFORCE //#define HCA_BRUTEFORCE
#ifdef HCA_BRUTEFORCE #ifdef HCA_BRUTEFORCE
@ -158,13 +159,15 @@ static void find_hca_key(hca_codec_data* hca_data, uint64_t* p_keycode, uint16_t
for (i = 0; i < keys_length; i++) { for (i = 0; i < keys_length; i++) {
uint64_t key = hcakey_list[i].key; uint64_t key = hcakey_list[i].key;
size_t subkeys_size = hcakey_list[i].subkeys_size;
const uint16_t *subkeys = hcakey_list[i].subkeys;
test_key(hca_data, key, subkey, &best_score, p_keycode); test_key(hca_data, key, subkey, &best_score, p_keycode);
if (best_score == 1) if (best_score == 1)
goto done; goto done;
#if 0
{
size_t subkeys_size = hcakey_list[i].subkeys_size;
const uint16_t *subkeys = hcakey_list[i].subkeys;
if (subkeys_size > 0 && subkey == 0) { if (subkeys_size > 0 && subkey == 0) {
for (j = 0; j < subkeys_size; j++) { for (j = 0; j < subkeys_size; j++) {
test_key(hca_data, key, subkeys[j], &best_score, p_keycode); test_key(hca_data, key, subkeys[j], &best_score, p_keycode);
@ -173,6 +176,8 @@ static void find_hca_key(hca_codec_data* hca_data, uint64_t* p_keycode, uint16_t
} }
} }
} }
#endif
}
done: done:
VGM_ASSERT(best_score > 1, "HCA: best key=%08x%08x (score=%i)\n", VGM_ASSERT(best_score > 1, "HCA: best key=%08x%08x (score=%i)\n",

View File

@ -5,8 +5,10 @@
typedef struct { typedef struct {
uint64_t key; /* hca key or seed ('user') key */ uint64_t key; /* hca key or seed ('user') key */
#if 0
const uint16_t* subkeys; /* scramble subkey table for seed key */ const uint16_t* subkeys; /* scramble subkey table for seed key */
size_t subkeys_size; /* size of the derivation subkey table */ size_t subkeys_size; /* size of the derivation subkey table */
#endif
} hcakey_info; } hcakey_info;