Skip to content
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

Solve 2 issues #1085

Closed
wants to merge 0 commits into from
Closed

Solve 2 issues #1085

wants to merge 0 commits into from

Conversation

FeitianSmartcardReader
Copy link
Contributor

  1. Latest code has failure when generate RSA key, fix it in sm.c file
  2. Solve issue->
    ePass2003 EC not supported #1073 (comment), add
    ECC support

These code already passed test
https://github.com/OpenSC/OpenSC/wiki/Smart-Card-Testing

@Jakuje
Copy link
Member

Jakuje commented Jul 3, 2017

@FeitianSmartcardReader Any possibility to resolve the issue "Failed to erase card: Security status not satisfied" described in the wiki, without running binary blobs from internet? I have ePass token, but I am unable to us that.

@FeitianSmartcardReader
Copy link
Contributor Author

@Jakuje The issue need using our tool can download from below and to re-format token, if you cannot using this tool, please show me your error or log, I will help check and solve it, thanks http:https://download.ftsafe.com/files/ePass/Fix_Tool.tar.gz

Copy link
Member

@frankmorgner frankmorgner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is too complex to go into 0.17.0.

Also, see the two comments in the code, which will affect other cards.

@@ -158,7 +158,7 @@ sc_sm_single_transmit(struct sc_card *card, struct sc_apdu *apdu)

/* send APDU flagged as NO_SM */
sm_apdu->flags |= SC_APDU_FLAGS_NO_SM;
rv = sc_transmit_apdu(card, sm_apdu);
rv = card->reader->ops->transmit(card->reader, sm_apdu);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will most likely lead to problems with other cards.

See discussion in #970

@@ -1238,7 +1238,7 @@ sc_pkcs15init_init_prkdf(struct sc_pkcs15_card *p15card, struct sc_profile *prof
key_info->params.data = &keyargs->key.u.ec.params;
key_info->params.free_params = sc_pkcs15init_empty_callback;
key_info->field_length = ecparams->field_length;
key_info->modulus_length = 0;
// key_info->modulus_length = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will most likely break other cards

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will talk internal and make the change, thanks

@FeitianSmartcardReader
Copy link
Contributor Author

@frankmorgner Do modify, check changes 8021c47

@dengert
Copy link
Member

dengert commented Jul 5, 2017

To avoid a strcmp, for every card, The test should be
switch(card->type) {
case: SC_CARD_TYPE_ENTERSAFE_FTCOS_EPASS2003:
key_info->modulus_length = 0;;
}

@@ -1238,7 +1238,13 @@ sc_pkcs15init_init_prkdf(struct sc_pkcs15_card *p15card, struct sc_profile *prof
key_info->params.data = &keyargs->key.u.ec.params;
key_info->params.free_params = sc_pkcs15init_empty_callback;
key_info->field_length = ecparams->field_length;
key_info->modulus_length = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to ISO 7816-15 (successor of PKCS#15), an PublicECKeyAttributes doesn't have a modulusLength field (while a PublicRSAKeyAttributes does have one):
image
image

What's the reason for this change? As far as I can see, you're not using the modulus_length somewhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, no need do modify code here, we will do it in pkcs15-epass2003.c file, will submit another pull request

rv = sc_transmit_apdu(card, sm_apdu);
/* if token is epass2003, using below code*/
switch(card->type){
case SC_CARD_TYPE_ENTERSAFE_FTCOS_EPASS2003:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to avoid card specific code on this layer. What's the reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We double check the code, no need do modify in this layer, we will modify the file apdu.c.
The reason is our epass2003 series support plain APDU and cipher APDU, while in cipher APDU, after receive 6C command, then we will need get data back and re-package APDU with cipher mode, at this time, the set_le API seems only modify the LE, and nothing change of APDU, so we will modify apdu.c to solve it.

@frankmorgner frankmorgner mentioned this pull request Jul 24, 2017
6 tasks
@sandys
Copy link

sandys commented Aug 1, 2017

@FeitianSmartcardReader im unable to download your fix-tool from http:https://download.ftsafe.com/files/ePass/Fix_Tool.tar.gz. Can you post the link again please

@FeitianSmartcardReader
Copy link
Contributor Author

check below:
Fix_Tool.tar.gz

bob-fontana pushed a commit to bob-fontana/OpenSC that referenced this pull request Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants