INNER CODE UNIT · C++
extra_data_size
trailofbits/uthenticode · src/uthenticode.cpp:620
auto extra_data_size = file_size - (security_dir.Size + total_bytes_hashed);
auto *trailer_buf = peparse::splitBuffer(
pe->fileBuffer, total_bytes_hashed, total_bytes_hashed + extra_data_size);
if (trailer_buf == nullptr) {
return {};
}
pe_bits.insert(pe_bits.end(), trailer_buf->buf, trailer_buf->buf + trailer_buf->bufLen);
delete trailer_buf;
/* Finally, hash the damn thing.
*
* NOTE(ww): Instead of building up pe_bits and hashing it in one pass, we
* could hash it incrementally with each section. This would also solve
* the capture problem with the C++ callback above and would reduce
* the number of needed allocations.
*/
std::array<std::uint8_t, EVP_MAX_MD_SIZE> md_buf;
const auto *md = EVP_get_digestbynid(nid);