Bug 1195002 - Secure PIN Entry/Modification Fails with PCSC-Lite 1.8.13-1.fc21 (64-bit)
Summary: Secure PIN Entry/Modification Fails with PCSC-Lite 1.8.13-1.fc21 (64-bit)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: pcsc-cyberjack
Version: 21
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Patrick C. F. Ernzer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-21 21:32 UTC by f284912
Modified: 2015-08-05 05:35 UTC (History)
2 users (show)

Fixed In Version: pcsc-cyberjack-3.99.5final.SP07-3.fc21
Clone Of:
Environment:
Last Closed: 2015-07-31 07:55:05 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
fixes #1195002 (3.92 KB, patch)
2015-03-22 14:33 UTC, Jens Lody
no flags Details | Diff
Patch needed for new upstream sources to fix #1195002 (1.60 KB, patch)
2015-07-14 14:01 UTC, Jens Lody
no flags Details | Diff
Final patch needed for new upstream sources to fix #1195002, also working on el6. (5.85 KB, patch)
2015-07-16 21:05 UTC, Jens Lody
no flags Details | Diff

Description f284912 2015-02-21 21:32:32 UTC
Description of problem:


Version-Release number of selected component (if applicable):
pcsc-cyberjack-3.99.5final.SP03-15.fc21 (64bit)


How reproducible:
When using the smartcard reader cyberjack e_com and entering the smartcards's pin via its pin pad it does not work correctly.
Described in https://github.com/larskanis/ctapi-cyberjack/issues/2, too.


Actual results:
Cannot use the cyberjack e_com reader. Have to use a cheap ccid reader which uses the computer's keypoard for entering the pin code.

Expected results:
Pin pad of cyberjack e_com reader is working correctly as was in fedora 20.


Additional info:
When using the driver from http://support.reiner-sct.de/downloads/LINUX/V3.99.5_SP05/pcsc-cyberjack-3.99.5final.SP05.tar.bz2 and compiling & installing it the pin pad of the reader is working correctly.

Please, it is possible to provide an updated pcsc-cyberjack packages?

Thanks.

Comment 1 Jens Lody 2015-03-22 14:33:25 UTC
Created attachment 1005061 [details]
fixes #1195002

I can confirm that it works with the patch decribed in the first link.
I add a patch for this issue.
Combined with the existing unistd-patch it works flawlessly.
Tested with jameica/hibiscus on FC21 x86_64.

Comment 2 Jens Lody 2015-03-22 14:35:12 UTC
I just saw that the comments of the original sources are not corrected in my patch.

Comment 3 Patrick C. F. Ernzer 2015-07-01 08:15:56 UTC
JFYI: saw that the vendor has a newer version (pcsc-cyberjack-3.99.5final.SP07-1) of the driver at http://www.reiner-sct.com/support/download/treiber-und-software/cyberjack/ and they now offer RPMs as well.

Comment 4 Patrick C. F. Ernzer 2015-07-13 19:29:46 UTC
I have just built pcsc-cyberjack-3.99.5final.SP07-1.fc21 for Fedora 21.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-1.fc21

If you could test that this version still needs the patch, then I can build a newer 3.99.5final.SP07 which includes this patch.

Comment 5 Jens Lody 2015-07-14 14:01:37 UTC
Created attachment 1051870 [details]
Patch needed for new upstream sources to fix #1195002

The old patch is not needed any more, but another one.

