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

update the using of hashlib to meet the requirements of FIPS #214

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ucsmsdk/ucsgenutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def get_md5_sum(filename):

import hashlib

md5_obj = hashlib.md5()
md5_obj = hashlib.md5(usedforsecurity=False)
file_handler = open(filename, 'rb')
for chunk in iter(lambda: file_handler.read(128 * md5_obj.block_size), b''):
md5_obj.update(chunk)
Expand All @@ -408,7 +408,7 @@ def get_sha_hash(input_string):

import hashlib

return hashlib.md5(input_string).digest()
return hashlib.sha256(input_string).digest()


def expand_key(key, clen):
Expand All @@ -422,7 +422,7 @@ def expand_key(key, clen):
x_key = []
seed = key
for i_cnt in range(blocks):
seed = hashlib.md5(key + seed).digest()
seed = hashlib.sha256(key + seed).digest()
x_key.append(seed)
j_str = ''.join(x_key)
return array('L', j_str)
Expand Down