1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
|
static ssize_t cackey_get_data(struct cackey_slot *slot, unsigned char *buffer, size_t buffer_len, unsigned char oid[3]) {
unsigned char cmd[] = {0x5C, 0x03, 0x00, 0x00, 0x00};
unsigned char *buffer_p;
size_t init_buffer_len, size;
uint16_t respcode;
int send_ret;
CACKEY_DEBUG_PRINTF("Called.");
init_buffer_len = buffer_len;
cmd[2] = oid[0];
cmd[3] = oid[1];
cmd[4] = oid[2];
|
|
|
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
|
static ssize_t cackey_get_data(struct cackey_slot *slot, unsigned char *buffer, size_t buffer_len, unsigned char oid[3]) {
unsigned char cmd[] = {0x5C, 0x03, 0x00, 0x00, 0x00};
unsigned char *buffer_p;
size_t init_buffer_len, size;
uint16_t respcode;
int send_ret;
CACKEY_DEBUG_PRINTF("Called with buffer_len = %llu", (unsigned long long) buffer_len);
init_buffer_len = buffer_len;
cmd[2] = oid[0];
cmd[3] = oid[1];
cmd[4] = oid[2];
|
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
|
if (buffer_len < 2) {
CACKEY_DEBUG_PRINTF("APDU GET DATA returned %lu bytes, which is too short for a BER-TLV response", (unsigned long) buffer_len);
return(-1);
}
size = buffer_len;
buffer_p = cackey_read_bertlv_tag(buffer, &buffer_len, 0x53, NULL, &size);
if (buffer_p == NULL) {
CACKEY_DEBUG_PRINTF("Tag decoding failed, returning in error.");
return(-1);
}
|
|
|
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
|
if (buffer_len < 2) {
CACKEY_DEBUG_PRINTF("APDU GET DATA returned %lu bytes, which is too short for a BER-TLV response", (unsigned long) buffer_len);
return(-1);
}
size = init_buffer_len;
buffer_p = cackey_read_bertlv_tag(buffer, &buffer_len, 0x53, NULL, &size);
if (buffer_p == NULL) {
CACKEY_DEBUG_PRINTF("Tag decoding failed, returning in error.");
return(-1);
}
|
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
|
*/
static struct cackey_pcsc_identity *cackey_read_certs(struct cackey_slot *slot, struct cackey_pcsc_identity *certs, unsigned long *count) {
cackey_pcsc_id_type check_id_type;
struct cackey_pcsc_identity *curr_id;
struct cackey_tlv_entity *ccc_tlv, *ccc_curr, *app_tlv, *app_curr;
unsigned char *piv_oid, piv_oid_pivauth[] = {NISTSP800_73_3_OID_PIVAUTH}, piv_oid_signature[] = {NISTSP800_73_3_OID_SIGNATURE}, piv_oid_keymgt[] = {NISTSP800_73_3_OID_KEYMGT};
unsigned char curr_aid[7];
unsigned char buffer[8192], *buffer_p, *tmpbuf;
unsigned long outidx = 0;
char *piv_label;
cackey_ret transaction_ret;
ssize_t read_ret;
size_t buffer_len, tmpbuflen;
int certs_resizable;
int send_ret, select_ret;
|
|
|
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
|
*/
static struct cackey_pcsc_identity *cackey_read_certs(struct cackey_slot *slot, struct cackey_pcsc_identity *certs, unsigned long *count) {
cackey_pcsc_id_type check_id_type;
struct cackey_pcsc_identity *curr_id;
struct cackey_tlv_entity *ccc_tlv, *ccc_curr, *app_tlv, *app_curr;
unsigned char *piv_oid, piv_oid_pivauth[] = {NISTSP800_73_3_OID_PIVAUTH}, piv_oid_signature[] = {NISTSP800_73_3_OID_SIGNATURE}, piv_oid_keymgt[] = {NISTSP800_73_3_OID_KEYMGT};
unsigned char curr_aid[7];
unsigned char buffer[1024 * 32], *buffer_p, *tmpbuf;
unsigned long outidx = 0;
char *piv_label;
cackey_ret transaction_ret;
ssize_t read_ret;
size_t buffer_len, tmpbuflen;
int certs_resizable;
int send_ret, select_ret;
|