Allow MD5 checksums on FIPS-enabled systems
MD5 is used for upload and download checksums, to compare object content against its ETag, and to skip uploads of unchanged files. On a FIPS-enabled system hashlib refuses MD5 unless the caller marks it as not used for security, so these operations fail with “unsupported hash algorithm” errors.
Add an md5() helper to swiftclient.utils that passes usedforsecurity through (dropping it on python < 3.9, which lacks the keyword) and use it with usedforsecurity=False everywhere swiftclient hashes content. Swift itself already does this, through swift.common.utils.md5().
The unit tests compute expected checksums with MD5 as well, so give them an md5() helper that sets usedforsecurity=False; otherwise they fail on a FIPS-enabled node.
Assisted-By: Claude Opus 5.5 Change-Id: I5f6cd6c41e85dcb9bdb1251b2600223ee76839d8 Signed-off-by: Thomas Bechtold thomasbechtold@jpberlin.de
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802047560号