seos_emulator.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <storage/storage.h>
  3. #include <dialogs/dialogs.h>
  4. #include <lib/toolbox/path.h>
  5. #include <lib/nfc/protocols/nfc_generic_event.h>
  6. #include <lib/nfc/protocols/iso14443_4a/iso14443_4a_listener.h>
  7. #include <lib/nfc/helpers/iso14443_crc.h>
  8. #include <mbedtls/des.h>
  9. #include <mbedtls/aes.h>
  10. #include "secure_messaging.h"
  11. typedef void (*SeosLoadingCallback)(void* context, bool state);
  12. typedef struct {
  13. Iso14443_3aListener* iso14443_listener;
  14. BitBuffer* tx_buffer;
  15. BitBuffer* rx_buffer;
  16. AuthParameters params;
  17. SecureMessaging* secure_messaging;
  18. SeosCredential* credential;
  19. char name[SEOS_FILE_NAME_MAX_LENGTH + 1];
  20. FuriString* load_path;
  21. SeosLoadingCallback loading_cb;
  22. void* loading_cb_ctx;
  23. Storage* storage;
  24. DialogsApp* dialogs;
  25. } SeosEmulator;
  26. NfcCommand seos_worker_listener_callback(NfcGenericEvent event, void* context);
  27. SeosEmulator* seos_emulator_alloc(SeosCredential* credential);
  28. void seos_emulator_free(SeosEmulator* seos_emulator);
  29. void seos_emulator_set_loading_callback(
  30. SeosEmulator* seos_emulator,
  31. SeosLoadingCallback callback,
  32. void* context);
  33. bool seos_emulator_file_select(SeosEmulator* seos_emulator);
  34. bool seos_emulator_delete(SeosEmulator* seos_emulator, bool use_load_path);
  35. void seos_emulator_general_authenticate_1(BitBuffer* tx_buffer, AuthParameters params);
  36. bool seos_emulator_general_authenticate_2(
  37. const uint8_t* buffer,
  38. size_t buffer_len,
  39. SeosCredential* credential,
  40. AuthParameters* params,
  41. BitBuffer* tx_buffer);
  42. void seos_emulator_select_aid(BitBuffer* tx_buffer);
  43. void seos_emulator_select_adf(
  44. AuthParameters* params,
  45. SeosCredential* credential,
  46. BitBuffer* tx_buffer);