-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix reading EstEID certificates with T=0 #1193
Conversation
Signed-off-by: Raul Metsma <[email protected]>
Why do you need the global flag |
#1190 (comment)
|
@frankmorgner The name SC_CARD_CAP_READ_BINARY_NO_BREAK could be changed if you want. |
Any suggestion? I copied from dengert comment |
A long time ago I thought about putting all this GET RESPONSE magic from apdu.c into iso7816.c. If i remember correctly, there are many more extensions from ISO 7816 that seeped through to the generic layers of OpenSC. With such separation, you would have an easier job of modifying the card specific behavior before some ISO 7816 mechanism kicks in. I think this would be the right way to go in terms of establishing long term software quality. However, this has a lot of potential to break things. Introducing more complexity (read: hacks) doesn't solve the problem in the long run. I'd suggest to either start working on the refactoring now, which could then be included in 0.19.0 or to solve this problem exclusively on the card driver level. |
The problem the card driver does not get control until after sc_read_binary has screwed thing up. And sc_read_binary is called from non-card driver files card-.c, pkcs15-.c and pkcs15init/* ./libopensc/pkcs15.c calls it 5 times, ./libopensc/dir.c, /libopensc/iso7816.c, ./libopensc/card.c, ./tools/opensc-tool.c, ./tools/netkey-tool.c, So, refracting looks like a big project. |
Signed-off-by: Raul Metsma <[email protected]>
What happens if you use |
Is this an issue with T=0 and T=1 or the reader. IIRC, with T=0 the card does not see the Le, only the https://github.com/metsma, to you have another reader that does T=0 , or can you force T=0 to see if it fails or works? |
Yes seems like it helps |
Signed-off-by: Raul Metsma <[email protected]>
src/libopensc/card-mcrd.c
Outdated
apdu.data = EstEID_v35_AID; | ||
apdu.datalen = sizeof(EstEID_v35_AID); | ||
apdu.resplen = 0; | ||
apdu.le = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the indenting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is fixing indenting, before there was spaces and tabs mixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or you mean leave the mixed indenting as it is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are too many tabs. Look at GitHub's diff, you'll see the problem.
src/libopensc/card-mcrd.c
Outdated
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "SELECT AID: %02X%02X", apdu.sw1, apdu.sw2); | ||
if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) { | ||
if (card->reader && card->reader->active_protocol == SC_PROTO_T0) | ||
card->max_recv_size = 255; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add a comment why you're doing the workaround
src/libopensc/card-mcrd.c
Outdated
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed"); | ||
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "SELECT AID: %02X%02X", apdu.sw1, apdu.sw2); | ||
if (apdu.sw1 != 0x90 && apdu.sw2 != 0x00) { | ||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indenting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, spaces and tabs mixed before and do I leave as it is?
Signed-off-by: Raul Metsma <[email protected]>
Signed-off-by: Raul Metsma <[email protected]>
Signed-off-by: Raul Metsma <[email protected]>
thanks |
Fixes #1190
Signed-off-by: Raul Metsma [email protected]
Checklist