summaryrefslogtreecommitdiff
path: root/src/iso7816.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/iso7816.h')
-rw-r--r--src/iso7816.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/iso7816.h b/src/iso7816.h
new file mode 100644
index 0000000..426cd97
--- /dev/null
+++ b/src/iso7816.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (c) 2018 Yubico AB. All rights reserved.
3 * Use of this source code is governed by a BSD-style
4 * license that can be found in the LICENSE file.
5 */
6
7#ifndef _ISO7816_H
8#define _ISO7816_H
9
10#include "packed.h"
11
12PACKED_TYPE(iso7816_header_t,
13struct iso7816_header {
14 uint8_t cla;
15 uint8_t ins;
16 uint8_t p1;
17 uint8_t p2;
18 uint8_t lc1;
19 uint8_t lc2;
20 uint8_t lc3;
21})
22
23PACKED_TYPE(iso7816_apdu_t,
24struct iso7816_apdu {
25 size_t alloc_len;
26 uint16_t payload_len;
27 uint8_t *payload_ptr;
28 iso7816_header_t header;
29 uint8_t payload[];
30})
31
32const unsigned char *iso7816_ptr(const iso7816_apdu_t *);
33int iso7816_add(iso7816_apdu_t *, const void *, size_t);
34iso7816_apdu_t *iso7816_new(uint8_t, uint8_t, uint16_t);
35size_t iso7816_len(const iso7816_apdu_t *);
36void iso7816_free(iso7816_apdu_t **);
37
38#endif /* !_ISO7816_H */