Updating ATR.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2022-02-27 20:57:24 +01:00
parent 44b3792166
commit 8d6acb8162
No known key found for this signature in database
GPG Key ID: C0095B7870A4CCD3

View File

@ -385,6 +385,7 @@ void usb_tx_enable(const uint8_t *buf, uint32_t len)
if (len > 0) {
if (buf[0] == 0x80)
DEBUG_PAYLOAD(buf+CCID_MSG_HEADER_SIZE,len-CCID_MSG_HEADER_SIZE);
//DEBUG_PAYLOAD(buf,len);
tud_vendor_write(buf, len);
}
}
@ -407,8 +408,8 @@ void usb_tx_enable(const uint8_t *buf, uint32_t len)
*
*/
static const uint8_t ATR_head[] = {
//0x3b, 0xda, 0x11, 0xff, 0x81, 0xb1, 0xfe, 0x55, 0x1f, 0x03,
0x3B,0xFE,0x18,0x00,0x00,0x81,0x31,0xFE,0x45,0x80,0x31,0x81,0x54,0x48,0x53,0x4D,0x31,0x73,0x80,0x21,0x40,0x81,0x07,0xFA
0x3b, 0xda, 0x11, 0xff, 0x81, 0xb1, 0xfe, 0x55, 0x1f, 0x03,
//0x3B,0xFE,0x18,0x00,0x00,0x81,0x31,0xFE,0x45,0x80,0x31,0x81,0x54,0x48,0x53,0x4D,0x31,0x73,0x80,0x21,0x40,0x81,0x07,0xFA
};
/* Send back ATR (Answer To Reset) */
@ -418,7 +419,8 @@ static enum ccid_state ccid_power_on (struct ccid *c)
uint8_t p[CCID_MSG_HEADER_SIZE+1]; /* >= size of historical_bytes -1 */
int hist_len = historical_bytes[0];
char atr_sc_hsm[] = { 0x3B,0x8E,0x80,0x01,0x80,0x31,0x81,0x54,0x48,0x53,0x4D,0x31,0x73,0x80,0x21,0x40,0x81,0x07,0x18 };
//char atr_sc_hsm[] = { 0x3B,0x8E,0x80,0x01,0x80,0x31,0x81,0x54,0x48,0x53,0x4D,0x31,0x73,0x80,0x21,0x40,0x81,0x07,0x18 };
char atr_sc_hsm[] = { 0x3B, 0xDE, 0x18, 0xFF, 0x81, 0x91, 0xFE, 0x1F, 0xC3, 0x80, 0x31, 0x81, 0x54, 0x48, 0x53, 0x4D, 0x31, 0x73, 0x80, 0x21, 0x40, 0x81, 0x07, 0x1C };
uint8_t mode = 1; //1 sc-hsm, 0 openpgp
size_t size_atr;
if (mode == 1)
@ -1416,6 +1418,7 @@ static int usb_event_handle(struct ccid *c)
uint32_t count = tud_vendor_read(endp1_rx_buf, sizeof(endp1_rx_buf));
if (endp1_rx_buf[0] == 0x6F)
DEBUG_PAYLOAD(endp1_rx_buf+CCID_MSG_HEADER_SIZE, count-CCID_MSG_HEADER_SIZE);
//DEBUG_PAYLOAD(endp1_rx_buf, count);
ccid_rx_ready(count);
}
return 0;