CRYPTO_TFM_MODE_ECB); 
CRYPTO_TFM_MODE_ECB | CRYPTO_TFM_REQ_MAY_SLEEP); 
static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,	                      const char *opts){	struct crypto_tfm *essiv_tfm;	struct crypto_tfm *hash_tfm;	struct scatterlist sg;	unsigned int saltsize;	u8 *salt;	if (opts == NULL) {		ti->error = PFX "Digest algorithm missing for ESSIV mode";		return -EINVAL;	}	/* Hash the cipher key with the given hash algorithm */	hash_tfm = crypto_alloc_tfm(opts, 0);	if (hash_tfm == NULL) {		ti->error = PFX "Error initializing ESSIV hash";		return -EINVAL;	}	if (crypto_tfm_alg_type(hash_tfm) != CRYPTO_ALG_TYPE_DIGEST) {		ti->error = PFX "Expected digest algorithm for ESSIV hash";		crypto_free_tfm(hash_tfm);		return -EINVAL;	}	saltsize = crypto_tfm_alg_digestsize(hash_tfm);	salt = kmalloc(saltsize, GFP_KERNEL);	if (salt == NULL) {		ti->error = PFX "Error kmallocing salt storage in ESSIV";		crypto_free_tfm(hash_tfm);		return -ENOMEM;	}	sg.page = virt_to_page(cc->key);	sg.offset = offset_in_page(cc->key);	sg.length = cc->key_size;	crypto_digest_digest(hash_tfm, &sg, 1, salt);	crypto_free_tfm(hash_tfm);	/* Setup the essiv_tfm with the given salt */	essiv_tfm = crypto_alloc_tfm(crypto_tfm_alg_name(cc->tfm),	                             CRYPTO_TFM_MODE_ECB);	if (essiv_tfm == NULL) {		ti->error = PFX "Error allocating crypto tfm for ESSIV";		kfree(salt);		return -EINVAL;	}	if (crypto_tfm_alg_blocksize(essiv_tfm)	    != crypto_tfm_alg_ivsize(cc->tfm)) {		ti->error = PFX "Block size of ESSIV cipher does "			        "not match IV size of block cipher";		crypto_free_tfm(essiv_tfm);		kfree(salt);		return -EINVAL;	}	if (crypto_cipher_setkey(essiv_tfm, salt, saltsize) < 0) {		ti->error = PFX "Failed to set key for ESSIV cipher";		crypto_free_tfm(essiv_tfm);		kfree(salt);		return -EINVAL;	}	kfree(salt);	cc->iv_gen_private = (void *)essiv_tfm;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/eb6f1160ddb2fdadf50f350da79d0796c37f17e2/dm-crypt.c/clean/drivers/md/dm-crypt.c