Home GnuPG

fips: Use ELF header to find hmac file offset
4ed49a917212Unpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

fips: Use ELF header to find hmac file offset

* src/fips.c [ENABLE_HMAC_BINARY_CHECK] (hmac256_check): Use ELF headers
  to locate the file offset for the HMAC in addition to information from
  the loader

Backport master commit of:
beb5d6df5c5785db7c32a24a5d2a351cb964bfbc

The previous method of locating the offset of the .rodata1 section in
the ELF file on disk used information obtained from the loader. This
computed the address of the value in memory at runtime, but the offset
in the file can be different. Specifically, the old code computed
a value relative to ElfW(Phdr).p_vaddr, but the offset in the file is
relative to ElfW(Phdr).p_offset. These values can differ, so the
computed address at runtime must be translated into a file offset
relative to p_offset.

This is largely cosmetic, since the text section that should contain the
HMAC usually has both p_vaddr and p_offset set to 0.

  • Signed-off-by: Clemens Lang <cllang@redhat.com>

Details

Provenance
neverpanicAuthored on Feb 14 2022, 6:49 PM
gniibeCommitted on Feb 22 2022, 8:14 AM
Parents
rC64fef2140259: Silence compiler warnings for possible alignment problem.
Branches
Unknown
Tags
Unknown

Event Timeline