From 8d6acb8162745aa4303009d39bb8f5c05c3896e6 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Sun, 27 Feb 2022 20:57:24 +0100 Subject: [PATCH] Updating ATR. Signed-off-by: Pol Henarejos --- hsm2040.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hsm2040.c b/hsm2040.c index 4a9dd0e..b35395a 100644 --- a/hsm2040.c +++ b/hsm2040.c @@ -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;