Bug 1329240 - coolkey should not present and accept CKM_ECDSA_SHA1 mechanism on ECC PIV cards
Summary: coolkey should not present and accept CKM_ECDSA_SHA1 mechanism on ECC PIV cards
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: coolkey
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Bob Relyea
QA Contact: Asha Akkiangady
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-21 13:23 UTC by Jakub Jelen
Modified: 2016-11-04 06:52 UTC (History)
2 users (show)

Fixed In Version: coolkey-1.1.0-34.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 06:52:38 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2465 0 normal SHIPPED_LIVE coolkey bug fix update 2016-11-03 14:06:22 UTC

Description Jakub Jelen 2016-04-21 13:23:45 UTC
Description of problem:
CKM_ECDSA_SHA1 mechanism is provided by coolkey (with flag CKF_HW), but (I suspect) it does not do the hash in hardware (not separately provided).

Opensc does not report this mechanism for the same card. It reports digests mechanisms, but without pretending that they are HW.

Robert Relyea wrote:
> It doesn't support it (even without the hardware flag). Hmm I'm looking at slot::signInit in coolkey and it doesn't even check the mechanism type! So you won't get an error if you call it, it will just silently CKM_ECDSA sign the data you send (truncating it appropriately). 

Version-Release number of selected component (if applicable):
coolkey-1.1.0-33.el7.x86_64

How reproducible:
deterministic

Steps to Reproduce:
1. Call C_GetMechanismList PKCS#11 function
2. Call C_SignInit

Actual results:

11: C_GetMechanismList
2016-04-21 15:18:09.154
[in] slotID = 0x1
[out] pMechanismList[3]: 
 CKM_ECDSA                     
 CKM_ECDSA_SHA1                
 CKM_ECDH1_DERIVE              
Returned:  0 CKR_OK

[...]

142: C_SignInit
2016-04-21 15:18:12.071
[in] hSession = 0x1000002
pMechanism->type=CKM_ECDSA_SHA1               
[in] hKey = 0x401
Returned:  0 CKR_OK


Expected results:

11: C_GetMechanismList
2016-04-21 15:18:09.154
[in] slotID = 0x1
[out] pMechanismList[2]: 
 CKM_ECDSA                     
 CKM_ECDH1_DERIVE              
Returned:  0 CKR_OK

[...]
142: C_SignInit
<< should check mechanisms and fail >>

Additional info:

Comment 2 Bob Relyea 2016-06-17 00:09:06 UTC
fixed in coolkey-1.1.0-34.el7

Comment 4 Roshni 2016-08-12 17:14:47 UTC
Bob,

Please provide testing instructions.

Comment 5 Jakub Jelen 2016-08-15 06:44:05 UTC
Hello Roshni,
the problem can be demonstrated using testing PIV card number 4, which has EC keys and supports ECDSA mechanism. But it does not support ECDSA_SHA1.

The simplest way to reproduce is to use pkcs11-tool:

    pkcs11-tool -M --module=/usr/lib64/pkcs11/libcoolkeypk11.so

Currently, the list shows

    Using slot 0 with a present token (0x1)
    Supported mechanisms:
      ECDSA, keySize={256,521}, hw, sign, other flags=0x100000
      ECDSA-SHA1, keySize={256,521}, hw, sign, other flags=0x100000
      ECDH1-DERIVE, keySize={256,521}, hw, derive, other flags=0x100000

But the second line should not be there. I manually verified that the coolkey.x86_64 1.1.0-35.el7 does what it should.

Comment 6 Roshni 2016-08-19 18:00:23 UTC
[root@dhcp129-54 ~]# rpm -qi coolkey
Name        : coolkey
Version     : 1.1.0
Release     : 35.el7
Architecture: x86_64
Install Date: Thu 04 Aug 2016 11:38:21 AM EDT
Group       : System Environment/Libraries
Size        : 300220
License     : LGPLv2
Signature   : RSA/SHA256, Thu 28 Jul 2016 01:24:44 PM EDT, Key ID 938a80caf21541eb
Source RPM  : coolkey-1.1.0-35.el7.src.rpm
Build Date  : Fri 01 Jul 2016 05:09:30 PM EDT
Build Host  : x86-034.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://directory.fedora.redhat.com/wiki/CoolKey
Summary     : CoolKey PKCS #11 module

Installed opensc for pkcs11-tool

[root@dhcp129-54 ~]# pkcs11-tool -M --module=/usr/lib64/pkcs11/libcoolkeypk11.so
Using slot 0 with a present token (0x1)
Supported mechanisms:
  ECDSA, keySize={256,521}, hw, sign, other flags=0x100000
  ECDH1-DERIVE, keySize={256,521}, hw, derive, other flags=0x100000

Comment 8 errata-xmlrpc 2016-11-04 06:52:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2465.html


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