Skip to content

Commit 74ba300

Browse files
authored
Fixed #155 (#156)
* Fixed #155
1 parent 0aa5b7b commit 74ba300

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

fbt.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Push-Location $PSScriptRoot
33
$firmware_path = ""
44
$firmware_name = ""
55
$FW_CDEF = ""
6-
if (('official-dev', 'off-dev', 'od', 'unleashed', 'un', 'u').Contains($args[0])) {
6+
if (('official-dev', 'off-dev', 'od').Contains($args[0])) {
77
$firmware_path = "flipperzero-firmware_official_dev"
88
$firmware_name = "Official Dev"
99
$FW_CDEF = "TOTP_FIRMWARE_OFFICIAL_DEV"
@@ -12,9 +12,9 @@ elseif (('official-stable', 'off-stbl', 'os').Contains($args[0])) {
1212
$firmware_path = "flipperzero-firmware_official_stable"
1313
$firmware_name = "Official Stable"
1414
$FW_CDEF = "TOTP_FIRMWARE_OFFICIAL_STABLE"
15-
} elseif (('xtreme', 'xt', 'x').Contains($args[0])) {
15+
} elseif (('xtreme', 'xt', 'x', 'unleashed', 'un', 'u').Contains($args[0])) {
1616
$firmware_path = "flipperzero-firmware_xtreme"
17-
$firmware_name = "Xtreme"
17+
$firmware_name = "Xtreme \ Unleashed"
1818
$FW_CDEF = "TOTP_FIRMWARE_XTREME_UL"
1919
}
2020
else {

totp/services/crypto/crypto.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
#include "memset_s.h"
77

88
#define CRYPTO_KEY_SLOT (2)
9-
#define CRYPTO_VERIFY_KEY "FFF_Crypto_pass"
109
#define CRYPTO_VERIFY_KEY_LENGTH (16)
1110
#define CRYPTO_ALIGNMENT_FACTOR (16)
1211

12+
static const char* CRYPTO_VERIFY_KEY = "FFF_Crypto_pass";
13+
1314
uint8_t* totp_crypto_encrypt(
1415
const uint8_t* plain_data,
1516
const size_t plain_data_length,
@@ -104,7 +105,7 @@ CryptoSeedIVResult
104105
plugin_state->crypto_verify_data_length = CRYPTO_VERIFY_KEY_LENGTH;
105106

106107
plugin_state->crypto_verify_data = totp_crypto_encrypt(
107-
(uint8_t*)CRYPTO_VERIFY_KEY,
108+
(const uint8_t*)CRYPTO_VERIFY_KEY,
108109
CRYPTO_VERIFY_KEY_LENGTH,
109110
&plugin_state->iv[0],
110111
&plugin_state->crypto_verify_data_length);
@@ -119,7 +120,7 @@ CryptoSeedIVResult
119120

120121
bool totp_crypto_verify_key(const PluginState* plugin_state) {
121122
size_t decrypted_key_length;
122-
const uint8_t* decrypted_key = totp_crypto_decrypt(
123+
uint8_t* decrypted_key = totp_crypto_decrypt(
123124
plugin_state->crypto_verify_data,
124125
plugin_state->crypto_verify_data_length,
125126
&plugin_state->iv[0],
@@ -130,5 +131,7 @@ bool totp_crypto_verify_key(const PluginState* plugin_state) {
130131
if(decrypted_key[i] != CRYPTO_VERIFY_KEY[i]) key_valid = false;
131132
}
132133

134+
free(decrypted_key);
135+
133136
return key_valid;
134137
}

0 commit comments

Comments
 (0)