I build the patched sources for FC22 on my copr-test-repo (see: https://copr-be.cloud.fedoraproject.org/results/jenslody/Tests/fedora-22-x86_64/pcsc-cyberjack-3.99.5final.SP07-1.fc22/ for the build-info and the files).

I attach the patch I use (it's included in the src.rpm on copr).
Maybe compiling the soures with C99-standard enabled might work also, but I don't know how to do it properly from inside the spec-file to test it.

Comment 6 Patrick C. F. Ernzer 2015-07-14 15:54:48 UTC
(In reply to Jens Lody from comment #5)
> Maybe compiling the soures with C99-standard enabled might work also, but I
> don't know how to do it properly from inside the spec-file to test it.

If I am not mistaken, that would be

export CFLAGS="%{optflags} -std=gnu99"

as first thing in the %build section

I've made you a scratch build at http://koji.fedoraproject.org/koji/taskinfo?taskID=10354518 (that will be accessible for a couple days)

Can you please test and report back?

Comment 7 Jens Lody 2015-07-14 16:41:50 UTC
Unfortuanetly it does not work.
I know the cause now, too simple to see it at first glance.

"CCIDReader.cpp" is (obviously) a c++-file and so "__STDC__VERSION__" might be defined or not, depending on the compiler-implementation (I don't know if any c++-compiler defines it, but recent gcc does not).

That means my last patch (or something similar) is needed or the first part of the "#if"-clause will always be compiled, what leads to the bug.

Comment 8 Jens Lody 2015-07-14 17:00:24 UTC
I even don't know if the #ifdef is really needed, because a similar length-calculation is done without #ifdef's in the two other files that needed the first version of the patch.

Comment 9 Patrick C. F. Ernzer 2015-07-14 17:44:09 UTC
(In reply to Jens Lody from comment #7)
> Unfortuanetly it does not work.
> I know the cause now, too simple to see it at first glance.
> 
> "CCIDReader.cpp" is (obviously) a c++-file and so "__STDC__VERSION__" might
> be defined or not, depending on the compiler-implementation (I don't know if
> any c++-compiler defines it, but recent gcc does not).

Ah yes, gcc calls in  the build log were with -std=gnu99, g++ calls not.

What I do not grok is
$ g++ -dM -E - < /dev/null|grep STDC_VERSION
#define __STDC_VERSION__ 201112L

Guess I'll have to go through the build logs again because ideally I'd like to use the if clause as intended by upstream.

> That means my last patch (or something similar) is needed or the first part
> of the "#if"-clause will always be compiled, what leads to the bug.

Meanwhile, I've made a scratch build http://koji.fedoraproject.org/koji/taskinfo?taskID=10355598 with your patch as from comment 5

Comment 10 Jens Lody 2015-07-14 19:24:25 UTC
Quote from https://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html:

"__STDC_VERSION__
    This macro expands to the C Standard's version number, a long integer constant of the form yyyymmL where yyyy and mm are the year and month of the Standard version. This signifies which version of the C Standard the compiler conforms to. Like __STDC__, this is not necessarily accurate for the entire implementation, unless GNU CPP is being used with GCC.

    The value 199409L signifies the 1989 C standard as amended in 1994, which is the current default; the value 199901L signifies the 1999 revision of the C standard. Support for the 1999 revision is not yet complete.

    This macro is not defined if the -traditional-cpp option is used, nor when compiling C++ or Objective-C. "

Preprocessing a real (even empty) cpp-file does not show __STDC_VERSION__, that means it can not be used the way it is done by the "REINER SCT" devs, at least not for gcc.

This also means the code can not be used unchanged at the moment.

Comment 11 Patrick C. F. Ernzer 2015-07-15 10:19:14 UTC
Thanks Jens,
I'll push a version with your patch.

Comment 12 Fedora Update System 2015-07-15 10:23:49 UTC
pcsc-cyberjack-3.99.5final.SP07-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-2.fc22

Comment 13 Fedora Update System 2015-07-15 10:43:13 UTC
pcsc-cyberjack-3.99.5final.SP07-2.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-2.fc21

Comment 14 Fedora Update System 2015-07-15 10:49:19 UTC
pcsc-cyberjack-3.99.5final.SP07-2.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-2.el7

Comment 15 Jens Lody 2015-07-15 11:01:09 UTC
Thanks Patrick,

I will download it this evening, if I'm back from work, and give feedback.

Jens

Comment 16 Jens Lody 2015-07-15 21:44:04 UTC
I installed the latest revision and it works.

I think this bug can be closed.

Comment 17 Patrick C. F. Ernzer 2015-07-16 12:32:31 UTC
I'd love to, but it does not work cleanly for EPEL6 (in mock, scratch and proper build), will need to debug why I get a compile failure.

This will be a few days at the least, other things sadly pre-empt this (I'm not a developer, I maintain this package in my spare time)

Comment 18 Jens Lody 2015-07-16 13:10:31 UTC
What exactly does not work ?
I might find time to test and probably fix it.

By the way I think the whole #ifdef-stuff is incorrect, because according to the first link in the first post (https://github.com/larskanis/ctapi-cyberjack/issues/2), it does not depend on the OS or the version of libc, whether to use the "old" or the "new" way to calculate the length and in the other two files it's done unconditional, too.
Do you have an email-address of one of the ReinerSct-developers, so I can contact them directly ?
If not I try it via the public available addresses.

Comment 19 Patrick C. F. Ernzer 2015-07-16 13:39:45 UTC
Hei Jens,

a build log is better than me paraphrasing; http://koji.fedoraproject.org/koji/buildinfo?buildID=668931

Sadly I have no direct contact to ReinerSCT's devs :-(

Comment 20 Jens Lody 2015-07-16 21:05:21 UTC
Created attachment 1052862 [details]
Final patch needed for new upstream sources to fix #1195002, also working on el6.

I uploaded a src.rpm with working patch to my server: https://rpm.jenslody.de/copr/pcsc-cyberjack-3.99.5final.SP07-3.fc22.src.rpm , and attached the patch here.

I found a thread about the issue, that leads to the error when compiling for epel6: https://gcc.gnu.org/ml/gcc-help/2006-12/msg00055.html .

In the patch I left the original code, just commented it out and added a short comment.

I will try to contact the ReinerSCT devs, so it can also be fixed upstream.

Comment 21 Fedora Update System 2015-07-18 02:09:04 UTC
Package pcsc-cyberjack-3.99.5final.SP07-2.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing pcsc-cyberjack-3.99.5final.SP07-2.fc21'
as soon as you are able to, then reboot.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-11788/pcsc-cyberjack-3.99.5final.SP07-2.fc21
then log in and leave karma (feedback).

Comment 22 Fedora Update System 2015-07-18 15:08:12 UTC
pcsc-cyberjack-3.99.5final.SP07-3.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-3.fc22

Comment 23 Fedora Update System 2015-07-18 15:25:08 UTC
pcsc-cyberjack-3.99.5final.SP07-3.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-3.fc21

Comment 24 Fedora Update System 2015-07-18 15:29:45 UTC
pcsc-cyberjack-3.99.5final.SP07-3.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-3.el7

Comment 25 Fedora Update System 2015-07-18 15:34:43 UTC
pcsc-cyberjack-3.99.5final.SP07-3.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/pcsc-cyberjack-3.99.5final.SP07-3.el6

Comment 26 Patrick C. F. Ernzer 2015-07-18 15:52:53 UTC
(In reply to Jens Lody from comment #20)
[...]
> Final patch needed for new upstream sources to fix #1195002, also working on
> el6.

Thanks Jens, much appreciated. this is now pushed to all current Fedora branches, EPEL7 and EPEL6.

[...]
> I will try to contact the ReinerSCT devs, so it can also be fixed upstream.

Cheers, much appreciated.

If you want, you can become a (co)maintainer of this package.

PCFE

Comment 27 Jens Lody 2015-07-19 23:05:04 UTC
(In reply to Patrick C. F. Ernzer from comment #26)
> (In reply to Jens Lody from comment #20)
> [...]
> > Final patch needed for new upstream sources to fix #1195002, also working on
> > el6.
> 
> Thanks Jens, much appreciated. this is now pushed to all current Fedora
> branches, EPEL7 and EPEL6.
> 
> [...]
> > I will try to contact the ReinerSCT devs, so it can also be fixed upstream.
> 
> Cheers, much appreciated.
> 
I tried to contact them via the contact-formular on their website.
Let's see what happens.

> If you want, you can become a (co)maintainer of this package.
> 
> PCFE

Thank you, yes I'm interested. You can contact me any time via mail.

Jens

Comment 28 Fedora Update System 2015-07-31 07:55:05 UTC
pcsc-cyberjack-3.99.5final.SP07-3.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 29 Fedora Update System 2015-07-31 07:58:26 UTC
pcsc-cyberjack-3.99.5final.SP07-3.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 30 Fedora Update System 2015-08-05 05:30:45 UTC
pcsc-cyberjack-3.99.5final.SP07-3.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 31 Fedora Update System 2015-08-05 05:35:08 UTC
pcsc-cyberjack-3.99.5final.SP07-3.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.