Bug 1711318

Summary: p11_child::sign_data() function implementation is not FIPS140 compliant
Product: Red Hat Enterprise Linux 8 Reporter: Alexey Tikhonov <atikhono>
Component: sssdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: atikhono, grajaiya, jhrozek, lslebodn, mzidek, pbrezina, sbose, spoore, tscherf
Target Milestone: rc   
Target Release: 8.0   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: sssd-2.2.0-7.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:34:25 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:

Description Alexey Tikhonov 2019-05-17 13:47:23 UTC
There are two problems with implementation of p11_child::sign_data() function in regards of FIPS140 compliance:


(1) Usage of SHA-1.

SHA-1 is used in a signature for integrity protection which means it is a sensitive use. Thus it falls under FIPS requirements.
Also the way it is used can't be considered "used in HMAC".
Thus code must be reworked to avoid usage of SHA-1 whenever possible, i.e. implementation should lookup list of supported by Smart Card alternatives and choose more modern/FIPS approved option if available.

For Smart Cards that do not support approved alternatives this change will make impossible its usage in FIPS mode. This is expected behaviour.

Presumably "manual" hashing in case of ECC key may be dropped at all but (2) must be taken in to account.


(2) The way signature verification is implemented breaks "No Algorithm decomposition" rule from "FIPS140 Compliance Checklist":
"When applying signatures do not Hash the content on your own and then call the raw signature API, instead call the API that compute hash and signature in one shot by reading the whole message"

Comment 1 Alexey Tikhonov 2019-06-10 14:32:21 UTC
Forgot to mention: in regards of FIPS compliance we only care about codepaths with OpenSSL backend.

Comment 2 Sumit Bose 2019-07-02 15:09:21 UTC
Upstream ticket:
https://pagure.io/SSSD/sssd/issue/4039

Comment 3 Jakub Hrozek 2019-07-22 18:35:48 UTC
* master:
 * 60748f69d9e21cf4cfd0655a0d7b81a715e9ae04
 * 7f0a8f5060b28dc35e152d7290b583de99361d80

Comment 7 Scott Poore 2019-08-20 23:56:00 UTC
Verified.

Version ::

sssd-2.2.0-16.el8.x86_64

Results ::

First running standard smart card authentication test in non-FIPS mode:

[root@rhel8-2 ~]# cat /etc/sssd/conf.d/sssd_ocsp.conf 

[sssd]
certificate_verification = no_ocsp

[root@rhel8-2 ~]# su - ipauser1 -c 'su - ipauser1 -c whoami'
PIN for sctest (MyEID): 
ipauser1

[root@rhel8-2 ~]# kdestroy -A

[root@rhel8-2 ~]# kinit -X X509_user_identity=PKCS11:module_name=/usr/lib64/opensc-pkcs11.so ipauser1
sctest (MyEID)                   PIN: 

[root@rhel8-2 ~]# klist
Ticket cache: KCM:0
Default principal: ipauser1

Valid starting       Expires              Service principal
08/20/2019 18:34:27  08/21/2019 18:34:19  krbtgt/EXAMPLE.COM
[root@rhel8-2 ~]# 

Now with FIPS mode:

fips-finish-install  fips-mode-setup      
[root@rhel8-2 ~]# fips-mode-setup --enable
Setting system policy to FIPS
Note: System-wide crypto policies are applied on application start-up.
It is recommended to restart the system for the change of policies
to fully take place.
FIPS mode will be enabled.
Please reboot the system for the setting to take effect.

[root@rhel8-2 ~]# getenforce 
Enforcing

[root@rhel8-2 ~]# reboot
...

[root@rhel8-2 ~]# fips-mode-setup --check
FIPS mode is enabled.

[root@rhel8-2 ~]# kdestroy -A

[root@rhel8-2 ~]# su - ipauser1 -c 'su - ipauser1 -c whoami'
PIN for sctest (MyEID): 
ipauser1

[root@rhel8-2 ~]# kinit -X X509_user_identity=PKCS11:module_name=/usr/lib64/opensc-pkcs11.so ipauser1
sctest (MyEID)                   PIN: 

[root@rhel8-2 ~]# klist
Ticket cache: KCM:0
Default principal: ipauser1

Valid starting       Expires              Service principal
08/20/2019 18:55:08  08/21/2019 18:54:59  krbtgt/EXAMPLE.COM

[root@rhel8-2 ~]#

Comment 9 errata-xmlrpc 2019-11-05 22:34:25 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/RHSA-2019:3651