From 70b51c31f30e50120ac31d13ec1a4e3daffff459 Mon Sep 17 00:00:00 2001 From: r3df0xx Date: Fri, 1 Apr 2022 23:46:41 +0300 Subject: [PATCH] fix --- lib/subghz/protocols/keeloq.c | 18 +++++++++--------- lib/subghz/protocols/nice_flor_s.c | 12 ++++++------ lib/subghz/protocols/star_line.c | 10 +++++----- lib/subghz/subghz_keystore.c | 8 ++++---- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lib/subghz/protocols/keeloq.c b/lib/subghz/protocols/keeloq.c index 2d48835d8..5249b7f5a 100644 --- a/lib/subghz/protocols/keeloq.c +++ b/lib/subghz/protocols/keeloq.c @@ -154,7 +154,7 @@ static bool subghz_protocol_keeloq_gen_data(SubGhzProtocolEncoderKeeloq* instanc code_found_reverse = subghz_protocol_blocks_reverse_key( instance->generic.data, instance->generic.data_count_bit); hop = code_found_reverse & 0x00000000ffffffff; - FURI_LOG_I(TAG, "hop = %llX", hop); + FURI_LOG_I(TAG, "hop = %X", hop); break; } break; @@ -483,7 +483,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( case KEELOQ_LEARNING_SIMPLE: // Simple Learning decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); return 1; @@ -493,7 +493,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( // Normal Learning // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -503,7 +503,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( case KEELOQ_LEARNING_SECURE: man = subghz_protocol_keeloq_common_secure_learning( fix, seed, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -513,7 +513,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( case KEELOQ_LEARNING_MAGIC_XOR_TYPE_1: man = subghz_protocol_keeloq_common_magic_xor_type1_learning( fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -523,7 +523,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( case KEELOQ_LEARNING_UNKNOWN: // Simple Learning decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); return 1; @@ -544,7 +544,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( // Normal Learning // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -562,7 +562,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( // Secure Learning man = subghz_protocol_keeloq_common_secure_learning( fix, seed, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -580,7 +580,7 @@ static uint8_t subghz_protocol_keeloq_check_remote_controller_selector( // Magic xor type1 learning man = subghz_protocol_keeloq_common_magic_xor_type1_learning( fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man); if(subghz_protocol_keeloq_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); diff --git a/lib/subghz/protocols/nice_flor_s.c b/lib/subghz/protocols/nice_flor_s.c index 0c5727036..b39971462 100644 --- a/lib/subghz/protocols/nice_flor_s.c +++ b/lib/subghz/protocols/nice_flor_s.c @@ -128,13 +128,13 @@ static bool } instance->generic.cnt++; - FURI_LOG_I(TAG, "serial = %llX", instance->generic.serial); - FURI_LOG_I(TAG, "counter = %llX", instance->generic.cnt); - FURI_LOG_I(TAG, "button = %llX", btn); + FURI_LOG_I(TAG, "serial = %07lX", instance->generic.serial); + FURI_LOG_I(TAG, "counter = %04lX", instance->generic.cnt); + FURI_LOG_I(TAG, "button = %01lX", btn); uint64_t decrypt = ((uint64_t)instance->generic.serial << 16) | instance->generic.cnt; - FURI_LOG_I(TAG, "decrypt = %llX", decrypt); + FURI_LOG_I(TAG, "decrypt = %011lX", decrypt); uint64_t enc_part = subghz_protocol_nice_flor_s_encrypt(decrypt, file_name); - FURI_LOG_I(TAG, "enc_part = %llX", enc_part); + FURI_LOG_I(TAG, "enc_part = %011lX", enc_part); for (int i = 0; i < 16; i++) { @@ -170,7 +170,7 @@ static bool //Button 4 instance->generic.data = ((uint64_t)btn << 4) | (0xF ^ btn ^ loops[3][i]) << 44 | enc_part; } - FURI_LOG_I(TAG, "key = %llX", instance->generic.data); + FURI_LOG_I(TAG, "key = %013lX", instance->generic.data); //Send header for(uint8_t i = 35; i > 0; i--) { diff --git a/lib/subghz/protocols/star_line.c b/lib/subghz/protocols/star_line.c index 9e7fcc739..98b64666d 100644 --- a/lib/subghz/protocols/star_line.c +++ b/lib/subghz/protocols/star_line.c @@ -153,7 +153,7 @@ static bool subghz_protocol_star_line_gen_data(SubGhzProtocolEncoderStarLine* in code_found_reverse = subghz_protocol_blocks_reverse_key( instance->generic.data, instance->generic.data_count_bit); hop = code_found_reverse & 0x00000000ffffffff; - FURI_LOG_I(TAG, "hop = %llX", hop); + FURI_LOG_I(TAG, "hop = %X", hop); break; } break; @@ -461,7 +461,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector( case KEELOQ_LEARNING_SIMPLE: //Simple Learning decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); if(subghz_protocol_star_line_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); return 1; @@ -472,7 +472,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector( // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man_normal_learning = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_normal_learning); if(subghz_protocol_star_line_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); @@ -482,7 +482,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector( case KEELOQ_LEARNING_UNKNOWN: // Simple Learning decrypt = subghz_protocol_keeloq_common_decrypt(hop, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); if(subghz_protocol_star_line_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); return 1; @@ -504,7 +504,7 @@ static uint8_t subghz_protocol_star_line_check_remote_controller_selector( // https://phreakerclub.com/forum/showpost.php?p=43557&postcount=37 man_normal_learning = subghz_protocol_keeloq_common_normal_learning(fix, manufacture_code->key); - FURI_LOG_I(TAG, "mfkey: %llX", manufacture_code->key); + FURI_LOG_I(TAG, "mfkey: %016lX", manufacture_code->key); decrypt = subghz_protocol_keeloq_common_decrypt(hop, man_normal_learning); if(subghz_protocol_star_line_check_decrypt(instance, decrypt, btn, end_serial)) { *manufacture_name = string_get_cstr(manufacture_code->name); diff --git a/lib/subghz/subghz_keystore.c b/lib/subghz/subghz_keystore.c index 20f8f6b7c..ac238099b 100644 --- a/lib/subghz/subghz_keystore.c +++ b/lib/subghz/subghz_keystore.c @@ -139,7 +139,7 @@ static bool subghz_keystore_read_file(SubGhzKeystore* instance, Stream* stream, if(furi_hal_crypto_decrypt( (uint8_t*)encrypted_line, (uint8_t*)decrypted_line, len)) { subghz_keystore_process_line(instance, decrypted_line); - FURI_LOG_I(TAG, "decrypted line: %llX", decrypted_line); + FURI_LOG_I(TAG, "decrypted line: %016lX", decrypted_line); } else { FURI_LOG_E(TAG, "Decryption failed"); result = false; @@ -579,9 +579,9 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t* buffer[i / 2] = (hi_nibble << 4) | lo_nibble; } - FURI_LOG_I(TAG, "decrypted line: %llX", decrypted_line); + FURI_LOG_I(TAG, "decrypted line: %016lX", decrypted_line); memset(decrypted_line, 0, SUBGHZ_KEYSTORE_FILE_DECRYPTED_LINE_SIZE); - FURI_LOG_I(TAG, "decrypted line: %llX", decrypted_line); + FURI_LOG_I(TAG, "decrypted line: %016lX", decrypted_line); if(!furi_hal_crypto_decrypt( (uint8_t*)buffer, (uint8_t*)decrypted_line, bufer_size / 2)) { @@ -590,7 +590,7 @@ bool subghz_keystore_raw_get_data(const char* file_name, size_t offset, uint8_t* break; } memcpy(data, (uint8_t*)decrypted_line + (offset - (offset / 16) * 16), len); - FURI_LOG_I(TAG, "decrypted line: %llX", decrypted_line); + FURI_LOG_I(TAG, "decrypted line: %016lX", decrypted_line); } while(0); furi_hal_crypto_store_unload_key(SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT);