Bug 1562572

Summary: [RFE] Two backports for RHEL 7.5/Fedora 28 - better support for CloudHSM in FIPS mode
Product: Red Hat Enterprise Linux 7 Reporter: aalba6675 <ascanio.alba7>
Component: openscAssignee: Jakub Jelen <jjelen>
Status: CLOSED ERRATA QA Contact: Asha Akkiangady <aakkiang>
Severity: unspecified Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 7.4CC: jjelen, mthacker, nmavrogi, rc556677, rpattath
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: opensc-0.16.0-9.20170227git777e2a3.el7 Doc Type: Bug Fix
Doc Text:
The *pkcs11-tool* utility now supports mechanism IDs and handles ECDSA keys correctly Previously, the *pkcs11-tool* utility incorrectly handled *EC_POINT* values and support for certain vendor-specific mechanisms was missing. As a consequence, these mechanisms and certain ECDSA keys in hardware security modules (HSM) and smart cards were not supported by *pkcs11-tool*. With this update, the *pkcs11-tool* now handles *EC_POINT* values and vendor-specific mechanisms correctly. As a result, the utility now supports mechanism IDs and handles ECDSA keys correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 11:24:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1563596    

Description aalba6675 2018-04-01 03:25:19 UTC
Description of problem:

I have two PRs in upstream accepted for better support of CloudHSM in FIPS mode. They address two separate issues:

1. Write EC public key objects with full DER (instead of just the content bytes)
2. Specify mechanism for RSA key generation in hexadecimal (for vendor proprietary mechanisms). In FIPS mode SafeNet uses 0x8000014 0x80000143 instead of 0x0 and 0xA


Version-Release number of selected component (if applicable):
opensc-0.16.0-5.20170227git777e2a3.el7.x86_64

How reproducible:

Always

Steps to Reproduce:
Put CloudHSM/SafeNet Luna in FIPS mode

1. pkcs11-tool --module /usr/lib/libCryptoki2_64.so --slot 0 --pin PIN --login --write ec_publickey.der

- will fail as we are not sending the correct bytes (missing ASN.1 TL)

2. pkcs11-tool --module /usr/lib/libCryptoki2_64.so --slot 0 --pin PIN --login --keypairgen --key-type RSA:2048

- will fail, SafeNet needs -m 0x80000142 or -m 0x80000143 (possible with the PR)

3.

Actual results:
Both operations fail


Expected results:
Both operations succeed


Additional info:
Accepted by upstream

1. Fix EC public key(send complete DER): bytes https://github.com/OpenSC/OpenSC/pull/1287
2. Accept hexadecimal for mechanism: https://github.com/OpenSC/OpenSC/pull/1302

Please backport to RHEL 7.5 and Fedora 28.

Comment 3 Jakub Jelen 2018-04-03 11:57:16 UTC
Here we talk about the following two upstream commits, that really makes sense to bring in:

https://github.com/OpenSC/OpenSC/commit/74885fb
https://github.com/OpenSC/OpenSC/commit/ea4baf5

Comment 7 Jakub Jelen 2018-04-25 16:40:45 UTC
*** Bug 1557740 has been marked as a duplicate of this bug. ***

Comment 11 Roshni 2018-08-17 21:12:40 UTC
[root@dhcp129-188 ~]# rpm -qi opensc
Name        : opensc
Version     : 0.16.0
Release     : 10.20170227git777e2a3.el7
Architecture: x86_64
Install Date: Tue 31 Jul 2018 10:10:39 AM EDT
Group       : System Environment/Libraries
Size        : 3260617
License     : LGPLv2+
Signature   : RSA/SHA256, Tue 03 Jul 2018 04:12:33 AM EDT, Key ID 199e2f91fd431d51
Source RPM  : opensc-0.16.0-10.20170227git777e2a3.el7.src.rpm
Build Date  : Tue 03 Jul 2018 03:59:44 AM EDT
Build Host  : x86-019.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://github.com/OpenSC/OpenSC/wiki
Summary     : Smart card library and applications

Sanity tests look good.

Comment 13 errata-xmlrpc 2018-10-30 11:24:51 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://access.redhat.com/errata/RHBA-2018:3224