passy_reader.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <lib/nfc/nfc.h>
  3. #include <nfc/nfc_listener.h>
  4. #include <nfc/nfc_poller.h>
  5. #include <nfc/nfc_device.h>
  6. #include <lib/nfc/protocols/nfc_generic_event.h>
  7. #include <lib/nfc/protocols/iso14443_4b/iso14443_4b_poller.h>
  8. #include <lib/nfc/helpers/iso14443_crc.h>
  9. #include <mbedtls/des.h>
  10. #include <lib/toolbox/stream/stream.h>
  11. #include <lib/toolbox/stream/file_stream.h>
  12. #include "passy_i.h"
  13. #include "passy_common.h"
  14. #include "secure_messaging.h"
  15. #define PASSY_READER_MAX_BUFFER_SIZE 128
  16. NfcCommand passy_reader_poller_callback(NfcGenericEvent event, void* context);
  17. typedef struct {
  18. Passy* passy;
  19. Iso14443_4bPoller* iso14443_4b_poller;
  20. BitBuffer* tx_buffer;
  21. BitBuffer* rx_buffer;
  22. BitBuffer* DG1;
  23. BitBuffer* COM;
  24. BitBuffer* dg_header;
  25. SecureMessaging* secure_messaging;
  26. uint16_t last_sw;
  27. } PassyReader;
  28. PassyReader* passy_reader_alloc(Passy* passy);
  29. void passy_reader_free(PassyReader* passy_reader);
  30. void passy_reader_mac(uint8_t* key, uint8_t* data, size_t data_length, uint8_t* mac);