1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00
trezor-firmware/firmware/storage.h

83 lines
2.3 KiB
C
Raw Normal View History

2014-04-29 12:26:51 +00:00
/*
* This file is part of the TREZOR project.
*
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __STORAGE_H__
#define __STORAGE_H__
#include "types.pb.h"
#include "storage.pb.h"
#include "messages.pb.h"
#include "bip32.h"
void storage_init(void);
void storage_reset_uuid(void);
void storage_reset(void);
void storage_commit(void);
2015-03-31 14:31:29 +00:00
void session_clear(bool clear_pin);
2014-04-29 12:26:51 +00:00
void storage_loadDevice(LoadDevice *msg);
2016-05-19 23:49:20 +00:00
const uint8_t *storage_getSeed(bool usePassphrase);
2016-05-19 23:49:20 +00:00
bool storage_getRootNode(HDNode *node, const char *curve, bool usePassphrase);
2014-04-29 12:26:51 +00:00
const char *storage_getLabel(void);
void storage_setLabel(const char *label);
const char *storage_getLanguage(void);
void storage_setLanguage(const char *lang);
void storage_setPassphraseProtection(bool passphrase_protection);
2015-02-04 20:27:07 +00:00
const uint8_t *storage_getHomescreen(void);
void storage_setHomescreen(const uint8_t *data, uint32_t size);
2014-04-29 12:26:51 +00:00
void session_cachePassphrase(const char *passphrase);
bool session_isPassphraseCached(void);
bool storage_containsMnemonic(const char *mnemonic);
bool storage_containsPin(const char *pin);
2014-04-29 12:26:51 +00:00
bool storage_hasPin(void);
void storage_setPin(const char *pin);
void session_cachePin(void);
2014-04-29 12:26:51 +00:00
bool session_isPinCached(void);
void storage_clearPinArea(void);
void storage_resetPinFails(uint32_t *pinfailptr);
bool storage_increasePinFails(uint32_t *pinfailptr);
uint32_t *storage_getPinFailsPtr(void);
2014-04-29 12:26:51 +00:00
2015-11-02 23:08:18 +00:00
uint32_t storage_nextU2FCounter(void);
2016-06-12 21:39:28 +00:00
void storage_setU2FCounter(uint32_t u2fcounter);
2015-11-02 23:08:18 +00:00
2014-04-29 12:26:51 +00:00
bool storage_isInitialized(void);
bool storage_needsBackup(void);
void storage_applyFlags(uint32_t flags);
uint32_t storage_getFlags(void);
void storage_wipe(void);
2014-04-29 12:26:51 +00:00
extern Storage storage;
extern char storage_uuid_str[25];
#endif