[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>
This commit is contained in:
Родитель
6c2bb98bc3
Коммит
82062c72cd
|
@ -60,15 +60,14 @@
|
||||||
#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
|
#define AES_EXTENDED_KEY_SIZE_B (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
|
||||||
|
|
||||||
struct aes_ctx {
|
struct aes_ctx {
|
||||||
uint32_t e_data[AES_EXTENDED_KEY_SIZE];
|
|
||||||
uint32_t d_data[AES_EXTENDED_KEY_SIZE];
|
|
||||||
struct {
|
struct {
|
||||||
struct cword encrypt;
|
struct cword encrypt;
|
||||||
struct cword decrypt;
|
struct cword decrypt;
|
||||||
} cword;
|
} cword;
|
||||||
uint32_t *E;
|
u32 *D;
|
||||||
uint32_t *D;
|
|
||||||
int key_length;
|
int key_length;
|
||||||
|
u32 E[AES_EXTENDED_KEY_SIZE];
|
||||||
|
u32 d_data[AES_EXTENDED_KEY_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ====== Key management routines ====== */
|
/* ====== Key management routines ====== */
|
||||||
|
@ -313,8 +312,7 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
|
||||||
* itself we must supply the plain key for both encryption
|
* itself we must supply the plain key for both encryption
|
||||||
* and decryption.
|
* and decryption.
|
||||||
*/
|
*/
|
||||||
ctx->E = ctx->e_data;
|
ctx->D = ctx->E;
|
||||||
ctx->D = ctx->e_data;
|
|
||||||
|
|
||||||
E_KEY[0] = le32_to_cpu(key[0]);
|
E_KEY[0] = le32_to_cpu(key[0]);
|
||||||
E_KEY[1] = le32_to_cpu(key[1]);
|
E_KEY[1] = le32_to_cpu(key[1]);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче