28#ifndef A5000PLUGNTRUST_H
29#define A5000PLUGNTRUST_H
39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
74#define A5000PLUGNTRUST_NAD_WRITE 0x5A
75#define A5000PLUGNTRUST_NAD_READ 0xA5
82#define A5000PLUGNTRUST_PCB_BLOCK_I 0x00
83#define A5000PLUGNTRUST_PCB_BLOCK_I_NS_ENCODE 0x40
84#define A5000PLUGNTRUST_PCB_BLOCK_I_M_CHAIN 0x20
91#define A5000PLUGNTRUST_PCB_BLOCK_R 0x80
92#define A5000PLUGNTRUST_PCB_BLOCK_R_NR_ENCODE 0x10
93#define A5000PLUGNTRUST_PCB_BLOCK_R_ERROR_CRC 0x01
94#define A5000PLUGNTRUST_PCB_BLOCK_R_ERROR_OTHER 0x02
101#define A5000PLUGNTRUST_PCB_BLOCK_S 0xC0
102#define A5000PLUGNTRUST_PCB_BLOCK_S_RESYNC_REQ 0x00
103#define A5000PLUGNTRUST_PCB_BLOCK_S_RESYNC_RSP 0x20
104#define A5000PLUGNTRUST_PCB_BLOCK_S_IFS_REQ 0x01
105#define A5000PLUGNTRUST_PCB_BLOCK_S_IFS_RSP 0x21
106#define A5000PLUGNTRUST_PCB_BLOCK_S_ABORT_REQ 0x02
107#define A5000PLUGNTRUST_PCB_BLOCK_S_ABORT_RSP 0x22
108#define A5000PLUGNTRUST_PCB_BLOCK_S_WTX_REQ 0x03
109#define A5000PLUGNTRUST_PCB_BLOCK_S_WTX_RSP 0x23
110#define A5000PLUGNTRUST_PCB_BLOCK_S_SOFT_RESET_REQ 0x0F
111#define A5000PLUGNTRUST_PCB_BLOCK_S_SOFT_RESET_RSP 0x2F
112#define A5000PLUGNTRUST_PCB_BLOCK_S_END_APDU_SESSION_REQ 0x05
113#define A5000PLUGNTRUST_PCB_BLOCK_S_END_APDU_SESSION_RSP 0x25
114#define A5000PLUGNTRUST_PCB_BLOCK_S_SE_RESET_REQ 0x06
115#define A5000PLUGNTRUST_PCB_BLOCK_S_SE_RESET_RSP 0x26
116#define A5000PLUGNTRUST_PCB_BLOCK_S_GET_ATR_REQ 0x07
117#define A5000PLUGNTRUST_PCB_BLOCK_S_GET_ATR_RSP 0x27
135#define A5000PLUGNTRUST_CLA_SECURE 0x84
136#define A5000PLUGNTRUST_CLA_NOT_SECURE 0x80
142#define A5000PLUGNTRUST_INS_MASK_INS_CHAR 0xE0
143#define A5000PLUGNTRUST_INS_MASK_INSTRUCTION 0x1F
144#define A5000PLUGNTRUST_INS_TRANSIENT 0x80
145#define A5000PLUGNTRUST_INS_AUTH_OBJECT 0x40
146#define A5000PLUGNTRUST_INS_ATTEST 0x20
147#define A5000PLUGNTRUST_INS_WRITE 0x01
148#define A5000PLUGNTRUST_INS_READ 0x02
149#define A5000PLUGNTRUST_INS_CRYPTO 0x03
150#define A5000PLUGNTRUST_INS_MGMT 0x04
151#define A5000PLUGNTRUST_INS_PROCESS 0x05
152#define A5000PLUGNTRUST_INS_IMPORT_EXTERNAL 0x06
158#define A5000PLUGNTRUST_P1_UNUSED 0x80
159#define A5000PLUGNTRUST_P1_MASK_KEY_TYPE 0x60
160#define A5000PLUGNTRUST_P1_MASK_CRED_TYPE 0x1F
161#define A5000PLUGNTRUST_P1_KEY_PAIR 0x60
162#define A5000PLUGNTRUST_P1_PRIVATE 0x40
163#define A5000PLUGNTRUST_P1_PUBLIC 0x20
164#define A5000PLUGNTRUST_P1_DEFAULT 0x00
165#define A5000PLUGNTRUST_P1_EC 0x01
166#define A5000PLUGNTRUST_P1_RSA 0x02
167#define A5000PLUGNTRUST_P1_AES 0x03
168#define A5000PLUGNTRUST_P1_DES 0x04
169#define A5000PLUGNTRUST_P1_HMAC 0x05
170#define A5000PLUGNTRUST_P1_BINARY 0x06
171#define A5000PLUGNTRUST_P1_USERID 0x07
172#define A5000PLUGNTRUST_P1_COUNTER 0x08
173#define A5000PLUGNTRUST_P1_PCR 0x09
174#define A5000PLUGNTRUST_P1_CURVE 0x0B
175#define A5000PLUGNTRUST_P1_SIGNATURE 0x0C
176#define A5000PLUGNTRUST_P1_MAC 0x0D
177#define A5000PLUGNTRUST_P1_CIPHER 0x0E
178#define A5000PLUGNTRUST_P1_TLS 0x0F
179#define A5000PLUGNTRUST_P1_CRYPTO_OBJ 0x10
180#define A5000PLUGNTRUST_P2_DEFAULT 0x00
181#define A5000PLUGNTRUST_P2_GENERATE 0x03
182#define A5000PLUGNTRUST_P2_CREATE 0x04
183#define A5000PLUGNTRUST_P2_SIZE 0x07
184#define A5000PLUGNTRUST_P2_SIGN 0x09
185#define A5000PLUGNTRUST_P2_VERIFY 0x0A
186#define A5000PLUGNTRUST_P2_INIT 0x0B
187#define A5000PLUGNTRUST_P2_UPDATE 0x0C
188#define A5000PLUGNTRUST_P2_FINAL 0x0D
189#define A5000PLUGNTRUST_P2_ONESHOT 0x0E
190#define A5000PLUGNTRUST_P2_DH 0x0F
191#define A5000PLUGNTRUST_P2_DIVERSIFY 0x10
192#define A5000PLUGNTRUST_P2_AUTH_FIRST_PART2 0x12
193#define A5000PLUGNTRUST_P2_AUTH_NONFIRST_PART2 0x13
194#define A5000PLUGNTRUST_P2_DUMP_KEY 0x14
195#define A5000PLUGNTRUST_P2_CHANGE_KEY_PART1 0x15
196#define A5000PLUGNTRUST_P2_CHANGE_KEY_PART2 0x16
197#define A5000PLUGNTRUST_P2_KILL_AUTH 0x17
198#define A5000PLUGNTRUST_P2_IMPORT 0x18
199#define A5000PLUGNTRUST_P2_EXPORT 0x19
200#define A5000PLUGNTRUST_P2_SESSION_CREATE 0x1B
201#define A5000PLUGNTRUST_P2_SESSION_CLOSE 0x1C
202#define A5000PLUGNTRUST_P2_SESSION_REFRESH 0x1E
203#define A5000PLUGNTRUST_P2_SESSION_POLICY 0x1F
204#define A5000PLUGNTRUST_P2_VERSION 0x20
205#define A5000PLUGNTRUST_P2_MEMORY 0x22
206#define A5000PLUGNTRUST_P2_LIST 0x25
207#define A5000PLUGNTRUST_P2_TYPE 0x26
208#define A5000PLUGNTRUST_P2_EXIST 0x27
209#define A5000PLUGNTRUST_P2_DELETE_OBJECT 0x28
210#define A5000PLUGNTRUST_P2_DELETE_ALL 0x2A
211#define A5000PLUGNTRUST_P2_SESSION_USERID 0x2C
212#define A5000PLUGNTRUST_P2_HKDF 0x2D
213#define A5000PLUGNTRUST_P2_PBKDF 0x2E
214#define A5000PLUGNTRUST_P2_I2CM 0x30
215#define A5000PLUGNTRUST_P2_I2CM_ATTESTED 0x31
216#define A5000PLUGNTRUST_P2_MAC 0x32
217#define A5000PLUGNTRUST_P2_UNLOCK_CHALLENGE 0x33
218#define A5000PLUGNTRUST_P2_CURVE_LIST 0x34
219#define A5000PLUGNTRUST_P2_SIGN_ECDAA 0x35
220#define A5000PLUGNTRUST_P2_ID 0x36
221#define A5000PLUGNTRUST_P2_ENCRYPT_ONESHOT 0x37
222#define A5000PLUGNTRUST_P2_DECRYPT_ONESHOT 0x38
223#define A5000PLUGNTRUST_P2_ATTEST 0x3A
224#define A5000PLUGNTRUST_P2_ATTRIBUTES 0x3B
225#define A5000PLUGNTRUST_P2_CPLC 0x3C
226#define A5000PLUGNTRUST_P2_TIME 0x3D
227#define A5000PLUGNTRUST_P2_TRANSPORT 0x3E
228#define A5000PLUGNTRUST_P2_VARIANT 0x3F
229#define A5000PLUGNTRUST_P2_PARAM 0x40
230#define A5000PLUGNTRUST_P2_DELETE_CURVE 0x41
231#define A5000PLUGNTRUST_P2_ENCRYPT 0x42
232#define A5000PLUGNTRUST_P2_DECRYPT 0x43
233#define A5000PLUGNTRUST_P2_VALIDATE 0x44
234#define A5000PLUGNTRUST_P2_GENERATE_ONESHOT 0x45
235#define A5000PLUGNTRUST_P2_VALIDATE_ONESHOT 0x46
236#define A5000PLUGNTRUST_P2_CRYPTO_LIST 0x47
237#define A5000PLUGNTRUST_P2_RANDOM 0x49
238#define A5000PLUGNTRUST_P2_TLS_PMS 0x4A
239#define A5000PLUGNTRUST_P2_TLS_PRF_CLI_HELLO 0x4B
240#define A5000PLUGNTRUST_P2_TLS_PRF_SRV_HELLO 0x4C
241#define A5000PLUGNTRUST_P2_TLS_PRF_CLI_RND 0x4D
242#define A5000PLUGNTRUST_P2_TLS_PRF_SRV_RND 0x4E
243#define A5000PLUGNTRUST_P2_RAW 0x4F
244#define A5000PLUGNTRUST_P2_IMPORT_EXT 0x51
245#define A5000PLUGNTRUST_P2_SCP 0x52
246#define A5000PLUGNTRUST_P2_AUTH_FIRST_PART1 0x53
247#define A5000PLUGNTRUST_P2_AUTH_NONFIRST_PART1 0x54
253#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_EC_KEY_PAIR 0x01
254#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_EC_PRIV_KEY 0x02
255#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_EC_PUB_KEY 0x03
256#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_KEY_PAIR 0x04
257#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_KEY_PAIR_CRT 0x05
258#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PRIV_KEY 0x06
259#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PRIV_KEY_CRT 0x07
260#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PUB_KEY 0x08
261#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_AES_KEY 0x09
262#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_DES_KEY 0x0A
263#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_BINARY_FILE 0x0B
264#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_USERID 0x0C
265#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_COUNTER 0x0D
266#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_PCR 0x0F
267#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_CURVE 0x10
268#define A5000PLUGNTRUST_SECURE_OBJECT_TYPE_HMAC_KEY 0x11
274#define A5000PLUGNTRUST_MEM_PERSISTENT 0x01
275#define A5000PLUGNTRUST_MEM_TRANSIENT_RESET 0x02
276#define A5000PLUGNTRUST_MEM_TRANSIENT_DESELECT 0x03
282#define A5000PLUGNTRUST_ORIGIN_EXTERNAL 0x01
283#define A5000PLUGNTRUST_ORIGIN_INTERNAL 0x02
284#define A5000PLUGNTRUST_ORIGIN_PROVISIONED 0x03
290#define A5000PLUGNTRUST_TLV_TAG_SESSION_ID 0x10
291#define A5000PLUGNTRUST_TLV_TAG_POLICY 0x11
292#define A5000PLUGNTRUST_TLV_TAG_MAX_ATTEMPTS 0x12
293#define A5000PLUGNTRUST_TLV_TAG_IMPORT_AUTH_DATA 0x13
294#define A5000PLUGNTRUST_TLV_TAG_IMPORT_AUTH_KEY_ID 0x14
295#define A5000PLUGNTRUST_TLV_TAG_1 0x41
296#define A5000PLUGNTRUST_TLV_TAG_2 0x42
297#define A5000PLUGNTRUST_TLV_TAG_3 0x43
298#define A5000PLUGNTRUST_TLV_TAG_4 0x44
299#define A5000PLUGNTRUST_TLV_TAG_5 0x45
300#define A5000PLUGNTRUST_TLV_TAG_6 0x46
301#define A5000PLUGNTRUST_TLV_TAG_7 0x47
302#define A5000PLUGNTRUST_TLV_TAG_8 0x48
303#define A5000PLUGNTRUST_TLV_TAG_9 0x49
304#define A5000PLUGNTRUST_TLV_TAG_10 0x4A
310#define A5000PLUGNTRUST_ECS_SIG_ECDSA_PLAIN 0x09
311#define A5000PLUGNTRUST_ECS_SIG_ECDSA_SHA 0x11
312#define A5000PLUGNTRUST_ECS_SIG_ECDSA_SHA_224 0x25
313#define A5000PLUGNTRUST_ECS_SIG_ECDSA_SHA_256 0x21
314#define A5000PLUGNTRUST_ECS_SIG_ECDSA_SHA_384 0x22
315#define A5000PLUGNTRUST_ECS_SIG_ECDSA_SHA_512 0x26
316#define A5000PLUGNTRUST_ECS_SIG_ED25519PH_SHA_512 0xA3
317#define A5000PLUGNTRUST_ECS_SIG_ECDAA 0xF4
323#define A5000PLUGNTRUST_RSA_SHA1_PKCS1_PSS 0x15
324#define A5000PLUGNTRUST_RSA_SHA224_PKCS1_PSS 0x2B
325#define A5000PLUGNTRUST_RSA_SHA256_PKCS1_PSS 0x2C
326#define A5000PLUGNTRUST_RSA_SHA384_PKCS1_PSS 0x2D
327#define A5000PLUGNTRUST_RSA_SHA512_PKCS1_PSS 0x2E
328#define A5000PLUGNTRUST_RSA_SHA1_PKCS1 0x0A
329#define A5000PLUGNTRUST_RSA_SHA_224_PKCS1 0x27
330#define A5000PLUGNTRUST_RSA_SHA_256_PKCS1 0x28
331#define A5000PLUGNTRUST_RSA_SHA_384_PKCS1 0x29
332#define A5000PLUGNTRUST_RSA_SHA_512_PKCS1 0x2A
333#define A5000PLUGNTRUST_RSA_NO_PAD 0x0C
334#define A5000PLUGNTRUST_RSA_PKCS1 0x0A
335#define A5000PLUGNTRUST_RSA_PKCS1_OAEP 0x0F
336#define A5000PLUGNTRUST_RSA_512 512
337#define A5000PLUGNTRUST_RSA_1024 1024
338#define A5000PLUGNTRUST_RSA_1152 1152
339#define A5000PLUGNTRUST_RSA_2048 2048
340#define A5000PLUGNTRUST_RSA_3072 3072
341#define A5000PLUGNTRUST_RSA_4096 4096
342#define A5000PLUGNTRUST_RSA_COMP_MOD 0x00
343#define A5000PLUGNTRUST_RSA_COMP_PUB_EXP 0x01
344#define A5000PLUGNTRUST_RSA_COMP_PRIV_EXP 0x02
345#define A5000PLUGNTRUST_RSA_COMP_P 0x03
346#define A5000PLUGNTRUST_RSA_COMP_Q 0x04
347#define A5000PLUGNTRUST_RSA_COMP_DP 0x05
348#define A5000PLUGNTRUST_RSA_COMP_DQ 0x06
349#define A5000PLUGNTRUST_RSA_COMP_INVQ 0x07
355#define A5000PLUGNTRUST_DIGEST_NO_HASH 0x00
356#define A5000PLUGNTRUST_DIGEST_SHA 0x01
357#define A5000PLUGNTRUST_DIGEST_SHA224 0x07
358#define A5000PLUGNTRUST_DIGEST_SHA256 0x04
359#define A5000PLUGNTRUST_DIGEST_SHA384 0x05
360#define A5000PLUGNTRUST_DIGEST_SHA512 0x06
366#define A5000PLUGNTRUST_HMAC_SHA1 0x18
367#define A5000PLUGNTRUST_HMAC_SHA256 0x19
368#define A5000PLUGNTRUST_HMAC_SHA384 0x1A
369#define A5000PLUGNTRUST_HMAC_SHA512 0x1B
370#define A5000PLUGNTRUST_CMAC_128 0x31
376#define A5000PLUGNTRUST_ECC_UNUSED 0x00
377#define A5000PLUGNTRUST_ECC_NIST_P192 0x01
378#define A5000PLUGNTRUST_ECC_NIST_P224 0x02
379#define A5000PLUGNTRUST_ECC_NIST_P256 0x03
380#define A5000PLUGNTRUST_ECC_NIST_P384 0x04
381#define A5000PLUGNTRUST_ECC_NIST_P521 0x05
382#define A5000PLUGNTRUST_ECC_Brainpool160 0x06
383#define A5000PLUGNTRUST_ECC_Brainpool192 0x07
384#define A5000PLUGNTRUST_ECC_Brainpool224 0x08
385#define A5000PLUGNTRUST_ECC_Brainpool256 0x09
386#define A5000PLUGNTRUST_ECC_Brainpool320 0x0A
387#define A5000PLUGNTRUST_ECC_Brainpool384 0x0B
388#define A5000PLUGNTRUST_ECC_Brainpool512 0x0C
389#define A5000PLUGNTRUST_ECC_Secp160k1 0x0D
390#define A5000PLUGNTRUST_ECC_Secp192k1 0x0E
391#define A5000PLUGNTRUST_ECC_Secp224k1 0x0F
392#define A5000PLUGNTRUST_ECC_Secp256k1 0x10
393#define A5000PLUGNTRUST_ECC_TPM_ECC_BN_P256 0x11
394#define A5000PLUGNTRUST_ECC_ID_ECC_ED_25519 0x40
395#define A5000PLUGNTRUST_ECC_ID_ECC_MONT_DH_25519 0x41
396#define A5000PLUGNTRUST_ECC_CURVE_PARAM_A 0x01
397#define A5000PLUGNTRUST_ECC_CURVE_PARAM_B 0x02
398#define A5000PLUGNTRUST_ECC_CURVE_PARAM_G 0x04
399#define A5000PLUGNTRUST_ECC_CURVE_PARAM_N 0x08
400#define A5000PLUGNTRUST_ECC_CURVE_PARAM_PRIME 0x10
406#define A5000PLUGNTRUST_CIPHER_DES_CBC_NOPAD 0x01
407#define A5000PLUGNTRUST_CIPHER_DES_CBC_ISO9797_M1 0x02
408#define A5000PLUGNTRUST_CIPHER_DES_CBC_ISO9797_M2 0x03
409#define A5000PLUGNTRUST_CIPHER_DES_CBC_PKCS5 0x04
410#define A5000PLUGNTRUST_CIPHER_DES_ECB_NOPAD 0x05
411#define A5000PLUGNTRUST_CIPHER_DES_ECB_ISO9797_M1 0x06
412#define A5000PLUGNTRUST_CIPHER_DES_ECB_ISO9797_M2 0x07
413#define A5000PLUGNTRUST_CIPHER_DES_ECB_PKCS5 0x08
414#define A5000PLUGNTRUST_CIPHER_AES_ECB_NOPAD 0x0E
415#define A5000PLUGNTRUST_CIPHER_AES_CBC_NOPAD 0x0D
416#define A5000PLUGNTRUST_CIPHER_AES_CBC_ISO9797_M1 0x16
417#define A5000PLUGNTRUST_CIPHER_AES_CBC_ISO9797_M2 0x17
418#define A5000PLUGNTRUST_CIPHER_AES_CBC_PKCS5 0x18
419#define A5000PLUGNTRUST_CIPHER_AES_CTR 0xF0
425#define A5000PLUGNTRUST_CONFIG_ECDAA 0x0001
426#define A5000PLUGNTRUST_CONFIG_ECDSA_ECDH_ECDHE 0x0002
427#define A5000PLUGNTRUST_CONFIG_EDDSA 0x0004
428#define A5000PLUGNTRUST_CONFIG_DH_MONT 0x0008
429#define A5000PLUGNTRUST_CONFIG_HMAC 0x0010
430#define A5000PLUGNTRUST_CONFIG_RSA_PLAIN 0x0020
431#define A5000PLUGNTRUST_CONFIG_RSA_CRT 0x0040
432#define A5000PLUGNTRUST_CONFIG_AES 0x0080
433#define A5000PLUGNTRUST_CONFIG_DES 0x0100
434#define A5000PLUGNTRUST_CONFIG_PBKDF 0x0200
435#define A5000PLUGNTRUST_CONFIG_TLS 0x0400
436#define A5000PLUGNTRUST_CONFIG_MIFARE 0x0800
437#define A5000PLUGNTRUST_CONFIG_FIPS_MODE_DISABLED 0x1000
438#define A5000PLUGNTRUST_CONFIG_I2CM 0x2000
439#define A5000PLUGNTRUST_CONFIG_ECC_ALL 0x000F
440#define A5000PLUGNTRUST_CONFIG_RSA_ALL 0x0060
441#define A5000PLUGNTRUST_CONFIG_ALL 0x3FFF
447#define A5000PLUGNTRUST_TRANSIENT_LOCK 0x01
448#define A5000PLUGNTRUST_PERSISTENT_LOCK 0x02
454#define A5000PLUGNTRUST_LOCKED 0x01
460#define A5000PLUGNTRUST_CC_DIGEST 0x01
461#define A5000PLUGNTRUST_CC_CIPHER 0x02
462#define A5000PLUGNTRUST_CC_SIGNATURE 0x03
468#define A5000PLUGNTRUST_RESULT_SUCCESS 0x01
469#define A5000PLUGNTRUST_RESULT_FAILURE 0x02
475#define A5000PLUGNTRUST_PERSISTENT 0x01
476#define A5000PLUGNTRUST_TRANSIENT 0x02
482#define A5000PLUGNTRUST_NOT_SET 0x01
483#define A5000PLUGNTRUST_SET 0x02
489#define A5000PLUGNTRUST_NO_MORE 0x01
490#define A5000PLUGNTRUST_MORE 0x02
496#define A5000PLUGNTRUST_SCP_REQUIRED 0x01
497#define A5000PLUGNTRUST_SCP_NOT_REQUIRED 0x02
503#define A5000PLUGNTRUST_APPLET_RES_ID_TRANSPORT 0x7FFF0200ul
504#define A5000PLUGNTRUST_APPLET_RES_ID_KP_FASTSCP_USER 0x7FFF0201ul
505#define A5000PLUGNTRUST_APPLET_RES_ID_KP_FASTSCP_IMPORT 0x7FFF0202ul
506#define A5000PLUGNTRUST_APPLET_RES_ID_PUB_FASTSCP_IMPORT 0x7FFF0203ul
507#define A5000PLUGNTRUST_APPLET_RES_ID_FEATURE 0x7FFF0204ul
508#define A5000PLUGNTRUST_APPLET_RES_ID_FACTORY_RESET 0x7FFF0205ul
509#define A5000PLUGNTRUST_APPLET_RES_ID_UNIQUE_ID 0x7FFF0206ul
510#define A5000PLUGNTRUST_APPLET_RES_ID_PLATFORM_SCP 0x7FFF0207ul
516#define A5000PLUGNTRUST_SW_NOERROR 0x9000
517#define A5000PLUGNTRUST_SW_CONDITIONS_NOT_SATISFIED 0x6985
518#define A5000PLUGNTRUST_SW_SECURITY_STATUS 0x6982
519#define A5000PLUGNTRUST_SW_WRONG_DATA 0x6A80
520#define A5000PLUGNTRUST_SW_DATA_INVALID 0x6984
521#define A5000PLUGNTRUST_SW_COMMAND_NOT_ALLOWED 0x6986
527#define A5000PLUGNTRUST_OBJECT_DOES_EXISTS 1
528#define A5000PLUGNTRUST_OBJECT_DOESNT_EXIST 2
534#define A5000PLUGNTRUST_OBJID_SE05X_APPLET_RES_START 0x7FFF0000ul
535#define A5000PLUGNTRUST_SSS_OBJID_DEMO_AUTH_START 0x7DA00000ul
536#define A5000PLUGNTRUST_SSS_OBJID_IOT_HUB_A_START 0xF0000000ul
542#define A5000PLUGNTRUST_OBJID_APPLET_MASK 0xFFFF0000ul
543#define A5000PLUGNTRUST_OBJID_IOT_MASK 0xF0000000ul
562#define A5000PLUGNTRUST_CARD_MANAGER_WITH_RSP 1
563#define A5000PLUGNTRUST_CARD_MANAGER_WITHOUT_RSP 0
570#define A5000PLUGNTRUST_DEVICE_ADDRESS 0x48
588#define A5000PLUGNTRUST_MAP_MIKROBUS( cfg, mikrobus ) \
589 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
590 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
591 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS );
640 uint8_t payload[ 0xFF ];
667 uint8_t vendor_id[ 5 ];
670 uint8_t data_link_layer_parameters[ 0x04 ];
675 uint8_t physical_layer_parameters[ 0x0B ];
678 uint8_t historical[ 0x0A ];
973 uint8_t tag, uint8_t *rsp, uint32_t *rsp_len );
1054 uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len );
1143 uint16_t read_len, uint8_t *data_buf, uint32_t *data_len );
1164 uint16_t data_len, uint8_t *data_buf );
a5000plugntrust_return_value_t
A5000 Plug n Trust Click return value data.
Definition a5000plugntrust.h:702
@ A5000PLUGNTRUST_OK
Definition a5000plugntrust.h:703
@ A5000PLUGNTRUST_ERROR_DATA_OVF
Definition a5000plugntrust.h:706
@ A5000PLUGNTRUST_ERROR_TIMEOUT
Definition a5000plugntrust.h:705
@ A5000PLUGNTRUST_ERROR
Definition a5000plugntrust.h:704
void a5000plugntrust_set_tlv_u16_optional(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
Add TLV data of 2 bytes value in payload buffer if value is greater then 0.
err_t a5000plugntrust_sw_reset(a5000plugntrust_t *ctx, a5000plugntrust_atr_t *atr_data)
Sends request to reset device and reads ATR data.
err_t a5000plugntrust_get_applet_info(a5000plugntrust_t *ctx, a5000plugntrust_version_info_t *ver_info)
Get Version info from Applet.
err_t a5000plugntrust_object_id_list(a5000plugntrust_t *ctx, uint32_t *id_list, uint8_t *list_len)
Reads all Object ID's from Applet.
err_t a5000plugntrust_get_free_memory(a5000plugntrust_t *ctx, uint8_t memory_type, uint16_t *free_memory)
Reads Applet free memory.
err_t a5000plugntrust_set_tlv_u8buf(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
Add TLV data buffer in payload buffer.
err_t a5000plugntrust_apdu_transfer(a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
Write-Read frame data function.
uint8_t a5000plugntrust_calculate_apdu_size(a5000plugntrust_apdu_t *apdu_data)
Calculates APDU object size.
err_t a5000plugntrust_end_apdu_session(a5000plugntrust_t *ctx)
Sends command for ending APDU session.
err_t a5000plugntrust_init(a5000plugntrust_t *ctx, a5000plugntrust_cfg_t *cfg)
A5000 Plug n Trust initialization function.
void a5000plugntrust_set_en(a5000plugntrust_t *ctx, uint8_t state)
Set Enable pin state.
err_t a5000plugntrust_get_tlv_u8(uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint8_t *rsp)
Parses TLV data from payload buffer to find data for desired tag.
err_t a5000plugntrust_apdu_read(a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
Reading frame data function function.
void a5000plugntrust_set_tlv_u32(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint32_t value)
Add TLV data of 4 bytes value in payload buffer.
err_t a5000plugntrust_get_random_numbers(a5000plugntrust_t *ctx, uint8_t *random_buf, uint8_t buf_len)
Get random data.
err_t a5000plugntrust_apdu_write(a5000plugntrust_t *ctx, a5000plugntrust_frame_data_t *frame_data)
Writing frame data function.
err_t a5000plugntrust_get_tlv_u16(uint8_t *buf, uint32_t *buf_index, uint8_t tag, uint16_t *rsp)
Parses TLV data from payload buffer to find data for desired tag.
err_t a5000plugntrust_check_object_exist(a5000plugntrust_t *ctx, uint32_t object_id)
Check if object exists.
err_t a5000plugntrust_read_object(a5000plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t read_len, uint8_t *data_buf, uint32_t *data_len)
Read object data.
void a5000plugntrust_set_tlv_u8(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t value)
Add TLV data of 1 byte value in payload buffer.
err_t a5000plugntrust_select_applet(a5000plugntrust_t *ctx, uint8_t ns_encode, a5000plugntrust_version_info_t *ver_info)
Selects Clicks Applet and returns info that device sends back to host.
err_t a5000plugntrust_delete_object(a5000plugntrust_t *ctx, uint32_t object_id)
Delete object.
err_t a5000plugntrust_select_card_manager(a5000plugntrust_t *ctx, uint8_t rsp, uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len)
Select card manager.
err_t a5000plugntrust_get_tlv_u8buf(uint8_t *buf, uint32_t *buf_index, uint8_t buf_len, uint8_t tag, uint8_t *rsp, uint32_t *rsp_len)
Parses TLV data from payload buffer to find data for desired tag.
void a5000plugntrust_set_tlv_u16(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint16_t value)
Add TLV data of 2 bytes value in payload buffer.
err_t a5000plugntrust_write_binary_object(a5000plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t data_len, uint8_t *data_buf)
Create/Write to binary object.
err_t a5000plugntrust_set_tlv_u8buf_optional(uint8_t *buf, uint8_t *buf_len, uint8_t tag, uint8_t *cmd, uint32_t cmd_len)
Add TLV data buffer in payload buffer if TLV data buffer length greater then 0.
void a5000plugntrust_cfg_setup(a5000plugntrust_cfg_t *cfg)
A5000 Plug n Trust configuration object setup function.
APDU data object.
Definition a5000plugntrust.h:634
uint16_t rsp_len
Definition a5000plugntrust.h:641
uint8_t p1
Definition a5000plugntrust.h:637
uint8_t p2
Definition a5000plugntrust.h:638
uint16_t status
Definition a5000plugntrust.h:642
uint8_t cla
Definition a5000plugntrust.h:635
uint8_t ins
Definition a5000plugntrust.h:636
uint8_t payload_len
Definition a5000plugntrust.h:639
Data after reset.
Definition a5000plugntrust.h:665
uint8_t protocol_version
Definition a5000plugntrust.h:666
uint8_t physical_layer_id
Definition a5000plugntrust.h:672
uint8_t data_link_layer_parameters_len
Definition a5000plugntrust.h:669
uint8_t historical_len
Definition a5000plugntrust.h:677
uint8_t physical_layer_parameters_len
Definition a5000plugntrust.h:674
A5000 Plug n Trust Click configuration object.
Definition a5000plugntrust.h:618
uint32_t i2c_speed
Definition a5000plugntrust.h:624
pin_name_t scl
Definition a5000plugntrust.h:619
pin_name_t en
Definition a5000plugntrust.h:622
pin_name_t sda
Definition a5000plugntrust.h:620
uint8_t i2c_address
Definition a5000plugntrust.h:625
Communication frame data object.
Definition a5000plugntrust.h:651
uint8_t nad
Definition a5000plugntrust.h:652
a5000plugntrust_apdu_t * apdu
Definition a5000plugntrust.h:655
uint16_t crc16
Definition a5000plugntrust.h:656
uint8_t len
Definition a5000plugntrust.h:654
uint8_t pcb
Definition a5000plugntrust.h:653
A5000 Plug n Trust Click context object.
Definition a5000plugntrust.h:601
i2c_master_t i2c
Definition a5000plugntrust.h:606
digital_out_t en
Definition a5000plugntrust.h:603
uint8_t slave_address
Definition a5000plugntrust.h:609
Version info data.
Definition a5000plugntrust.h:687
uint8_t patch_version
Definition a5000plugntrust.h:690
uint16_t secure_box
Definition a5000plugntrust.h:693
uint8_t minor_version
Definition a5000plugntrust.h:689
uint8_t major_version
Definition a5000plugntrust.h:688
uint16_t applet_config
Definition a5000plugntrust.h:692