From febddb088d319330c1674c136d910d2e41e1b45d Mon Sep 17 00:00:00 2001 From: RocketGod <57732082+RocketGod-git@users.noreply.github.com> Date: Sun, 11 Jan 2026 20:16:39 -0800 Subject: [PATCH] @xMasterX --> Refactor key handling and add key loading function Replaces obfuscated key macros and inline functions with external key variables and function declarations. Adds protopirate_keys_load to initialize keys using a SubGhzEnvironment. Updates includes to use subghz environment and keystore headers. --- protocols/keys.h | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/protocols/keys.h b/protocols/keys.h index 8c1c675..4fe3895 100644 --- a/protocols/keys.h +++ b/protocols/keys.h @@ -2,28 +2,17 @@ #include -// Mask - hint THEPIRAT -#define KEY_OBFUSCATION_MASK 0x5448455049524154ULL +#include +#include -// Obfuscated keys -#define KIA_MF_KEY_OBF 0xFCBD9AACC4F81D8FULL -#define KIA_V6_KEYSTORE_A_OBF 0x37CE21F8C9F862A8ULL -#define KIA_V6_KEYSTORE_B_OBF 0x3FC629F0C1F06AA0ULL +extern uint64_t kia_mf_key; +extern uint64_t kia_v6_a_key; +extern uint64_t kia_v6_b_key; -static inline uint64_t get_kia_mf_key(void) -{ - volatile uint64_t mask = KEY_OBFUSCATION_MASK; - return KIA_MF_KEY_OBF ^ mask; -} +uint64_t get_kia_mf_key(); -static inline uint64_t get_kia_v6_keystore_a(void) -{ - volatile uint64_t mask = KEY_OBFUSCATION_MASK; - return KIA_V6_KEYSTORE_A_OBF ^ mask; -} +uint64_t get_kia_v6_keystore_a(); -static inline uint64_t get_kia_v6_keystore_b(void) -{ - volatile uint64_t mask = KEY_OBFUSCATION_MASK; - return KIA_V6_KEYSTORE_B_OBF ^ mask; -} \ No newline at end of file +uint64_t get_kia_v6_keystore_b(); + +void protopirate_keys_load(SubGhzEnvironment* environment);