mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 17:58:36 -07:00
Merge branch 'dev' of https://github.com/DarkFlippers/unleashed-firmware into xfw-dev
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
#include "../../../services/config/config.h"
|
||||
#include "../../scene_director.h"
|
||||
#include "../../totp_scenes_enum.h"
|
||||
#include "../../../services/crypto/crypto.h"
|
||||
#include "../../../services/crypto/crypto_facade.h"
|
||||
#include "../../../types/user_pin_codes.h"
|
||||
|
||||
#define MAX_CODE_LENGTH TOTP_IV_SIZE
|
||||
#define MAX_CODE_LENGTH CRYPTO_IV_LENGTH
|
||||
static const uint8_t PIN_ASTERISK_RADIUS = 3;
|
||||
static const uint8_t PIN_ASTERISK_STEP = (PIN_ASTERISK_RADIUS << 1) + 2;
|
||||
|
||||
@@ -25,7 +25,7 @@ void totp_scene_authenticate_activate(PluginState* plugin_state) {
|
||||
scene_state->code_length = 0;
|
||||
memset(&scene_state->code_input[0], 0, MAX_CODE_LENGTH);
|
||||
plugin_state->current_scene_state = scene_state;
|
||||
memset(&plugin_state->iv[0], 0, TOTP_IV_SIZE);
|
||||
memset(&plugin_state->crypto_settings.iv[0], 0, CRYPTO_IV_LENGTH);
|
||||
}
|
||||
|
||||
void totp_scene_authenticate_render(Canvas* const canvas, PluginState* plugin_state) {
|
||||
@@ -36,7 +36,7 @@ void totp_scene_authenticate_render(Canvas* const canvas, PluginState* plugin_st
|
||||
v_shift = -10;
|
||||
}
|
||||
|
||||
if(plugin_state->crypto_verify_data == NULL) {
|
||||
if(plugin_state->crypto_settings.crypto_verify_data == NULL) {
|
||||
canvas_draw_str_aligned(
|
||||
canvas,
|
||||
SCREEN_WIDTH_CENTER,
|
||||
@@ -124,20 +124,22 @@ bool totp_scene_authenticate_handle_event(
|
||||
}
|
||||
} else if(event->input.type == InputTypeRelease && event->input.key == InputKeyOk) {
|
||||
CryptoSeedIVResult seed_result = totp_crypto_seed_iv(
|
||||
plugin_state, &scene_state->code_input[0], scene_state->code_length);
|
||||
&plugin_state->crypto_settings, &scene_state->code_input[0], scene_state->code_length);
|
||||
|
||||
if(seed_result & CryptoSeedIVResultFlagSuccess &&
|
||||
seed_result & CryptoSeedIVResultFlagNewCryptoVerifyData) {
|
||||
totp_config_file_update_crypto_signatures(plugin_state);
|
||||
}
|
||||
|
||||
if(totp_crypto_verify_key(plugin_state)) {
|
||||
if(totp_crypto_verify_key(&plugin_state->crypto_settings)) {
|
||||
FURI_LOG_D(LOGGING_TAG, "PIN is valid");
|
||||
totp_config_file_ensure_latest_encryption(
|
||||
plugin_state, &scene_state->code_input[0], scene_state->code_length);
|
||||
totp_scene_director_activate_scene(plugin_state, TotpSceneGenerateToken);
|
||||
} else {
|
||||
FURI_LOG_D(LOGGING_TAG, "PIN is NOT valid");
|
||||
memset(&scene_state->code_input[0], 0, MAX_CODE_LENGTH);
|
||||
memset(&plugin_state->iv[0], 0, TOTP_IV_SIZE);
|
||||
memset(&plugin_state->crypto_settings.iv[0], 0, CRYPTO_IV_LENGTH);
|
||||
scene_state->code_length = 0;
|
||||
|
||||
DialogMessage* message = dialog_message_alloc();
|
||||
|
||||
Reference in New Issue
Block a user