Skip to content

Add LIEF as submodule for inject_hash implementation #2532

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

Closed
wants to merge 11 commits into from

Conversation

prikhap
Copy link

@prikhap prikhap commented Jul 10, 2025

  • 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 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.
@prikhap prikhap requested a review from a team as a code owner July 10, 2025 08:21
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

@@ -0,0 +1,37 @@
#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>
         ^

@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.88%. Comparing base (274e9e6) to head (d178832).
Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2532      +/-   ##
==========================================
- Coverage   78.90%   78.88%   -0.03%     
==========================================
  Files         640      645       +5     
  Lines      109766   112000    +2234     
  Branches    15526    15995     +469     
==========================================
+ Hits        86612    88347    +1735     
- Misses      22457    22955     +498     
- 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.

prikhap added 4 commits July 10, 2025 14:18
- 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
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

}
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;

@prikhap prikhap force-pushed the implement-inject-hash-clean branch from a29cda3 to a11e97a Compare July 17, 2025 23:28
@prikhap prikhap force-pushed the implement-inject-hash-clean branch from 9f4fa5d to 62d0cb0 Compare July 18, 2025 22:36
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


if (is_archive) {
// Create temporary directory
std::string temp_dir = std::filesystem::temp_directory_path().string() +
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 'temp_dir' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string temp_dir = std::filesystem::temp_directory_path().string() +
y = 0

}

// There should be only one object file
std::string object_file;
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 'object_file' is not initialized [cppcoreguidelines-init-variables]

util/fipstools/inject_hash_cpp/inject_hash.cpp:57:

- le;
+ le = 0;

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

}

// Find extracted file
std::string extracted_file;
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 'extracted_file' is not initialized [cppcoreguidelines-init-variables]

util/fipstools/inject_hash_cpp/inject_hash.cpp:62:

- le;
+ le = 0;

@prikhap prikhap force-pushed the implement-inject-hash-clean branch from 381be2b to 62d0cb0 Compare July 21, 2025 18:35
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

}

// Get the input and output file paths
std::string input_file, output_file;
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 'input_file' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::string input_file, output_file;
s = 0

}

// Get the input and output file paths
std::string input_file, output_file;
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 'output_file' is not initialized [cppcoreguidelines-init-variables]

util/fipstools/inject_hash_cpp/inject_hash.cpp:38:

- ;
+  = 0;

@prikhap prikhap closed this Jul 24, 2025
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