@@ -33,6 +33,7 @@ static uint8_t g_lastAccountIndex = ACCOUNT_INDEX_LOGOUT;
33
33
static AccountInfo_t g_currentAccountInfo = {0 };
34
34
static PublicInfo_t g_publicInfo = {0 };
35
35
static ZcashUFVKCache_t g_zcashUFVKcache = {0 };
36
+ static void ClearZcashUFVK ();
36
37
37
38
/// @brief Get current account info from SE, and copy info to g_currentAccountInfo.
38
39
/// @return err code.
@@ -226,6 +227,7 @@ int32_t VerifyPasswordAndLogin(uint8_t *accountIndex, const char *password)
226
227
ret = ReadCurrentAccountInfo ();
227
228
g_publicInfo .loginPasswordErrorCount = 0 ;
228
229
g_publicInfo .currentPasswordErrorCount = 0 ;
230
+ ClearZcashUFVK ();
229
231
if (PassphraseExist (g_currentAccountIndex )) {
230
232
//passphrase exist.
231
233
printf ("passphrase exist\r\n" );
@@ -561,14 +563,18 @@ int32_t CreateNewTonAccount(uint8_t accountIndex, const char *mnemonic, const ch
561
563
static void SetZcashUFVK (uint8_t accountIndex , const char * ufvk , const uint8_t * seedFingerprint ) {
562
564
ASSERT (accountIndex <= 2 );
563
565
g_zcashUFVKcache .accountIndex = accountIndex ;
564
- memset_s ( g_zcashUFVKcache . ufvkCache , ZCASH_UFVK_MAX_LEN , '\0' , ZCASH_UFVK_MAX_LEN );
566
+ ClearZcashUFVK ( );
565
567
strcpy_s (g_zcashUFVKcache .ufvkCache , ZCASH_UFVK_MAX_LEN , ufvk );
566
568
567
- memset_s (g_zcashUFVKcache .seedFingerprint , 32 , 0 , 32 );
568
569
memcpy_s (g_zcashUFVKcache .seedFingerprint , 32 , seedFingerprint , 32 );
569
570
printf ("SetZcashUFVK, %s\r\n" , g_zcashUFVKcache .ufvkCache );
570
571
}
571
572
573
+ static void ClearZcashUFVK () {
574
+ memset_s (g_zcashUFVKcache .ufvkCache , ZCASH_UFVK_MAX_LEN , '\0' , ZCASH_UFVK_MAX_LEN );
575
+ memset_s (g_zcashUFVKcache .seedFingerprint , 32 , 0 , 32 );
576
+ }
577
+
572
578
int32_t GetZcashUFVK (uint8_t accountIndex , char * outUFVK , uint8_t * outSFP ) {
573
579
ASSERT (accountIndex <= 2 );
574
580
if (g_zcashUFVKcache .accountIndex == accountIndex )
0 commit comments