 ctx->D = ctx->d_data; ctx->cword.encrypt.keygen = 1; ctx->cword.decrypt.keygen = 1; 
aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t *flags){	struct aes_ctx *ctx = ctx_arg;	uint32_t i, t, u, v, w;	uint32_t P[AES_EXTENDED_KEY_SIZE];	uint32_t rounds;	if (key_len != 16 && key_len != 24 && key_len != 32) {		*flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;		return -EINVAL;	}	ctx->key_length = key_len;	ctx->E = ctx->e_data;	ctx->D = ctx->d_data;	/* Ensure 16-Bytes alignmentation of keys for VIA PadLock. */	if ((int)(ctx->e_data) & 0x0F)		ctx->E += 4 - (((int)(ctx->e_data) & 0x0F) / sizeof (ctx->e_data[0]));	if ((int)(ctx->d_data) & 0x0F)		ctx->D += 4 - (((int)(ctx->d_data) & 0x0F) / sizeof (ctx->d_data[0]));	E_KEY[0] = uint32_t_in (in_key);	E_KEY[1] = uint32_t_in (in_key + 4);	E_KEY[2] = uint32_t_in (in_key + 8);	E_KEY[3] = uint32_t_in (in_key + 12);	/* Don't generate extended keys if the hardware can do it. */	if (aes_hw_extkey_available(key_len))		return 0;	switch (key_len) {	case 16:		t = E_KEY[3];		for (i = 0; i < 10; ++i)			loop4 (i);		break;	case 24:		E_KEY[4] = uint32_t_in (in_key + 16);		t = E_KEY[5] = uint32_t_in (in_key + 20);		for (i = 0; i < 8; ++i)			loop6 (i);		break;	case 32:		E_KEY[4] = uint32_t_in (in_key + 16);		E_KEY[5] = uint32_t_in (in_key + 20);		E_KEY[6] = uint32_t_in (in_key + 24);		t = E_KEY[7] = uint32_t_in (in_key + 28);		for (i = 0; i < 7; ++i)			loop8 (i);		break;	}	D_KEY[0] = E_KEY[0];	D_KEY[1] = E_KEY[1];	D_KEY[2] = E_KEY[2];	D_KEY[3] = E_KEY[3];	for (i = 4; i < key_len + 24; ++i) {		imix_col (D_KEY[i], E_KEY[i]);	}	/* PadLock needs a different format of the decryption key. */	rounds = 10 + (key_len - 16) / 4;	for (i = 0; i < rounds; i++) {		P[((i + 1) * 4) + 0] = D_KEY[((rounds - i - 1) * 4) + 0];		P[((i + 1) * 4) + 1] = D_KEY[((rounds - i - 1) * 4) + 1];		P[((i + 1) * 4) + 2] = D_KEY[((rounds - i - 1) * 4) + 2];		P[((i + 1) * 4) + 3] = D_KEY[((rounds - i - 1) * 4) + 3];	}	P[0] = E_KEY[(rounds * 4) + 0];	P[1] = E_KEY[(rounds * 4) + 1];	P[2] = E_KEY[(rounds * 4) + 2];	P[3] = E_KEY[(rounds * 4) + 3];	memcpy(D_KEY, P, AES_EXTENDED_KEY_SIZE_B);	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6789b2dc455b90efc9c88886c9366adc9abb7347/padlock-aes.c/clean/drivers/crypto/padlock-aes.c