Skip to content

Hmac sha implementation #2557

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

Open
wants to merge 8 commits into
base: inject-hash-cpp-experiment
Choose a base branch
from

Conversation

prikhap
Copy link

@prikhap prikhap commented Jul 17, 2025

Integration of HMAC and SHA functionalities from the crypto submodule.

  • Created a new file called fips_hashing.c which has all the files on which HMAC and SHA are dependent on
  • Modified a few dependencies so that the dependency chain gets limited
  • inject_hash.cpp can now finally implement HMAC my simply including it into the script.

prikhap added 7 commits July 10, 2025 01:20
- Add LIEF version 0.13.0 as git submodule
- Configure CMake to build LIEF from source
- Update inject_hash implementation to use LIEF
- Remove pre-built LIEF binaries
- Add initial C++ implementation and tests

This change improves portability and maintainability by using
LIEF as a submodule instead of pre-built binaries.
- Add GitHub Actions workflow for Ubuntu and macOS
- Add test script with detailed logging
- Handle OS-specific library names
- Add environment verification
- Disable fail-fast to test both environments
- Adds flag to fetch C/C++ libraries
- Added fips_hashing implementation
- Updated CMake configuration
- Modified inject_hash_cpp to use fips_hashing
- Removed test_sha256.cpp
- Created a new file called fips_hashing.c which has all the files on which HMAC and SHA are dependent on
- Modified a few dependencies so that the dependency chain gets limited
- inject_hash.cpp can now finally implement HMAC my simply including it into the script.
@prikhap prikhap requested a review from a team as a code owner July 17, 2025 21:34
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

@@ -183,10 +183,6 @@ DEFINE_METHOD_FUNCTION(EVP_PKEY_METHOD, EVP_PKEY_hmac_pkey_meth) {
out->ctrl_str = hmac_ctrl_str;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: use of undeclared identifier 'out' [clang-diagnostic-error]

  out->ctrl_str = hmac_ctrl_str;
  ^

@@ -0,0 +1,63 @@
#include <LIEF/LIEF.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: 'LIEF/LIEF.hpp' file not found [clang-diagnostic-error]

#include <LIEF/LIEF.hpp>
         ^

}
std::vector<uint8_t> calculate_hash(HMAC_size(&ctx));

unsigned int calculate_hash_len;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'calculate_hash_len' is not initialized [cppcoreguidelines-init-variables]

Suggested change
unsigned int calculate_hash_len;
unsigned int calculate_hash_len = 0;

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.75%. Comparing base (274e9e6) to head (3c4bf28).
Report is 3 commits behind head on inject-hash-cpp-experiment.

Additional details and impacted files
@@                      Coverage Diff                       @@
##           inject-hash-cpp-experiment    #2557      +/-   ##
==============================================================
- Coverage                       78.90%   78.75%   -0.15%     
==============================================================
  Files                             640      642       +2     
  Lines                          109766   110241     +475     
  Branches                        15526    15604      +78     
==============================================================
+ Hits                            86612    86824     +212     
- Misses                          22457    22719     +262     
- Partials                          697      698       +1     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 this pull request may close these issues.

2 participants