Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MD5 not supported without usedforsecurity=False in FIPS 140-2 environment #14

Closed
szelenka opened this issue Nov 22, 2022 · 2 comments
Closed

Comments

@szelenka
Copy link

In FIPS environments, the use of md5 algorithm must use the usedforsecurity=False kwarg, otherwise it will assert with:

│     import coolname                                                                                                                                                                                                            
│   File "/opt/python/lib/python3.10/site-packages/coolname/__init__.py", line 7, in <module>                                                                                                                                    
│     from .impl import generate, generate_slug, get_combinations_count,\                                                                                                                                                        
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 565, in <module>                                                                                                                                      
│     _default = _create_default_generator()                                                                                                                                                                                     
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 561, in _create_default_generator                                                                                                                     
│     return RandomGenerator(config)                                                                                                                                                                                             
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 246, in __init__                                                                                                                                      
│     self._lists[None] = self._lists[None].squash(True, {})                                                                                                                                                                     
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 156, in squash                                                                                                                                        
│     result = super().squash(hard, cache)                                                                                                                                                                                       
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in squash                                                                                                                                         
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in <listcomp>                                                                                                                                     
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 156, in squash                                                                                                                                        
│     result = super().squash(hard, cache)                                                                                                                                                                                       
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in squash                                                                                                                                         
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in <listcomp>                                                                                                                                     
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in squash                                                                                                                                         
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 37, in <listcomp>                                                                                                                                     
│     self._lists = [x.squash(hard, cache) for x in self._lists]                                                                                                                                                                 
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 164, in squash                                                                                                                                        
│     if result._hash in cache:  # noqa                                                                                                                                                                                          
│   File "/opt/python/lib/python3.10/site-packages/coolname/impl.py", line 84, in _hash                                                                                                                                          
│     md5 = hashlib.md5()                                                                                                                                                                                                         
│ ValueError: [digital envelope routines] disabled for fips     

Reference other libraries which encountered this:

@alexanderlukanin13
Copy link
Owner

@szelenka Thank you for reporting this issue! I took a slightly different approach to implementation, but result should be the same. Please check coolname==2.1.0 and let me know if it works on your system.

@szelenka
Copy link
Author

szelenka commented Dec 7, 2022

that change should work, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants