Re: [PATCH] crypto: fix key alignment in tcrypt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt Mackall <[email protected]> writes:

> On Wed, Mar 08, 2006 at 11:11:55PM +0900, Atsushi Nemoto wrote:
>> Force 32-bit alignment on keys in tcrypt test vectors.
>> 
>> Signed-off-by: Atsushi Nemoto <[email protected]>
>> 
>> diff --git a/crypto/tcrypt.h b/crypto/tcrypt.h
>> index 733d07e..050f852 100644
>> --- a/crypto/tcrypt.h
>> +++ b/crypto/tcrypt.h
>> @@ -31,7 +31,7 @@ struct hash_testvec {
>>  	char digest[MAX_DIGEST_SIZE];
>>  	unsigned char np;
>>  	unsigned char tap[MAX_TAP];
>> -	char key[128]; /* only used with keyed hash algorithms */
>> +	char key[128] __attribute__((__aligned__(4))); /* only used with keyed hash algorithms */
>>  	unsigned char ksize;
>>  };
>>  
>> @@ -48,7 +48,7 @@ struct hmac_testvec {
>>  struct cipher_testvec {
>>  	unsigned char fail;
>>  	unsigned char wk; /* weak key flag */
>> -	char key[MAX_KEYLEN];
>> +	char key[MAX_KEYLEN] __attribute__((__aligned__(4)));
>>  	unsigned char klen;
>>  	char iv[MAX_IVLEN];
>>  	char input[48];
>
> Wouldn't it be better to simply move this to the head of the structure?

That wouldn't help, since the whole structure will still be only 8-bit
aligned.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux