Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

FIPS: Setting the usedforsecurity flag to False if available #3497

Merged
merged 1 commit into from May 24, 2018
Merged

FIPS: Setting the usedforsecurity flag to False if available #3497

merged 1 commit into from May 24, 2018

Conversation

daviddavis
Copy link
Contributor

@daviddavis daviddavis commented May 18, 2018

In some builds of Python, a usedforsecurity flag is available to declare that md5 is not being used for security purposes. We're using md5 for checksums so set this flag if it's available. This is required for FIPS environments.

TYPE_SHA = 'sha'
TYPE_SHA1 = hashlib.sha1().name
TYPE_SHA256 = hashlib.sha256().name

HASHLIB_ALGORITHMS = (TYPE_MD5, TYPE_SHA, TYPE_SHA1, TYPE_SHA256)

CHECKSUM_FUNCTIONS = {
TYPE_MD5: hashlib.md5,
TYPE_MD5: md5,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think either this should be md5() or def md5 should return the result when called and not a function. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Member

@goosemania goosemania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @daviddavis ! 🎉 Looks good to me.
Please figure out unit tests failures (if they are relevant or not) before merging/

@daviddavis
Copy link
Contributor Author

ok test

1 similar comment
@daviddavis
Copy link
Contributor Author

ok test

In some builds of Python, a usedforsecurity flag is available to declare
that md5 is not being used for security purposes. Set this flag if it's
available. This is required for FIPS environments.
@daviddavis
Copy link
Contributor Author

ok test

@daviddavis daviddavis merged commit e00e959 into pulp:master May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants