RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2055209 - python-cryptography does not detect 3DES is blocked in FIPS mode
Summary: python-cryptography does not detect 3DES is blocked in FIPS mode
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: python-cryptography
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Christian Heimes
QA Contact: Kaleem
URL:
Whiteboard:
Depends On: 2054785 2059630
Blocks: 2062815
TreeView+ depends on / blocked
 
Reported: 2022-02-16 13:28 UTC by Christian Heimes
Modified: 2022-05-17 13:46 UTC (History)
3 users (show)

Fixed In Version: python-cryptography-36.0.1-1.el9_0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2062815 (view as bug list)
Environment:
Last Closed: 2022-05-17 13:45:50 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github pyca cryptography issues 6875 0 None open 3DES in FIPS is disallowed after 2023, already disabled in C9S/RHEL 9 downstream 2022-02-16 13:28:56 UTC
Github pyca cryptography pull 6879 0 None open Block TripleDES in FIPS mode 2022-02-17 11:04:40 UTC
Red Hat Bugzilla 2026445 1 medium CLOSED Finalize OpenSSL FIPS module 2023-06-02 07:40:29 UTC
Red Hat Issue Tracker FREEIPA-7859 0 None Waiting on Customer NVMe over FC mounting issues 2022-06-09 15:23:22 UTC
Red Hat Issue Tracker RHELPLAN-112567 0 None None None 2022-02-16 13:39:20 UTC
Red Hat Product Errata RHBA-2022:2580 0 None None None 2022-05-17 13:46:06 UTC

Description Christian Heimes 2022-02-16 13:28:56 UTC
Description of problem:
Since RHBZ#2026445 OpenSSL 3.0.1 blocks 3DES (TripleDES, TDEA) in FIPS mode. PyCA cryptography is not aware that 3DES is blocked and fails wth an internal error

Version-Release number of selected component (if applicable):
openssl-3.0.1-5.el9
python3-cryptography-3.4.7-6.el9

How reproducible:
always

Steps to Reproduce:
from cryptography.hazmat.primitives import cmac
from cryptography.hazmat.primitives.ciphers import algorithms
import os
key = os.urandom(16)
cmac.CMAC(algorithms.TripleDES(key))

Actual results:
  File "cm.py", line 5, in <module>
    cmac.CMAC(algorithms.TripleDES(key))
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/primitives/cmac.py", line 34, in __init__
    self._ctx = self._backend.create_cmac_ctx(self._algorithm)
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 894, in create_cmac_ctx
    return _CMACContext(self, algorithm)
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/cmac.py", line 48, in __init__
    self._backend.openssl_assert(res == 1)
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py", line 242, in openssl_assert
    return binding._openssl_assert(self._lib, ok, errors=errors)
  File "/usr/lib64/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py", line 77, in _openssl_assert
    raise InternalError(
cryptography.exceptions.InternalError: Unknown OpenSSL error. This error is commonly encountered when another library is not cleaning up the OpenSSL error stack. If you are using cryptography with another library that uses OpenSSL try disabling it before reporting a bug. Otherwise please file an issue at https://github.com/pyca/cryptography/issues with information on how to reproduce this. ([_OpenSSLErrorWithText(code=50856204, lib=6, reason=524556, reason_text=b'error:0308010C:digital envelope routines::unsupported')])


Expected results:
cryptography.exceptions.UnsupportedAlgorithm: This backend does not support CMAC.


Additional info:
3DES is disabled by patch https://gitlab.com/redhat/centos-stream/rpms/openssl/-/blob/c9s/0045-FIPS-services-minimize.patch

NIST SP 800-131A rev 2 (https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf) lists TDEA encryption (aka TripleDES) as disallowed / disallowed after 2023.

Comment 1 Christian Heimes 2022-02-16 13:31:47 UTC
A possible fix is to remove TripleDES from _fips_ciphers after #2054785 has been fixed.

https://github.com/pyca/cryptography/blob/cc80cb35d7067fa793eb37c557f312df3173f19d/src/cryptography/hazmat/backends/openssl/backend.py#L150

Comment 2 Christian Heimes 2022-02-17 11:04:41 UTC
Upstream has agreed to solve the problem in upstream and mark 3DES as unsupported in FIPS mode. I have created upstream PR https://github.com/pyca/cryptography/pull/6879

Comment 11 Sumedh Sidhaye 2022-03-14 08:01:31 UTC
Verifying using the latest RHEL 9.0 nightly repos

[root@ci-vm-10-0-137-195 ~]# rpm -qa python3-cryptography
python3-cryptography-36.0.1-1.el9_0.x86_64
[root@ci-vm-10-0-137-195 ~]# python3
Python 3.9.10 (main, Feb  9 2022, 00:00:00) 
[GCC 11.2.1 20220127 (Red Hat 11.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cryptography.hazmat.backends.openssl import backend
>>> backend._is_fips_enabled()
True
>>> from cryptography.hazmat.primitives.ciphers import algorithms, modes
>>> backend.cipher_supported(algorithms.TripleDES(b"\x00" * 8), modes.CBC(b"\x00" * 8))
False
>>> 
[root@ci-vm-10-0-137-195 ~]# sysctl crypto.fips_enabled
crypto.fips_enabled = 1
[root@ci-vm-10-0-137-195 ~]# 

Based on above results marking bugzilla verified.

Comment 13 errata-xmlrpc 2022-05-17 13:45:50 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 (new packages: python-cryptography), 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-2022:2580


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