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

EstEID 2018+ driver #1635

Merged
merged 4 commits into from
May 2, 2019
Merged

EstEID 2018+ driver #1635

merged 4 commits into from
May 2, 2019

Conversation

martinpaljak
Copy link
Member

This adds card driver for Estonian eID from 2018 onwards.

Next iteration will merge pkcs15-esteid and get rid of Estonia related stuff in card-mcrd.c

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.

Please use tabs for indenting. Looks quite OK, nothing serious.

src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/ctx.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
@martinpaljak
Copy link
Member Author

martinpaljak commented Mar 16, 2019

Please use tabs for indenting. Looks quite OK, nothing serious.

It has been some time since I wrote C so my setup has changed. Using VS Code with clang-format seems pretty neat. Maybe we can add necessary tooling/config into the source tree so that code formatting would be automated with a tool (like clang-format) ? I'll keep using the default formatting of VScode+clang-format plugin until the PR is non-draft or until I figure out how to configure clang-format in a suitable way.

@frankmorgner
Copy link
Member

I'll keep using the default formatting of VScode+clang-format plugin until the PR is non-draft or until I figure out how to configure clang-format in a suitable way.

The way of achieving unified code style in OpenSC or recommendations thereof is still a todo. Sure, you can postpone a (somewhat) unified style for later.

@martinpaljak martinpaljak force-pushed the esteid-2018 branch 2 times, most recently from 2ffdf7c to 20526ae Compare March 21, 2019 21:36
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved

static int esteid_select_file(struct sc_card *card, const struct sc_path *in_path, struct sc_file **file_out) {
unsigned char pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;
int pathlen;
Copy link
Contributor

Choose a reason for hiding this comment

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

size_t pathlen;

LOG_TEST_RET(card->ctx, sc_transmit_apdu(card, &apdu), "APDU transmit failed");
LOG_TEST_RET(card->ctx, sc_check_sw(card, apdu.sw1, apdu.sw2), "PSO CDS/INTERNAL AUTHENTICATE failed");

LOG_FUNC_RETURN(card->ctx, apdu.resplen);
Copy link
Contributor

Choose a reason for hiding this comment

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

(int) apdu.resplen

src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/iso7816.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Outdated Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Show resolved Hide resolved
src/libopensc/pkcs15-esteid2018.c Show resolved Hide resolved
@martinpaljak martinpaljak marked this pull request as ready for review April 20, 2019 07:09
@martinpaljak martinpaljak requested review from frankmorgner and removed request for frankmorgner April 20, 2019 07:09
@martinpaljak martinpaljak changed the title Snapshot of EstEID 2018+ driver EstEID 2018+ driver Apr 20, 2019
@frankmorgner
Copy link
Member

please also look at the two unresolved comments above

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.

See comment above. There is also this remark. Please exclude .clang-format from this PR.

The rest looks good.

src/libopensc/card-esteid2018.c Show resolved Hide resolved
@martinpaljak
Copy link
Member Author

See comment above. There is also this remark. Please exclude .clang-format from this PR.

The rest looks good.

Addressed both, removed clang-format, rebased on master.

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.

Looks good now. Only two minor remarks.

src/libopensc/card-esteid2018.c Outdated Show resolved Hide resolved
struct esteid_priv_data *priv;
struct sc_apdu apdu;

// XXX: could be const
Copy link
Member

Choose a reason for hiding this comment

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

Why not make it const then?

This adds support for a minimalistic, small and fast card profile based on IAS-ECC.

Based on information from https://installer.id.ee/media/id2019/TD-ID1-Chip-App.pdf
and proprietary driver snoops.

Thanks to @metsma and @frankmorgner.

Change-Id: I2e4b4914d8a3b991d9a639728695abf4a2362ca0
and make sure the card is always handled emulated card first

Change-Id: I60174c2793bb882fb73716f62a652d84e028382c
Change-Id: I5d4d3103692fc6db51f13fc5338360289c26af9a
Change-Id: I9aa97c8a9878dddd3e6f1a2baa877d188b9d7fe5
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

4 participants