6
6
#include "memset_s.h"
7
7
8
8
#define CRYPTO_KEY_SLOT (2)
9
- #define CRYPTO_VERIFY_KEY "FFF_Crypto_pass"
10
9
#define CRYPTO_VERIFY_KEY_LENGTH (16)
11
10
#define CRYPTO_ALIGNMENT_FACTOR (16)
12
11
12
+ static const char * CRYPTO_VERIFY_KEY = "FFF_Crypto_pass" ;
13
+
13
14
uint8_t * totp_crypto_encrypt (
14
15
const uint8_t * plain_data ,
15
16
const size_t plain_data_length ,
@@ -104,7 +105,7 @@ CryptoSeedIVResult
104
105
plugin_state -> crypto_verify_data_length = CRYPTO_VERIFY_KEY_LENGTH ;
105
106
106
107
plugin_state -> crypto_verify_data = totp_crypto_encrypt (
107
- (uint8_t * )CRYPTO_VERIFY_KEY ,
108
+ (const uint8_t * )CRYPTO_VERIFY_KEY ,
108
109
CRYPTO_VERIFY_KEY_LENGTH ,
109
110
& plugin_state -> iv [0 ],
110
111
& plugin_state -> crypto_verify_data_length );
@@ -119,7 +120,7 @@ CryptoSeedIVResult
119
120
120
121
bool totp_crypto_verify_key (const PluginState * plugin_state ) {
121
122
size_t decrypted_key_length ;
122
- const uint8_t * decrypted_key = totp_crypto_decrypt (
123
+ uint8_t * decrypted_key = totp_crypto_decrypt (
123
124
plugin_state -> crypto_verify_data ,
124
125
plugin_state -> crypto_verify_data_length ,
125
126
& plugin_state -> iv [0 ],
@@ -130,5 +131,7 @@ bool totp_crypto_verify_key(const PluginState* plugin_state) {
130
131
if (decrypted_key [i ] != CRYPTO_VERIFY_KEY [i ]) key_valid = false;
131
132
}
132
133
134
+ free (decrypted_key );
135
+
133
136
return key_valid ;
134
137
}
0 commit comments