[FL-2645, FL-2810] SubGhz: handle missing key in cryptostore. Lib: lower default display contrast. (#1717)

* SubGhz: skip file loading on key load fail

* Lib: update default display contrast

* Format sources

Co-authored-by: hedger <hedger@users.noreply.github.com>
This commit is contained in:
あく 2022-09-08 16:18:18 +09:00 committed by GitHub
parent ff33bc6aea
commit b62096fb91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 61 additions and 54 deletions

View File

@ -114,7 +114,13 @@ static bool subghz_keystore_read_file(SubGhzKeystore* instance, Stream* stream,
char* encrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_ENCRYPTED_LINE_SIZE); char* encrypted_line = malloc(SUBGHZ_KEYSTORE_FILE_ENCRYPTED_LINE_SIZE);
size_t encrypted_line_cursor = 0; size_t encrypted_line_cursor = 0;
if(iv) furi_hal_crypto_store_load_key(SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT, iv); do {
if(iv) {
if(!furi_hal_crypto_store_load_key(SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT, iv)) {
FURI_LOG_E(TAG, "Unable to load decryption key");
break;
}
}
size_t ret = 0; size_t ret = 0;
do { do {
@ -170,6 +176,7 @@ static bool subghz_keystore_read_file(SubGhzKeystore* instance, Stream* stream,
} while(ret > 0 && result); } while(ret > 0 && result);
if(iv) furi_hal_crypto_store_unload_key(SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT); if(iv) furi_hal_crypto_store_unload_key(SUBGHZ_KEYSTORE_FILE_ENCRYPTION_KEY_SLOT);
} while(false);
free(encrypted_line); free(encrypted_line);
free(decrypted_line); free(decrypted_line);

View File

@ -225,7 +225,7 @@ uint8_t u8x8_d_st756x_flipper(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void*
* RR = 10 / ((1 - (63 - 32) / 162) * 2.1) ~= 5.88 is 6 (0b110) * RR = 10 / ((1 - (63 - 32) / 162) * 2.1) ~= 5.88 is 6 (0b110)
* Bias = 1/9 (false) * Bias = 1/9 (false)
*/ */
u8x8_d_st756x_init(u8x8, 32, 0b110, false); u8x8_d_st756x_init(u8x8, 31, 0b110, false);
} else { } else {
/* ERC v1(ST7565) and v2(ST7567) /* ERC v1(ST7565) and v2(ST7567)
* EV = 33 * EV = 33
@ -233,7 +233,7 @@ uint8_t u8x8_d_st756x_flipper(u8x8_t* u8x8, uint8_t msg, uint8_t arg_int, void*
* RR = 9.3 / ((1 - (63 - 32) / 162) * 2.1) ~= 5.47 is 5.5 (0b101) * RR = 9.3 / ((1 - (63 - 32) / 162) * 2.1) ~= 5.47 is 5.5 (0b101)
* Bias = 1/9 (false) * Bias = 1/9 (false)
*/ */
u8x8_d_st756x_init(u8x8, 33, 0b101, false); u8x8_d_st756x_init(u8x8, 32, 0b101, false);
} }
break; break;
case U8X8_MSG_DISPLAY_SET_FLIP_MODE: case U8X8_MSG_DISPLAY_SET_FLIP_MODE: