Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
mcb30 committed Jul 27, 2015
1 parent 657dd5f commit fae7a53
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/crypto/aes.c
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit fae7a53

Please sign in to comment.