From 282632f7e6ad60116a8878dbaf9db09390659940 Mon Sep 17 00:00:00 2001 From: ricky Date: Sun, 13 Nov 2016 11:07:57 +0100 Subject: [PATCH] cwa-14890: little issue in cwa_external_auth # closes #903 --- src/libopensc/cwa14890.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libopensc/cwa14890.c b/src/libopensc/cwa14890.c index 1cc9d49b..02382650 100644 --- a/src/libopensc/cwa14890.c +++ b/src/libopensc/cwa14890.c @@ -733,7 +733,7 @@ static int cwa_external_auth(sc_card_t * card, cwa_sm_status_t * sm) LOG_FUNC_CALLED(ctx); /* compose apdu for External Authenticate cmd */ - dnie_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x82, 0x00, 0x00, 0, sizeof(sm->sig), + dnie_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x82, 0x00, 0x00, 255, sizeof(sm->sig), resp, MAX_RESP_BUFFER_SIZE, sm->sig, sizeof(sm->sig)); /* send composed apdu and parse result */ @@ -1583,7 +1583,7 @@ int cwa_encode_apdu(sc_card_t * card, &k1, &k2, DES_ENCRYPT); /* compose and add computed MAC TLV to result buffer */ - tlv_len = (card->atr.value[15] >= DNIE_30_VERSION)? 8 : 4; + tlv_len = (card->atr.value[15] >= DNIE_30_VERSION)? 8 : 4; sc_log(ctx, "Using TLV lenght: %d", tlv_len); res = cwa_compose_tlv(card, 0x8E, tlv_len, macbuf, &apdubuf, &apdulen); if (res != SC_SUCCESS) { @@ -1720,7 +1720,7 @@ int cwa_decode_response(sc_card_t * card, res = SC_ERROR_INVALID_DATA; goto response_decode_end; } - tlv_len = (card->atr.value[15] >= DNIE_30_VERSION)? 8 : 4; + tlv_len = (card->atr.value[15] >= DNIE_30_VERSION)? 8 : 4; if (m_tlv->len != tlv_len) { msg = "Invalid MAC TAG Length"; res = SC_ERROR_INVALID_DATA;