Skip to content

Using Aim package on FIPS compatible machine results in Error. #3143

@dushyantbehl

Description

@dushyantbehl

🐛 Bug

Running AIM with any script on a FIPS server results in errors like these making it unusable.

TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()
TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()
Exception ignored in: 'aim.storage.hashing.hashing.hash_object'
Traceback (most recent call last):
  File "/usr/local/lib64/python3.11/site-packages/aim/storage/context.py", line 40, in _calc_hash
    return hash_auto(self._context)
           ^^^^^^^^^^^^^^^^^^^^^^^^

To reproduce

Install AIM on FIPS enabled machine and run with any script the error seems to be 100% reproducible on our end.

Expected behavior

AIM hash function to generate hash without any error.

Environment

  • Aim Version (e.g., 3.0.1) - 3.19.3
  • Python version - 3.11
  • pip version
  • OS (e.g., Linux) - Linux
  • Any other relevant information

Additional context

The problem seems to be stemming from python library hashlib, on a FIPS enabled server the _hashlib.get_fips_mode() returns 1

python3.11 
>>> import _hashlib
>>> _hashlib.get_fips_mode()
1

And API call like this fails.

>>> import hashlib
>>> hashlib.blake2b(digest_size=256 //8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'digest_size' is an invalid keyword argument for openssl_blake2b()

While on other server it works,

python3.11
>>> import _hashlib
>>> _hashlib.get_fips_mode()
0
>>> import hashlib
>>> hashlib.blake2b(digest_size=256 //8)
<_blake2.blake2b object at 0x7fe3f5d0cc70>

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededtype / bugIssue type: something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions