sha3: Make sure state and rate input buffers are 8-byte aligned
Both buffers are accessed directly by casting to `uint64_t`. On platforms that don't allow unaligned accesses this could cause a SIGBUS. The reorder should avoid extra padding between the two buffers. Fixes:5ff88c9622("xof: Implemented SHAKE128 and SHAKE256 Extended Output Functions") Fixes:83c1883d0b("Use word-aligned XOR in sha3_absorb()")
This commit is contained in:
@@ -59,18 +59,18 @@ struct private_sha3_keccak_t {
|
|||||||
/**
|
/**
|
||||||
* Internal state of 1600 bits as defined by FIPS-202
|
* Internal state of 1600 bits as defined by FIPS-202
|
||||||
*/
|
*/
|
||||||
uint8_t state[KECCAK_STATE_SIZE];
|
uint8_t state[KECCAK_STATE_SIZE] __attribute__((aligned(8)));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rate input buffer
|
||||||
|
*/
|
||||||
|
uint8_t rate_buffer[KECCAK_MAX_RATE] __attribute__((aligned(8)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rate in bytes
|
* Rate in bytes
|
||||||
*/
|
*/
|
||||||
u_int rate;
|
u_int rate;
|
||||||
|
|
||||||
/**
|
|
||||||
* Rate input buffer
|
|
||||||
*/
|
|
||||||
uint8_t rate_buffer[KECCAK_MAX_RATE];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Index pointing to the current position in the rate buffer
|
* Index pointing to the current position in the rate buffer
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user