You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.7KB

  1. /*
  2. * This file is part of the TREZOR project, https://trezor.io/
  3. *
  4. * Copyright (c) SatoshiLabs
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef __STORAGE_H__
  20. #define __STORAGE_H__
  21. #include <stdint.h>
  22. #include <stddef.h>
  23. #include "secbool.h"
  24. typedef secbool (*PIN_UI_WAIT_CALLBACK)(uint32_t wait, uint32_t progress, const char* message);
  25. void storage_init(PIN_UI_WAIT_CALLBACK callback, const uint8_t *salt, const uint16_t salt_len);
  26. void storage_wipe(void);
  27. secbool storage_is_unlocked(void);
  28. void storage_lock(void);
  29. secbool storage_unlock(const uint32_t pin);
  30. secbool storage_has_pin(void);
  31. secbool storage_pin_fails_increase(void);
  32. uint32_t storage_get_pin_rem(void);
  33. secbool storage_change_pin(const uint32_t oldpin, const uint32_t newpin);
  34. secbool storage_get(const uint16_t key, void *val, const uint16_t max_len, uint16_t *len);
  35. secbool storage_set(const uint16_t key, const void *val, uint16_t len);
  36. secbool storage_delete(const uint16_t key);
  37. secbool storage_set_counter(const uint16_t key, const uint32_t count);
  38. secbool storage_next_counter(const uint16_t key, uint32_t *count);
  39. #endif