[PATCH v2 1/2] fips: Use ELF header to find hmac file offset

Werner Koch wk at gnupg.org
Tue Feb 15 08:52:23 CET 2022

On Mon, 14 Feb 2022 18:49, Clemens Lang said:

> +  // iterate over the program headers, compare their virtual addresses with the
> +  // address we are looking for, and if the program header matches, calculate
> +  // the offset of the given paddr in the file using the program header's

Please don't use C++ comments - we stick to standard C90 comments.

> +      if (1 != fread (&phdr, sizeof (phdr), 1, fp))

That is hard to read.  Given the state of current compilers this old
trick is not needed.  We are reading code left to righta nd partially
reversing the direction is an uncommon pattern.  So please don't do.

> +  unsigned long offset = 0;
>    unsigned long off = 0;

The names are too similar - better use off2 or tmpoff instead of offset.

Sorry for nitpicky - thanks for your work.



Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gcrypt-devel/attachments/20220215/2a02c82c/attachment.sig>

More information about the Gcrypt-devel mailing list