aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2006-05-16 08:20:34 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2006-06-26 03:34:39 -0400
commit82062c72cd643c99a9e1c231270acbab986fd23f (patch)
tree42c1900095bfa27c2f2b5af7566adc9caf7402bf
parent6c2bb98bc33ae33c7a33a133a4cd5a06395fece5 (diff)
[CRYPTO] padlock: Rearrange context structure to reduce code size
i386 assembly has more compact instructions for accessing 7-bit offsets. So by moving the large members to the end of the structure we can save quite a bit of code size. This patch shaves about 10% or 300 bytes off the padlock-aes file. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/padlock-aes.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index b98ad203d6cb..17ee684144f9 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -60,15 +60,14 @@
60#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t)) 60#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
61 61
62struct aes_ctx { 62struct aes_ctx {
63 uint32_t e_data[AES_EXTENDED_KEY_SIZE];
64 uint32_t d_data[AES_EXTENDED_KEY_SIZE];
65 struct { 63 struct {
66 struct cword encrypt; 64 struct cword encrypt;
67 struct cword decrypt; 65 struct cword decrypt;
68 } cword; 66 } cword;
69 uint32_t *E; 67 u32 *D;
70 uint32_t *D;
71 int key_length; 68 int key_length;
69 u32 E[AES_EXTENDED_KEY_SIZE];
70 u32 d_data[AES_EXTENDED_KEY_SIZE];
72}; 71};
73 72
74/* ====== Key management routines ====== */ 73/* ====== Key management routines ====== */
@@ -313,8 +312,7 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
313 * itself we must supply the plain key for both encryption 312 * itself we must supply the plain key for both encryption
314 * and decryption. 313 * and decryption.
315 */ 314 */
316 ctx->E = ctx->e_data; 315 ctx->D = ctx->E;
317 ctx->D = ctx->e_data;
318 316
319 E_KEY[0] = le32_to_cpu(key[0]); 317 E_KEY[0] = le32_to_cpu(key[0]);
320 E_KEY[1] = le32_to_cpu(key[1]); 318 E_KEY[1] = le32_to_cpu(key[1]);