[Heimdal-source-changes] [heimdal/heimdal] aa87e0: Use C99 designated initializers in a couple places
GitHub
noreply at github.com
Fre Sep 2 00:39:32 CEST 2016
Branch: refs/heads/master
Home: https://github.com/heimdal/heimdal
Commit: aa87e08cc72fdf708cfc353020a713970991a21b
https://github.com/heimdal/heimdal/commit/aa87e08cc72fdf708cfc353020a713970991a21b
Author: Benjamin Kaduk <kaduk at mit.edu>
Date: 2016-09-01 (Thu, 01 Sep 2016)
Changed paths:
M lib/hcrypto/rand-fortuna.c
M lib/hcrypto/rand-timer.c
Log Message:
-----------
Use C99 designated initializers in a couple places
Some portions of libhcrypto are reused by other projects in
diverse environments, including within operating system kernel modules.
In some such build environments, hardening measures such as grsecurity
can (randomly) reorder structure elements, so as to make it harder
for an attacker to determine the offset from a known field's address
to a different field that is needed for an attack.
However, doing so requires the use of C99 designated initializers
to make the source code compatible with such structure rearrangement,
as opposed to the "traditional" C aggregate type initializers, which
just list fields in order. This feature is also available as a
GCC extension since early versions of GCC. However, it is not
provided by many common versions of visual studio (and presumably
also not by the vendor compiler for various commercial Unixes),
so the traditional initializers must remain, behind a conditional.
__GNUC__ or __STDC_VERSION__ >= 199901 should be enough to get
most cases with support for designated initializers, at least
for now.
Signed-off-by: Nicolas Williams <nico at twosigma.com>
More information about the Heimdal-source-changes
mailing list