Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
60 #define PLUGNTRUST_NAD_WRITE 0x5A
61 #define PLUGNTRUST_NAD_READ 0xA5
68 #define PLUGNTRUST_PCB_BLOCK_I 0x00
69 #define PLUGNTRUST_PCB_BLOCK_I_NS_ENCODE 0x40
70 #define PLUGNTRUST_PCB_BLOCK_I_M_CHAIN 0x20
77 #define PLUGNTRUST_PCB_BLOCK_R 0x80
78 #define PLUGNTRUST_PCB_BLOCK_R_NR_ENCODE 0x10
79 #define PLUGNTRUST_PCB_BLOCK_R_ERROR_CRC 0x01
80 #define PLUGNTRUST_PCB_BLOCK_R_ERROR_OTHER 0x02
87 #define PLUGNTRUST_PCB_BLOCK_S 0xC0
88 #define PLUGNTRUST_PCB_BLOCK_S_RESYNC_REQ 0x00
89 #define PLUGNTRUST_PCB_BLOCK_S_RESYNC_RSP 0x20
90 #define PLUGNTRUST_PCB_BLOCK_S_IFS_REQ 0x01
91 #define PLUGNTRUST_PCB_BLOCK_S_IFS_RSP 0x21
92 #define PLUGNTRUST_PCB_BLOCK_S_ABORT_REQ 0x02
93 #define PLUGNTRUST_PCB_BLOCK_S_ABORT_RSP 0x22
94 #define PLUGNTRUST_PCB_BLOCK_S_WTX_REQ 0x03
95 #define PLUGNTRUST_PCB_BLOCK_S_WTX_RSP 0x23
96 #define PLUGNTRUST_PCB_BLOCK_S_SOFT_RESET_REQ 0x0F
97 #define PLUGNTRUST_PCB_BLOCK_S_SOFT_RESET_RSP 0x2F
98 #define PLUGNTRUST_PCB_BLOCK_S_END_APDU_SESSION_REQ 0x05
99 #define PLUGNTRUST_PCB_BLOCK_S_END_APDU_SESSION_RSP 0x25
100 #define PLUGNTRUST_PCB_BLOCK_S_SE_RESET_REQ 0x06
101 #define PLUGNTRUST_PCB_BLOCK_S_SE_RESET_RSP 0x26
102 #define PLUGNTRUST_PCB_BLOCK_S_GET_ATR_REQ 0x07
103 #define PLUGNTRUST_PCB_BLOCK_S_GET_ATR_RSP 0x27
122 #define PLUGNTRUST_CLA_SECURE 0x84
123 #define PLUGNTRUST_CLA_NOT_SECURE 0x80
129 #define PLUGNTRUST_INS_MASK_INS_CHAR 0xE0
130 #define PLUGNTRUST_INS_MASK_INSTRUCTION 0x1F
131 #define PLUGNTRUST_INS_TRANSIENT 0x80
132 #define PLUGNTRUST_INS_AUTH_OBJECT 0x40
133 #define PLUGNTRUST_INS_ATTEST 0x20
134 #define PLUGNTRUST_INS_WRITE 0x01
135 #define PLUGNTRUST_INS_READ 0x02
136 #define PLUGNTRUST_INS_CRYPTO 0x03
137 #define PLUGNTRUST_INS_MGMT 0x04
138 #define PLUGNTRUST_INS_PROCESS 0x05
139 #define PLUGNTRUST_INS_IMPORT_EXTERNAL 0x06
145 #define PLUGNTRUST_P1_UNUSED 0x80
146 #define PLUGNTRUST_P1_MASK_KEY_TYPE 0x60
147 #define PLUGNTRUST_P1_MASK_CRED_TYPE 0x1F
148 #define PLUGNTRUST_P1_KEY_PAIR 0x60
149 #define PLUGNTRUST_P1_PRIVATE 0x40
150 #define PLUGNTRUST_P1_PUBLIC 0x20
151 #define PLUGNTRUST_P1_DEFAULT 0x00
152 #define PLUGNTRUST_P1_EC 0x01
153 #define PLUGNTRUST_P1_RSA 0x02
154 #define PLUGNTRUST_P1_AES 0x03
155 #define PLUGNTRUST_P1_DES 0x04
156 #define PLUGNTRUST_P1_HMAC 0x05
157 #define PLUGNTRUST_P1_BINARY 0x06
158 #define PLUGNTRUST_P1_USERID 0x07
159 #define PLUGNTRUST_P1_COUNTER 0x08
160 #define PLUGNTRUST_P1_PCR 0x09
161 #define PLUGNTRUST_P1_CURVE 0x0B
162 #define PLUGNTRUST_P1_SIGNATURE 0x0C
163 #define PLUGNTRUST_P1_MAC 0x0D
164 #define PLUGNTRUST_P1_CIPHER 0x0E
165 #define PLUGNTRUST_P1_TLS 0x0F
166 #define PLUGNTRUST_P1_CRYPTO_OBJ 0x10
168 #define PLUGNTRUST_P2_DEFAULT 0x00
169 #define PLUGNTRUST_P2_GENERATE 0x03
170 #define PLUGNTRUST_P2_CREATE 0x04
171 #define PLUGNTRUST_P2_SIZE 0x07
172 #define PLUGNTRUST_P2_SIGN 0x09
173 #define PLUGNTRUST_P2_VERIFY 0x0A
174 #define PLUGNTRUST_P2_INIT 0x0B
175 #define PLUGNTRUST_P2_UPDATE 0x0C
176 #define PLUGNTRUST_P2_FINAL 0x0D
177 #define PLUGNTRUST_P2_ONESHOT 0x0E
178 #define PLUGNTRUST_P2_DH 0x0F
179 #define PLUGNTRUST_P2_DIVERSIFY 0x10
180 #define PLUGNTRUST_P2_AUTH_FIRST_PART2 0x12
181 #define PLUGNTRUST_P2_AUTH_NONFIRST_PART2 0x13
182 #define PLUGNTRUST_P2_DUMP_KEY 0x14
183 #define PLUGNTRUST_P2_CHANGE_KEY_PART1 0x15
184 #define PLUGNTRUST_P2_CHANGE_KEY_PART2 0x16
185 #define PLUGNTRUST_P2_KILL_AUTH 0x17
186 #define PLUGNTRUST_P2_IMPORT 0x18
187 #define PLUGNTRUST_P2_EXPORT 0x19
188 #define PLUGNTRUST_P2_SESSION_CREATE 0x1B
189 #define PLUGNTRUST_P2_SESSION_CLOSE 0x1C
190 #define PLUGNTRUST_P2_SESSION_REFRESH 0x1E
191 #define PLUGNTRUST_P2_SESSION_POLICY 0x1F
192 #define PLUGNTRUST_P2_VERSION 0x20
193 #define PLUGNTRUST_P2_MEMORY 0x22
194 #define PLUGNTRUST_P2_LIST 0x25
195 #define PLUGNTRUST_P2_TYPE 0x26
196 #define PLUGNTRUST_P2_EXIST 0x27
197 #define PLUGNTRUST_P2_DELETE_OBJECT 0x28
198 #define PLUGNTRUST_P2_DELETE_ALL 0x2A
199 #define PLUGNTRUST_P2_SESSION_USERID 0x2C
200 #define PLUGNTRUST_P2_HKDF 0x2D
201 #define PLUGNTRUST_P2_PBKDF 0x2E
202 #define PLUGNTRUST_P2_I2CM 0x30
203 #define PLUGNTRUST_P2_I2CM_ATTESTED 0x31
204 #define PLUGNTRUST_P2_MAC 0x32
205 #define PLUGNTRUST_P2_UNLOCK_CHALLENGE 0x33
206 #define PLUGNTRUST_P2_CURVE_LIST 0x34
207 #define PLUGNTRUST_P2_SIGN_ECDAA 0x35
208 #define PLUGNTRUST_P2_ID 0x36
209 #define PLUGNTRUST_P2_ENCRYPT_ONESHOT 0x37
210 #define PLUGNTRUST_P2_DECRYPT_ONESHOT 0x38
211 #define PLUGNTRUST_P2_ATTEST 0x3A
212 #define PLUGNTRUST_P2_ATTRIBUTES 0x3B
213 #define PLUGNTRUST_P2_CPLC 0x3C
214 #define PLUGNTRUST_P2_TIME 0x3D
215 #define PLUGNTRUST_P2_TRANSPORT 0x3E
216 #define PLUGNTRUST_P2_VARIANT 0x3F
217 #define PLUGNTRUST_P2_PARAM 0x40
218 #define PLUGNTRUST_P2_DELETE_CURVE 0x41
219 #define PLUGNTRUST_P2_ENCRYPT 0x42
220 #define PLUGNTRUST_P2_DECRYPT 0x43
221 #define PLUGNTRUST_P2_VALIDATE 0x44
222 #define PLUGNTRUST_P2_GENERATE_ONESHOT 0x45
223 #define PLUGNTRUST_P2_VALIDATE_ONESHOT 0x46
224 #define PLUGNTRUST_P2_CRYPTO_LIST 0x47
225 #define PLUGNTRUST_P2_RANDOM 0x49
226 #define PLUGNTRUST_P2_TLS_PMS 0x4A
227 #define PLUGNTRUST_P2_TLS_PRF_CLI_HELLO 0x4B
228 #define PLUGNTRUST_P2_TLS_PRF_SRV_HELLO 0x4C
229 #define PLUGNTRUST_P2_TLS_PRF_CLI_RND 0x4D
230 #define PLUGNTRUST_P2_TLS_PRF_SRV_RND 0x4E
231 #define PLUGNTRUST_P2_RAW 0x4F
232 #define PLUGNTRUST_P2_IMPORT_EXT 0x51
233 #define PLUGNTRUST_P2_SCP 0x52
234 #define PLUGNTRUST_P2_AUTH_FIRST_PART1 0x53
235 #define PLUGNTRUST_P2_AUTH_NONFIRST_PART1 0x54
241 #define PLUGNTRUST_SECURE_OBJECT_TYPE_EC_KEY_PAIR 0x01
242 #define PLUGNTRUST_SECURE_OBJECT_TYPE_EC_PRIV_KEY 0x02
243 #define PLUGNTRUST_SECURE_OBJECT_TYPE_EC_PUB_KEY 0x03
244 #define PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_KEY_PAIR 0x04
245 #define PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_KEY_PAIR_CRT 0x05
246 #define PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PRIV_KEY 0x06
247 #define PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PRIV_KEY_CRT 0x07
248 #define PLUGNTRUST_SECURE_OBJECT_TYPE_RSA_PUB_KEY 0x08
249 #define PLUGNTRUST_SECURE_OBJECT_TYPE_AES_KEY 0x09
250 #define PLUGNTRUST_SECURE_OBJECT_TYPE_DES_KEY 0x0A
251 #define PLUGNTRUST_SECURE_OBJECT_TYPE_BINARY_FILE 0x0B
252 #define PLUGNTRUST_SECURE_OBJECT_TYPE_USERID 0x0C
253 #define PLUGNTRUST_SECURE_OBJECT_TYPE_COUNTER 0x0D
254 #define PLUGNTRUST_SECURE_OBJECT_TYPE_PCR 0x0F
255 #define PLUGNTRUST_SECURE_OBJECT_TYPE_CURVE 0x10
256 #define PLUGNTRUST_SECURE_OBJECT_TYPE_HMAC_KEY 0x11
262 #define PLUGNTRUST_MEM_PERSISTENT 0x01
263 #define PLUGNTRUST_MEM_TRANSIENT_RESET 0x02
264 #define PLUGNTRUST_MEM_TRANSIENT_DESELECT 0x03
270 #define PLUGNTRUST_ORIGIN_EXTERNAL 0x01
271 #define PLUGNTRUST_ORIGIN_INTERNAL 0x02
272 #define PLUGNTRUST_ORIGIN_PROVISIONED 0x03
278 #define PLUGNTRUST_TLV_TAG_SESSION_ID 0x10
279 #define PLUGNTRUST_TLV_TAG_POLICY 0x11
280 #define PLUGNTRUST_TLV_TAG_MAX_ATTEMPTS 0x12
281 #define PLUGNTRUST_TLV_TAG_IMPORT_AUTH_DATA 0x13
282 #define PLUGNTRUST_TLV_TAG_IMPORT_AUTH_KEY_ID 0x14
283 #define PLUGNTRUST_TLV_TAG_1 0x41
284 #define PLUGNTRUST_TLV_TAG_2 0x42
285 #define PLUGNTRUST_TLV_TAG_3 0x43
286 #define PLUGNTRUST_TLV_TAG_4 0x44
287 #define PLUGNTRUST_TLV_TAG_5 0x45
288 #define PLUGNTRUST_TLV_TAG_6 0x46
289 #define PLUGNTRUST_TLV_TAG_7 0x47
290 #define PLUGNTRUST_TLV_TAG_8 0x48
291 #define PLUGNTRUST_TLV_TAG_9 0x49
292 #define PLUGNTRUST_TLV_TAG_10 0x4A
298 #define PLUGNTRUST_ECS_SIG_ECDSA_PLAIN 0x09
299 #define PLUGNTRUST_ECS_SIG_ECDSA_SHA 0x11
300 #define PLUGNTRUST_ECS_SIG_ECDSA_SHA_224 0x25
301 #define PLUGNTRUST_ECS_SIG_ECDSA_SHA_256 0x21
302 #define PLUGNTRUST_ECS_SIG_ECDSA_SHA_384 0x22
303 #define PLUGNTRUST_ECS_SIG_ECDSA_SHA_512 0x26
304 #define PLUGNTRUST_ECS_SIG_ED25519PH_SHA_512 0xA3
305 #define PLUGNTRUST_ECS_SIG_ECDAA 0xF4
311 #define PLUGNTRUST_RSA_SHA1_PKCS1_PSS 0x15
312 #define PLUGNTRUST_RSA_SHA224_PKCS1_PSS 0x2B
313 #define PLUGNTRUST_RSA_SHA256_PKCS1_PSS 0x2C
314 #define PLUGNTRUST_RSA_SHA384_PKCS1_PSS 0x2D
315 #define PLUGNTRUST_RSA_SHA512_PKCS1_PSS 0x2E
316 #define PLUGNTRUST_RSA_SHA1_PKCS1 0x0A
317 #define PLUGNTRUST_RSA_SHA_224_PKCS1 0x27
318 #define PLUGNTRUST_RSA_SHA_256_PKCS1 0x28
319 #define PLUGNTRUST_RSA_SHA_384_PKCS1 0x29
320 #define PLUGNTRUST_RSA_SHA_512_PKCS1 0x2A
321 #define PLUGNTRUST_RSA_NO_PAD 0x0C
322 #define PLUGNTRUST_RSA_PKCS1 0x0A
323 #define PLUGNTRUST_RSA_PKCS1_OAEP 0x0F
324 #define PLUGNTRUST_RSA_512 512
325 #define PLUGNTRUST_RSA_1024 1024
326 #define PLUGNTRUST_RSA_1152 1152
327 #define PLUGNTRUST_RSA_2048 2048
328 #define PLUGNTRUST_RSA_3072 3072
329 #define PLUGNTRUST_RSA_4096 4096
330 #define PLUGNTRUST_RSA_COMP_MOD 0x00
331 #define PLUGNTRUST_RSA_COMP_PUB_EXP 0x01
332 #define PLUGNTRUST_RSA_COMP_PRIV_EXP 0x02
333 #define PLUGNTRUST_RSA_COMP_P 0x03
334 #define PLUGNTRUST_RSA_COMP_Q 0x04
335 #define PLUGNTRUST_RSA_COMP_DP 0x05
336 #define PLUGNTRUST_RSA_COMP_DQ 0x06
337 #define PLUGNTRUST_RSA_COMP_INVQ 0x07
343 #define PLUGNTRUST_DIGEST_NO_HASH 0x00
344 #define PLUGNTRUST_DIGEST_SHA 0x01
345 #define PLUGNTRUST_DIGEST_SHA224 0x07
346 #define PLUGNTRUST_DIGEST_SHA256 0x04
347 #define PLUGNTRUST_DIGEST_SHA384 0x05
348 #define PLUGNTRUST_DIGEST_SHA512 0x06
354 #define PLUGNTRUST_HMAC_SHA1 0x18
355 #define PLUGNTRUST_HMAC_SHA256 0x19
356 #define PLUGNTRUST_HMAC_SHA384 0x1A
357 #define PLUGNTRUST_HMAC_SHA512 0x1B
358 #define PLUGNTRUST_CMAC_128 0x31
364 #define PLUGNTRUST_ECC_UNUSED 0x00
365 #define PLUGNTRUST_ECC_NIST_P192 0x01
366 #define PLUGNTRUST_ECC_NIST_P224 0x02
367 #define PLUGNTRUST_ECC_NIST_P256 0x03
368 #define PLUGNTRUST_ECC_NIST_P384 0x04
369 #define PLUGNTRUST_ECC_NIST_P521 0x05
370 #define PLUGNTRUST_ECC_Brainpool160 0x06
371 #define PLUGNTRUST_ECC_Brainpool192 0x07
372 #define PLUGNTRUST_ECC_Brainpool224 0x08
373 #define PLUGNTRUST_ECC_Brainpool256 0x09
374 #define PLUGNTRUST_ECC_Brainpool320 0x0A
375 #define PLUGNTRUST_ECC_Brainpool384 0x0B
376 #define PLUGNTRUST_ECC_Brainpool512 0x0C
377 #define PLUGNTRUST_ECC_Secp160k1 0x0D
378 #define PLUGNTRUST_ECC_Secp192k1 0x0E
379 #define PLUGNTRUST_ECC_Secp224k1 0x0F
380 #define PLUGNTRUST_ECC_Secp256k1 0x10
381 #define PLUGNTRUST_ECC_TPM_ECC_BN_P256 0x11
382 #define PLUGNTRUST_ECC_ID_ECC_ED_25519 0x40
383 #define PLUGNTRUST_ECC_ID_ECC_MONT_DH_25519 0x41
384 #define PLUGNTRUST_ECC_CURVE_PARAM_A 0x01
385 #define PLUGNTRUST_ECC_CURVE_PARAM_B 0x02
386 #define PLUGNTRUST_ECC_CURVE_PARAM_G 0x04
387 #define PLUGNTRUST_ECC_CURVE_PARAM_N 0x08
388 #define PLUGNTRUST_ECC_CURVE_PARAM_PRIME 0x10
394 #define PLUGNTRUST_CIPHER_DES_CBC_NOPAD 0x01
395 #define PLUGNTRUST_CIPHER_DES_CBC_ISO9797_M1 0x02
396 #define PLUGNTRUST_CIPHER_DES_CBC_ISO9797_M2 0x03
397 #define PLUGNTRUST_CIPHER_DES_CBC_PKCS5 0x04
398 #define PLUGNTRUST_CIPHER_DES_ECB_NOPAD 0x05
399 #define PLUGNTRUST_CIPHER_DES_ECB_ISO9797_M1 0x06
400 #define PLUGNTRUST_CIPHER_DES_ECB_ISO9797_M2 0x07
401 #define PLUGNTRUST_CIPHER_DES_ECB_PKCS5 0x08
402 #define PLUGNTRUST_CIPHER_AES_ECB_NOPAD 0x0E
403 #define PLUGNTRUST_CIPHER_AES_CBC_NOPAD 0x0D
404 #define PLUGNTRUST_CIPHER_AES_CBC_ISO9797_M1 0x16
405 #define PLUGNTRUST_CIPHER_AES_CBC_ISO9797_M2 0x17
406 #define PLUGNTRUST_CIPHER_AES_CBC_PKCS5 0x18
407 #define PLUGNTRUST_CIPHER_AES_CTR 0xF0
413 #define PLUGNTRUST_CONFIG_ECDAA 0x0001
414 #define PLUGNTRUST_CONFIG_ECDSA_ECDH_ECDHE 0x0002
415 #define PLUGNTRUST_CONFIG_EDDSA 0x0004
416 #define PLUGNTRUST_CONFIG_DH_MONT 0x0008
417 #define PLUGNTRUST_CONFIG_HMAC 0x0010
418 #define PLUGNTRUST_CONFIG_RSA_PLAIN 0x0020
419 #define PLUGNTRUST_CONFIG_RSA_CRT 0x0040
420 #define PLUGNTRUST_CONFIG_AES 0x0080
421 #define PLUGNTRUST_CONFIG_DES 0x0100
422 #define PLUGNTRUST_CONFIG_PBKDF 0x0200
423 #define PLUGNTRUST_CONFIG_TLS 0x0400
424 #define PLUGNTRUST_CONFIG_MIFARE 0x0800
425 #define PLUGNTRUST_CONFIG_FIPS_MODE_DISABLED 0x1000
426 #define PLUGNTRUST_CONFIG_I2CM 0x2000
427 #define PLUGNTRUST_CONFIG_ECC_ALL 0x000F
428 #define PLUGNTRUST_CONFIG_RSA_ALL 0x0060
429 #define PLUGNTRUST_CONFIG_ALL 0x3FFF
435 #define PLUGNTRUST_TRANSIENT_LOCK 0x01
436 #define PLUGNTRUST_PERSISTENT_LOCK 0x02
442 #define PLUGNTRUST_LOCKED 0x01
448 #define PLUGNTRUST_CC_DIGEST 0x01
449 #define PLUGNTRUST_CC_CIPHER 0x02
450 #define PLUGNTRUST_CC_SIGNATURE 0x03
456 #define PLUGNTRUST_RESULT_SUCCESS 0x01
457 #define PLUGNTRUST_RESULT_FAILURE 0x02
463 #define PLUGNTRUST_PERSISTENT 0x01
464 #define PLUGNTRUST_TRANSIENT 0x02
470 #define PLUGNTRUST_NOT_SET 0x01
471 #define PLUGNTRUST_SET 0x02
477 #define PLUGNTRUST_NO_MORE 0x01
478 #define PLUGNTRUST_MORE 0x02
484 #define PLUGNTRUST_SCP_REQUIRED 0x01
485 #define PLUGNTRUST_SCP_NOT_REQUIRED 0x02
491 #define PLUGNTRUST_APPLET_RES_ID_TRANSPORT 0x7FFF0200ul
492 #define PLUGNTRUST_APPLET_RES_ID_KP_FASTSCP_USER 0x7FFF0201ul
493 #define PLUGNTRUST_APPLET_RES_ID_KP_FASTSCP_IMPORT 0x7FFF0202ul
494 #define PLUGNTRUST_APPLET_RES_ID_PUB_FASTSCP_IMPORT 0x7FFF0203ul
495 #define PLUGNTRUST_APPLET_RES_ID_FEATURE 0x7FFF0204ul
496 #define PLUGNTRUST_APPLET_RES_ID_FACTORY_RESET 0x7FFF0205ul
497 #define PLUGNTRUST_APPLET_RES_ID_UNIQUE_ID 0x7FFF0206ul
498 #define PLUGNTRUST_APPLET_RES_ID_PLATFORM_SCP 0x7FFF0207ul
504 #define PLUGNTRUST_SW_NOERROR 0x9000
505 #define PLUGNTRUST_SW_CONDITIONS_NOT_SATISFIED 0x6985
506 #define PLUGNTRUST_SW_SECURITY_STATUS 0x6982
507 #define PLUGNTRUST_SW_WRONG_DATA 0x6A80
508 #define PLUGNTRUST_SW_DATA_INVALID 0x6984
509 #define PLUGNTRUST_SW_COMMAND_NOT_ALLOWED 0x6986
515 #define PLUGNTRUST_OBJECT_DOES_EXISTS 1
516 #define PLUGNTRUST_OBJECT_DOESNT_EXIST 2
522 #define PLUGNTRUST_OBJID_SE05X_APPLET_RES_START 0x7FFF0000ul
523 #define PLUGNTRUST_SSS_OBJID_DEMO_AUTH_START 0x7DA00000ul
524 #define PLUGNTRUST_SSS_OBJID_IOT_HUB_A_START 0xF0000000ul
530 #define PLUGNTRUST_OBJID_APPLET_MASK 0xFFFF0000ul
531 #define PLUGNTRUST_OBJID_IOT_MASK 0xF0000000ul
551 #define PLUGNTRUST_SET_DEV_ADDR 0x48
557 #define PLUGNTRUST_INTERFACE_ISO14443 0
558 #define PLUGNTRUST_INTERFACE_I2C 1
564 #define PLUGNTRUST_CARD_MANAGER_WITH_RSP 1
565 #define PLUGNTRUST_CARD_MANAGER_WITHOUT_RSP 0
583 #define PLUGNTRUST_MAP_MIKROBUS( cfg, mikrobus ) \
584 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
585 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
586 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
587 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
640 uint8_t payload[ 0xFF ];
665 uint8_t vendor_id[ 5 ];
668 uint8_t data_link_layer_parameters[ 0x04 ];
673 uint8_t physical_layer_parameters[ 0x0B ];
676 uint8_t historical[ 0x0A ];
1225 #endif // PLUGNTRUST_H
err_t plugntrust_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.
uint8_t pcb
Definition: plugntrust.h:652
@ PLUGNTRUST_ERROR_TIMEOUT
Definition: plugntrust.h:703
err_t plugntrust_apdu_transfer(plugntrust_t *ctx, plugntrust_frame_data_t *frame_data)
Write-Read frame data function.
uint8_t protocol_version
Definition: plugntrust.h:664
uint8_t ins
Definition: plugntrust.h:636
uint8_t interface
Definition: plugntrust.h:608
uint8_t p1
Definition: plugntrust.h:637
err_t plugntrust_init(plugntrust_t *ctx, plugntrust_cfg_t *cfg)
Plug n Trust initialization function.
pin_name_t rst
Definition: plugntrust.h:622
Data after reset.
Definition: plugntrust.h:663
digital_out_t rst
Definition: plugntrust.h:600
pin_name_t sda
Definition: plugntrust.h:619
void plugntrust_set_en(plugntrust_t *ctx, uint8_t state)
Set Enable pin state.
Plug n Trust Click context object.
Definition: plugntrust.h:597
err_t plugntrust_sw_reset(plugntrust_t *ctx, plugntrust_atr_t *atr_data)
Sends request to reset device and reads ATR data.
err_t plugntrust_delete_object(plugntrust_t *ctx, uint32_t object_id)
Delete object.
void plugntrust_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.
pin_name_t scl
Definition: plugntrust.h:618
uint16_t rsp_len
Definition: plugntrust.h:641
uint16_t crc16
Definition: plugntrust.h:655
err_t plugntrust_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 plugntrust_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 plugntrust_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.
@ PLUGNTRUST_ERROR
Definition: plugntrust.h:702
uint16_t secure_box
Definition: plugntrust.h:691
uint32_t i2c_speed
Definition: plugntrust.h:624
err_t plugntrust_select_card_manager(plugntrust_t *ctx, uint8_t rsp, uint8_t *cardmanager_rsp, uint8_t *cardmanager_rsp_len)
Select card manager.
uint8_t major_version
Definition: plugntrust.h:686
void plugntrust_set_rst(plugntrust_t *ctx, uint8_t state)
Set Reset pin state.
plugntrust_return_value_t
Plug n Trust Click return value data.
Definition: plugntrust.h:700
err_t plugntrust_select_applet(plugntrust_t *ctx, uint8_t ns_encode, plugntrust_version_info_t *ver_info)
Selects Clicks Applet and returns info that device sends back to host.
uint16_t applet_config
Definition: plugntrust.h:690
plugntrust_apdu_t * apdu
Definition: plugntrust.h:654
err_t plugntrust_read_object(plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t read_len, uint8_t *data_buf, uint32_t *data_len)
Read object data.
uint8_t slave_address
Definition: plugntrust.h:606
uint8_t patch_version
Definition: plugntrust.h:688
void plugntrust_cfg_setup(plugntrust_cfg_t *cfg)
Plug n Trust configuration object setup function.
Communication frame data object.
Definition: plugntrust.h:650
@ PLUGNTRUST_ERROR_DATA_OVF
Definition: plugntrust.h:704
err_t plugntrust_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.
void plugntrust_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.
i2c_master_t i2c
Definition: plugntrust.h:603
uint8_t nad
Definition: plugntrust.h:651
err_t plugntrust_get_free_memory(plugntrust_t *ctx, uint8_t memory_type, uint16_t *free_memory)
Reads Applet free memory.
uint8_t i2c_address
Definition: plugntrust.h:625
err_t plugntrust_apdu_read(plugntrust_t *ctx, plugntrust_frame_data_t *frame_data)
Reading frame data function function.
uint16_t status
Definition: plugntrust.h:642
uint8_t cla
Definition: plugntrust.h:635
err_t plugntrust_get_applet_info(plugntrust_t *ctx, plugntrust_version_info_t *ver_info)
Get Version info from Applet.
uint8_t plugntrust_calculate_apdu_size(plugntrust_apdu_t *apdu_data)
Calculates APDU object size.
uint8_t len
Definition: plugntrust.h:653
err_t plugntrust_apdu_write(plugntrust_t *ctx, plugntrust_frame_data_t *frame_data)
Writing frame data function.
pin_name_t en
Definition: plugntrust.h:621
uint8_t payload_len
Definition: plugntrust.h:639
err_t plugntrust_write_binary_object(plugntrust_t *ctx, uint32_t object_id, uint16_t offset, uint16_t data_len, uint8_t *data_buf)
Create/Write to binary object.
err_t plugntrust_end_apdu_session(plugntrust_t *ctx)
Sends command for ending APDU session.
err_t plugntrust_object_id_list(plugntrust_t *ctx, uint32_t *id_list, uint8_t *list_len)
Reads all Object ID's from Applet.
Version info data.
Definition: plugntrust.h:685
void plugntrust_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.
void plugntrust_reset(plugntrust_t *ctx)
Reset function.
uint8_t physical_layer_id
Definition: plugntrust.h:670
uint8_t historical_len
Definition: plugntrust.h:675
digital_out_t en
Definition: plugntrust.h:599
APDU data object.
Definition: plugntrust.h:634
err_t plugntrust_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.
uint8_t p2
Definition: plugntrust.h:638
uint8_t data_link_layer_parameters_len
Definition: plugntrust.h:667
@ PLUGNTRUST_OK
Definition: plugntrust.h:701
uint8_t physical_layer_parameters_len
Definition: plugntrust.h:672
err_t plugntrust_check_object_exist(plugntrust_t *ctx, uint32_t object_id)
Check if object exists.
err_t plugntrust_default_cfg(plugntrust_t *ctx)
Plug n Trust default configuration function.
err_t plugntrust_get_random_numbers(plugntrust_t *ctx, uint8_t *random_buf, uint8_t buf_len)
Get random data.
uint8_t minor_version
Definition: plugntrust.h:687
Plug n Trust Click configuration object.
Definition: plugntrust.h:617