Skip to content

tpm2_hash: Change default hashing alg from sha1 to sha256#3342

Open
idesai wants to merge 1 commit intotpm2-software:masterfrom
idesai:fix_default_hash
Open

tpm2_hash: Change default hashing alg from sha1 to sha256#3342
idesai wants to merge 1 commit intotpm2-software:masterfrom
idesai:fix_default_hash

Conversation

@idesai
Copy link
Copy Markdown
Member

@idesai idesai commented Jan 25, 2024

Fixes #3340

Signed-off-by: Imran Desai <imran.desai@intel.com>
@idesai idesai added this to the 6.0.0 milestone Jan 25, 2024
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.30%. Comparing base (1fdb01a) to head (58d0129).
Report is 33 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3342      +/-   ##
==========================================
- Coverage   74.38%   74.30%   -0.09%     
==========================================
  Files         173      173              
  Lines       23673    23754      +81     
==========================================
+ Hits        17610    17651      +41     
- Misses       6063     6103      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Copy Markdown

@Chiogros Chiogros left a comment

Choose a reason for hiding this comment

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

Fix comments to match the new algorithm.

if [ "$tpm_hash_val" != "$sha1sum_val" ]; then
sha256sum_val=`echo 1234 | shasum -a 256 | cut -d\ -f 1-2 | tr -d '[:space:]'`
if [ "$tpm_hash_val" != "$sha256sum_val" ]; then
echo "Expected tpm and sha1sum to produce same hashes."
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
echo "Expected tpm and sha1sum to produce same hashes."
echo "Expected tpm and sha256sum to produce same hashes."

if [ "$tpm_hash_val" != "$sha1sum_val" ]; then
sha256sum_val=`shasum -a 256 $hash_in_file | cut -d\ -f 1-2 | tr -d '[:space:]'`
if [ "$tpm_hash_val" != "$sha256sum_val" ]; then
echo "Expected tpm and sha1sum to produce same hashes"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
echo "Expected tpm and sha1sum to produce same hashes"
echo "Expected tpm and sha256sum to produce same hashes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why is SHA1 the default hashing algorithm in tpm2-tools?

2 participants