diff options
author | Michael Brown | 2015-07-28 00:28:01 +0200 |
---|---|---|
committer | Michael Brown | 2015-07-28 00:28:01 +0200 |
commit | fae7a5310ad560f6afa3ab94ed349510443caf56 (patch) | |
tree | 3ac110ff551af2f6c543064a799561296e225ef9 | |
parent | [crypto] Remove AXTLS headers (diff) | |
download | ipxe-fae7a5310ad560f6afa3ab94ed349510443caf56.tar.gz ipxe-fae7a5310ad560f6afa3ab94ed349510443caf56.tar.xz ipxe-fae7a5310ad560f6afa3ab94ed349510443caf56.zip |
[build] Fix strict-aliasing warning on older gcc versions
Reported-by: James A. Peltier <jpeltier@sfu.ca>
Reported-by: Matthew Helton <mwhelton@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r-- | src/crypto/aes.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/crypto/aes.c b/src/crypto/aes.c index 1605d2ee..b9e206bf 100644 --- a/src/crypto/aes.c +++ b/src/crypto/aes.c @@ -156,13 +156,17 @@ static struct aes_table aes_invmixcolumns; */ static inline __attribute__ (( always_inline )) uint32_t aes_entry_column ( const union aes_table_entry *entry, unsigned int column ) { - const uint8_t *first __attribute__ (( may_alias )); + const union { + uint8_t byte; + uint32_t column; + } __attribute__ (( may_alias )) *product; - /* Locate start of relevant four-byte subset */ - first = &entry->byte[ 4 - column ]; + /* Locate relevant four-byte subset */ + product = container_of ( &entry->byte[ 4 - column ], + typeof ( *product ), byte ); /* Extract this four-byte subset */ - return ( *( ( uint32_t * ) first ) ); + return product->column; } /** |