C API for BALTECH SDK
mif.h
Go to the documentation of this file.
1 
62 #ifndef __BRP_BALTECH_API_CMDS_MIF_H__
63 #define __BRP_BALTECH_API_CMDS_MIF_H__
64 #include "../typedefs.h"
68 #define BRP_Mif_ErrNoTag BRP_ERR_STATUS(0x1000, 0x01)
69 
73 #define BRP_Mif_ErrCrc BRP_ERR_STATUS(0x1000, 0x02)
74 
77 #define BRP_Mif_ErrAuth BRP_ERR_STATUS(0x1000, 0x04)
78 
82 #define BRP_Mif_ErrParity BRP_ERR_STATUS(0x1000, 0x05)
83 
87 #define BRP_Mif_ErrCode BRP_ERR_STATUS(0x1000, 0x06)
88 
91 #define BRP_Mif_ErrSnr BRP_ERR_STATUS(0x1000, 0x08)
92 
95 #define BRP_Mif_ErrKey BRP_ERR_STATUS(0x1000, 0x09)
96 
100 #define BRP_Mif_ErrNotauth BRP_ERR_STATUS(0x1000, 0x0A)
101 
105 #define BRP_Mif_ErrBitcount BRP_ERR_STATUS(0x1000, 0x0B)
106 
110 #define BRP_Mif_ErrBytecount BRP_ERR_STATUS(0x1000, 0x0C)
111 
114 #define BRP_Mif_VcsAndProxCheckError BRP_ERR_STATUS(0x1000, 0x0E)
115 
119 #define BRP_Mif_ErrWrite BRP_ERR_STATUS(0x1000, 0x0F)
120 
123 #define BRP_Mif_ErrInc BRP_ERR_STATUS(0x1000, 0x10)
124 
127 #define BRP_Mif_ErrDecr BRP_ERR_STATUS(0x1000, 0x11)
128 
132 #define BRP_Mif_ErrRead BRP_ERR_STATUS(0x1000, 0x12)
133 
136 #define BRP_Mif_ErrOvfl BRP_ERR_STATUS(0x1000, 0x13)
137 
141 #define BRP_Mif_ErrFraming BRP_ERR_STATUS(0x1000, 0x15)
142 
150 #define BRP_Mif_ErrBreak BRP_ERR_STATUS(0x1000, 0x16)
151 
154 #define BRP_Mif_ErrCmd BRP_ERR_STATUS(0x1000, 0x17)
155 
158 #define BRP_Mif_ErrColl BRP_ERR_STATUS(0x1000, 0x18)
159 
164 #define BRP_Mif_ErrReaderChipCommunication BRP_ERR_STATUS(0x1000, 0x1A)
165 
168 #define BRP_Mif_ErrFirmwareNotSupported BRP_ERR_STATUS(0x1000, 0x1D)
169 
174 #define BRP_Mif_ErrVal BRP_ERR_STATUS(0x1000, 0x1E)
175 
180 #define BRP_Mif_ErrIntegrity BRP_ERR_STATUS(0x1000, 0x1F)
181 
184 #define BRP_Mif_CondNotvalid BRP_ERR_STATUS(0x1000, 0x20)
185 
189 #define BRP_Mif_ErrHwNotSupported BRP_ERR_STATUS(0x1000, 0x21)
190 
194 #define BRP_Mif_ErrSamUnlock BRP_ERR_STATUS(0x1000, 0x22)
195 
200 #define BRP_Mif_ErrSamCommunication BRP_ERR_STATUS(0x1000, 0x23)
201 
210 brp_errcode brp_Mif_LoadKey(brp_protocol protocol, unsigned KeyIdx, brp_buf Key);
225 brp_errcode brp_Mif_Request(brp_protocol protocol, unsigned ReqAll, unsigned* ATQA);
246 brp_errcode brp_Mif_Anticoll(brp_protocol protocol, unsigned BitCount, brp_buf PreSelSer, brp_buf* Snr, brp_mempool *mempool);
258 brp_errcode brp_Mif_Select(brp_protocol protocol, brp_buf Snr, unsigned* SAK);
274 brp_errcode brp_Mif_AuthE2(brp_protocol protocol, unsigned AuthMode, unsigned Block, unsigned KeyIdx);
290 brp_errcode brp_Mif_AuthUser(brp_protocol protocol, unsigned AuthMode, unsigned Block, brp_buf Key);
300 brp_errcode brp_Mif_Read(brp_protocol protocol, unsigned Block, brp_buf* BlockData, brp_mempool *mempool);
309 brp_errcode brp_Mif_Write(brp_protocol protocol, unsigned Block, brp_buf BlockData);
333 brp_errcode brp_Mif_ChangeValue(brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value);
346 brp_errcode brp_Mif_ChangeValueBackup(brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value);
361 brp_errcode brp_Mif_TransferBlock(brp_protocol protocol, unsigned Block);
385 brp_errcode brp_Mif_AuthE2Extended(brp_protocol protocol, unsigned AuthLevel, bool KeyHasExtIdx, unsigned EV1Mode, bool IsKeyB, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len);
399 brp_errcode brp_Mif_AuthUserExtended(brp_protocol protocol, unsigned AuthLevel, unsigned EV1Mode, unsigned KeyB, unsigned Block, brp_buf Key, size_t Key_len);
420 brp_errcode brp_Mif_ReadSL3(brp_protocol protocol, unsigned NoMacOnCmd, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, unsigned BlockNr, brp_buf* BlockData, size_t* BlockData_len, brp_mempool *mempool);
431 brp_errcode brp_Mif_WriteSL3(brp_protocol protocol, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, brp_buf BlockData, size_t BlockData_len);
444 brp_errcode brp_Mif_ChangeAESKey(brp_protocol protocol, bool KeyHasExtIdx, unsigned NoMacOnResp, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len);
460 brp_errcode brp_Mif_ValueSL3(brp_protocol protocol, unsigned NoMacOnResp, unsigned Cmd, unsigned Block, unsigned DestBlock, unsigned Value, brp_buf* TMCounterTMValue, size_t* TMCounterTMValue_len, brp_mempool *mempool);
477 brp_errcode brp_Mif_ProxCheck(brp_protocol protocol, unsigned M, unsigned DisableIsoWrapping, bool UseExtProxKey, bool DiversifyProxKey, bool UseProxKey, unsigned ProxKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf ProxKey, size_t ProxKey_len);
487 brp_errcode brp_Mif_GetCardVersion(brp_protocol protocol, brp_buf* CardVersion, size_t* CardVersion_len, brp_mempool *mempool);
496 brp_errcode brp_Mif_ReadSig(brp_protocol protocol, brp_buf* NxpSignature, size_t* NxpSignature_len, brp_mempool *mempool);
525 brp_errcode brp_Mif_VirtualCardSelect(brp_protocol protocol, bool ForceVcsAuthentication, bool UseExtVcSelectKeys, unsigned DiversifyMacKey, bool DiversifyEncKey, bool UseVcSelectKeys, brp_buf IID, size_t IID_len, unsigned EncKeyIdx, unsigned MacKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf EncKey, size_t EncKey_len, brp_buf MacKey, size_t MacKey_len, unsigned* FciType, brp_buf* Fci, size_t* Fci_len, brp_mempool *mempool);
541 brp_errcode brp_Mif_SectorSwitch(brp_protocol protocol, bool L3SectorSwitch, unsigned SectorSwitchKeyIdx, brp_buf SectorSwitchKeyDivData, size_t SectorSwitchKeyDivData_len, brp_Mif_SectorSwitch_SectorSpec_Entry* SectorSpec, size_t SectorSpec_len, brp_buf SectorKeysDivData, size_t SectorKeysDivData_len);
552 brp_errcode brp_Mif_CommitReaderID(brp_protocol protocol, unsigned Block, brp_buf* EncTRI, size_t* EncTRI_len, brp_mempool *mempool);
561 #endif
562 
brp_errcode brp_Mif_ValueSL3(brp_protocol protocol, unsigned NoMacOnResp, unsigned Cmd, unsigned Block, unsigned DestBlock, unsigned Value, brp_buf *TMCounterTMValue, size_t *TMCounterTMValue_len, brp_mempool *mempool)
This command performs an operation on a value block.
brp_errcode brp_Mif_Read(brp_protocol protocol, unsigned Block, brp_buf *BlockData, brp_mempool *mempool)
This command reads data from a specified block of the currently selected card, providing authenticati...
brp_errcode brp_Mif_Halt(brp_protocol protocol)
Switch card to halt state.
unsigned int brp_errcode
This type is used library-wide for passing error codes in the return value of functions.
Definition: errorcodes.h:23
brp_errcode brp_Mif_ChangeValueBackup(brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value)
This command is identical to brp_Mif_ChangeValue(), but can only be used for MIFARE cards which suppo...
brp_errcode brp_Mif_GetCardVersion(brp_protocol protocol, brp_buf *CardVersion, size_t *CardVersion_len, brp_mempool *mempool)
This command returns HW- / SW- / Production-Information.
struct brp_protocol_t * brp_protocol
This is a generic handle of a protocol.
Definition: protocol.h:34
brp_errcode brp_Mif_Request(brp_protocol protocol, unsigned ReqAll, unsigned *ATQA)
Request labels in the field of the antenna.
brp_errcode brp_Mif_ReadSL3(brp_protocol protocol, unsigned NoMacOnCmd, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, unsigned BlockNr, brp_buf *BlockData, size_t *BlockData_len, brp_mempool *mempool)
This command reads blocks from an SL3-authenticated MIFARE Pro card.
brp_errcode brp_Mif_AuthE2(brp_protocol protocol, unsigned AuthMode, unsigned Block, unsigned KeyIdx)
This command authenticates a certain sector of a card using a key from the secure EEPROM of the Balte...
brp_errcode brp_Mif_TransferBlock(brp_protocol protocol, unsigned Block)
This command transfers data from the card's internal Transfer Buffer to a specified block...
struct brp_mempool_object_t * brp_mempool
mempool handle.
Definition: mempool.h:27
brp_errcode brp_Mif_LoadKey(brp_protocol protocol, unsigned KeyIdx, brp_buf Key)
This command writes a MIFARE Classic key to the reader's secure key memory.
brp_errcode brp_Mif_Write(brp_protocol protocol, unsigned Block, brp_buf BlockData)
This command write data to a specified block of the currently selected card, providing authentication...
brp_errcode brp_Mif_ChangeAESKey(brp_protocol protocol, bool KeyHasExtIdx, unsigned NoMacOnResp, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len)
This command changes an AES key on a MIFARE Plus card.
brp_errcode brp_Mif_WriteSL3(brp_protocol protocol, unsigned PlainData, unsigned NoMacOnResp, unsigned Block, brp_buf BlockData, size_t BlockData_len)
This command writes blocks to an SL3-authenticated MIFARE Pro card.
brp_errcode brp_Mif_ChangeValue(brp_protocol protocol, unsigned Mode, unsigned Block, unsigned Value)
This command uses the value block specified by the Block parameter and performs an operation given by...
brp_errcode brp_Mif_SetFraming(brp_protocol protocol, brp_Mif_SetFraming_CommMode CommMode)
This command switches the communication protocol mode for MIFARE Plus EV1 cards.
brp_errcode brp_Mif_Select(brp_protocol protocol, brp_buf Snr, unsigned *SAK)
This command selects a card with a 4 Byte serial number specified in the Snr parameter.
brp_errcode brp_Mif_SectorSwitch(brp_protocol protocol, bool L3SectorSwitch, unsigned SectorSwitchKeyIdx, brp_buf SectorSwitchKeyDivData, size_t SectorSwitchKeyDivData_len, brp_Mif_SectorSwitch_SectorSpec_Entry *SectorSpec, size_t SectorSpec_len, brp_buf SectorKeysDivData, size_t SectorKeysDivData_len)
This command performs a sector switch command (only for EV1 cards).
brp_Mif_SetFraming_CommMode
Defines 14443-4 communication mode for MIFARE Plus EV1 cards.
Definition: typedefs.h:2039
brp_errcode brp_Mif_Anticoll(brp_protocol protocol, unsigned BitCount, brp_buf PreSelSer, brp_buf *Snr, brp_mempool *mempool)
This command performs an anti-collision sequence.
brp_errcode brp_Mif_AuthE2Extended(brp_protocol protocol, unsigned AuthLevel, bool KeyHasExtIdx, unsigned EV1Mode, bool IsKeyB, unsigned Block, unsigned KeyIdx, unsigned KeyExtIdx, brp_buf DivData, size_t DivData_len)
This command is identical to the brp_Mif_AuthE2() command with the exception that it supports stronge...
brp_errcode brp_Mif_ProxCheck(brp_protocol protocol, unsigned M, unsigned DisableIsoWrapping, bool UseExtProxKey, bool DiversifyProxKey, bool UseProxKey, unsigned ProxKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf ProxKey, size_t ProxKey_len)
This command performs a proximity check.
Definition: typedefs.h:2023
brp_errcode brp_Mif_ReadSig(brp_protocol protocol, brp_buf *NxpSignature, size_t *NxpSignature_len, brp_mempool *mempool)
brp_errcode brp_Mif_AuthUserExtended(brp_protocol protocol, unsigned AuthLevel, unsigned EV1Mode, unsigned KeyB, unsigned Block, brp_buf Key, size_t Key_len)
This command is identical to the brp_Mif_AuthUser() command with the exception that it supports stron...
brp_errcode brp_Mif_CommitReaderID(brp_protocol protocol, unsigned Block, brp_buf *EncTRI, size_t *EncTRI_len, brp_mempool *mempool)
This commands commits a reader ID from a card and returns the encrypted TMRI to the host...
brp_errcode brp_Mif_VirtualCardSelect(brp_protocol protocol, bool ForceVcsAuthentication, bool UseExtVcSelectKeys, unsigned DiversifyMacKey, bool DiversifyEncKey, bool UseVcSelectKeys, brp_buf IID, size_t IID_len, unsigned EncKeyIdx, unsigned MacKeyIdx, brp_buf DivData, size_t DivData_len, brp_buf EncKey, size_t EncKey_len, brp_buf MacKey, size_t MacKey_len, unsigned *FciType, brp_buf *Fci, size_t *Fci_len, brp_mempool *mempool)
Command is only supported by MIFARE Plus EV1 cards.
brp_errcode brp_Mif_ResetAuth(brp_protocol protocol)
This command resets the reader's authentication state (used for MIFARE Pro specific Read/Write counte...
unsigned char * brp_buf
represents a pointer to a protocol data buffer.
Definition: common.h:61
brp_errcode brp_Mif_AuthUser(brp_protocol protocol, unsigned AuthMode, unsigned Block, brp_buf Key)
This command authenticates a certain sector of a card using the key specified in the Key variable...