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

Release 0.19.0-rc1 problems with opensc-pkcs11 #1461

Closed
dengert opened this issue Aug 29, 2018 · 10 comments
Closed

Release 0.19.0-rc1 problems with opensc-pkcs11 #1461

dengert opened this issue Aug 29, 2018 · 10 comments

Comments

@dengert
Copy link
Member

dengert commented Aug 29, 2018

Problem Description

0.19.0-rc1 opensc-pkcs11.dll fails.

Attempting to use pkcs11-tool show that it gets started, as the card driver is able to read certificates off the card, but then the debug log just ends and command exits.

It looks like some dependencies are missing in opensc-pkcs11.dll

opensc-pkcs11 dll-0 19 0-rc1-depends

This appears to be the same problem as #1455 and may be related.

Running on Windows 10 Pro 64bit with 1803

Proposed Resolution

Steps to reproduce

C:\Program Files (x86)\OpenSC Project\OpenSC\tools>pkcs11-tool --test --login -p 123456 > \tmp\xxx.txt 2>&1

Logs

It appears the log is not flushed, so the problem does not show up.

xxx.txt

@dengert
Copy link
Member Author

dengert commented Aug 29, 2018

Searching for api-ms-win-core showes a lot of hits, that these DLL are targeted for Windows 7.
Do we need a Windows 10 distribution?

In depends output "Error: Modules with different CPU types were found."
API-MS_EVENTING_CONTROLLER-L1-1-0.DLL show it is 64 bit.

@metsma
Copy link
Contributor

metsma commented Aug 29, 2018

This is required when compiling VS 2015 and higher
https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows

@dengert
Copy link
Member Author

dengert commented Aug 29, 2018

pkcs11-tool from 64 bit works as expected. pkcs15-tool both 64 and 32 appear to work. (no pin needed).

Depends of opensc.dll does not have the "Error: Modules with different CPU types were found." on either version.

Depends for 64 bit opensc-pkcs11.dll does not have the "Error: Modules with different CPU types were found."
Only the 32 bit opensc-pkcs11.dll has the "Error: Modules with different CPU types were found." and it fails.

I have a few events from 32 bit programs. Looks like some failure in opensc.dll

Faulting application name: pkcs15-tool.exe, version: 0.19.0.220, time stamp: 0x5b840d28
Faulting module name: opensc.dll, version: 0.19.0.220, time stamp: 0x5b840d1e
Exception code: 0xc0000005
Fault offset: 0x0014ba3f
Faulting process id: 0x1914
Faulting application start time: 0x01d43fc6a956c04d
Faulting application path: C:\Program Files (x86)\OpenSC Project\OpenSC\tools\pkcs15-tool.exe
Faulting module path: C:\Program Files (x86)\OpenSC Project\OpenSC\tools\opensc.dll
Report Id: c82616a2-7c5f-4ddf-8c3d-ec2e4140d26e
Faulting application name: pkcs11-tool.exe, version: 0.19.0.220, time stamp: 0x5b840725
Faulting module name: opensc-pkcs11.dll, version: 0.19.0.220, time stamp: 0x5b840718
Exception code: 0xc0000005
Fault offset: 0x0018b22f
Faulting process id: 0x964
Faulting application start time: 0x01d43fabf92fb43e
Faulting application path: C:\Program Files (x86)\OpenSC Project\OpenSC\tools\pkcs11-tool.exe
Faulting module path: C:\Program Files (x86)\OpenSC Project\OpenSC\pkcs11\opensc-pkcs11.dll
Report Id: f44b4629-86b5-4db1-a5c3-fd429970c6a5

@dengert
Copy link
Member Author

dengert commented Aug 30, 2018

After looking at opensc.pdb files and the event log, it looks like there is a problem at line Line 669 of inffas32.asm of the GZIP routines. The failures I see are all using 32 bit code and the cards that failed all have GZIP certificates. The card with uncompressed certificates work.

madler/zlib#200 appears to address this, and they have trun off using ASM in GZIP.

What version of GZIP are we building on Windows?

https://github.com/OpenSC/OpenSC/wiki/Compiling-on-Windows says to compile with:

nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="inffas32.obj match686.obj" zlib.lib
Can we comple the 32 bit version at least without -DASMV -DASMINF

@frankmorgner
Copy link
Member

The build script is available at https://github.com/OpenSC/OpenSC/blob/master/appveyor.yml. pkcs11-tool and pkcs15-tool (32bit) is working as expected on Windows 10 1803.

The problems reported by dependency walker are looking like false positives, see this post.

Can you track down the actual problems of OpenSC with the faulting applications?

frankmorgner added a commit that referenced this issue Aug 30, 2018
@frankmorgner
Copy link
Member

@dengert
Copy link
Member Author

dengert commented Aug 30, 2018

https://github.com/OpenSC/Nightly/tree/2018-08-30_2ae02e98
is missing the AppVeyor build files that were in
https://github.com/OpenSC/Nightly/tree/2018-08-27_b5a6f9aa

I was using: OpenSC-win32_vs14-Release.msi and OpenSC-win64_vs14-Release.msi

The Travis build file OpenSC-0.19.0.exe in 2018-08-30_2ae02e98 uses different paths and I get a message box: "... libopensc-6.dll was not found..."

I see some of the previous nightly builds are missing the AppVeyor build files too.
Looks like:
https://ci.appveyor.com/project/LudovicRousseau/opensc/build/0.18.0.2088
is still queued.

@dengert
Copy link
Member Author

dengert commented Aug 30, 2018

Also looks like Appveyor caches C:\zlib (source) and caches "C:\zlib-${env:OPENSSL_PF}" (zlib.dll) so zlib may not be rebuilt even with the change.

  If (!(Test-Path -Path "C:\zlib-${env:OPENSSL_PF}" )) {
           # build zlib.lib as a static library

@frankmorgner
Copy link
Member

read on, my dear! a change in appveyor.yml invalidates the cache. binaries are now available.

@dengert
Copy link
Member Author

dengert commented Aug 30, 2018

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

No branches or pull requests

3 participants