tfm = crypto_alloc_tfm(cipher, crypto_flags); 
tfm = crypto_alloc_tfm(cipher, crypto_flags | CRYPTO_TFM_REQ_MAY_SLEEP); 
static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv){	struct crypt_config *cc;	struct crypto_tfm *tfm;	char *tmp;	char *cipher;	char *chainmode;	char *ivmode;	char *ivopts;	unsigned int crypto_flags;	unsigned int key_size;	if (argc != 5) {		ti->error = PFX "Not enough arguments";		return -EINVAL;	}	tmp = argv[0];	cipher = strsep(&tmp, "-");	chainmode = strsep(&tmp, "-");	ivopts = strsep(&tmp, "-");	ivmode = strsep(&ivopts, ":");	if (tmp)		DMWARN(PFX "Unexpected additional cipher options");	key_size = strlen(argv[1]) >> 1;	cc = kmalloc(sizeof(*cc) + key_size * sizeof(u8), GFP_KERNEL);	if (cc == NULL) {		ti->error =			PFX "Cannot allocate transparent encryption context";		return -ENOMEM;	}	cc->key_size = key_size;	if ((!key_size && strcmp(argv[1], "-") != 0) ||	    (key_size && crypt_decode_key(cc->key, argv[1], key_size) < 0)) {		ti->error = PFX "Error decoding key";		goto bad1;	}	/* Compatiblity mode for old dm-crypt cipher strings */	if (!chainmode || (strcmp(chainmode, "plain") == 0 && !ivmode)) {		chainmode = "cbc";		ivmode = "plain";	}	/* Choose crypto_flags according to chainmode */	if (strcmp(chainmode, "cbc") == 0)		crypto_flags = CRYPTO_TFM_MODE_CBC;	else if (strcmp(chainmode, "ecb") == 0)		crypto_flags = CRYPTO_TFM_MODE_ECB;	else {		ti->error = PFX "Unknown chaining mode";		goto bad1;	}	if (crypto_flags != CRYPTO_TFM_MODE_ECB && !ivmode) {		ti->error = PFX "This chaining mode requires an IV mechanism";		goto bad1;	}	tfm = crypto_alloc_tfm(cipher, crypto_flags);	if (!tfm) {		ti->error = PFX "Error allocating crypto tfm";		goto bad1;	}	if (crypto_tfm_alg_type(tfm) != CRYPTO_ALG_TYPE_CIPHER) {		ti->error = PFX "Expected cipher algorithm";		goto bad2;	}	cc->tfm = tfm;	/*	 * Choose ivmode. Valid modes: "plain", "essiv:<esshash>".	 * See comments at iv code	 */	if (ivmode == NULL)		cc->iv_gen_ops = NULL;	else if (strcmp(ivmode, "plain") == 0)		cc->iv_gen_ops = &crypt_iv_plain_ops;	else if (strcmp(ivmode, "essiv") == 0)		cc->iv_gen_ops = &crypt_iv_essiv_ops;	else {		ti->error = PFX "Invalid IV mode";		goto bad2;	}	if (cc->iv_gen_ops && cc->iv_gen_ops->ctr &&	    cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)		goto bad2;	if (tfm->crt_cipher.cit_decrypt_iv && tfm->crt_cipher.cit_encrypt_iv)		/* at least a 64 bit sector number should fit in our buffer */		cc->iv_size = max(crypto_tfm_alg_ivsize(tfm),		                  (unsigned int)(sizeof(u64) / sizeof(u8)));	else {		cc->iv_size = 0;		if (cc->iv_gen_ops) {			DMWARN(PFX "Selected cipher does not support IVs");			if (cc->iv_gen_ops->dtr)				cc->iv_gen_ops->dtr(cc);			cc->iv_gen_ops = NULL;		}	}	cc->io_pool = mempool_create(MIN_IOS, mempool_alloc_slab,				     mempool_free_slab, _crypt_io_pool);	if (!cc->io_pool) {		ti->error = PFX "Cannot allocate crypt io mempool";		goto bad3;	}	cc->page_pool = mempool_create(MIN_POOL_PAGES, mempool_alloc_page,				       mempool_free_page, NULL);	if (!cc->page_pool) {		ti->error = PFX "Cannot allocate page mempool";		goto bad4;	}	if (tfm->crt_cipher.cit_setkey(tfm, cc->key, key_size) < 0) {		ti->error = PFX "Error setting key";		goto bad5;	}	if (sscanf(argv[2], SECTOR_FORMAT, &cc->iv_offset) != 1) {		ti->error = PFX "Invalid iv_offset sector";		goto bad5;	}	if (sscanf(argv[4], SECTOR_FORMAT, &cc->start) != 1) {		ti->error = PFX "Invalid device sector";		goto bad5;	}	if (dm_get_device(ti, argv[3], cc->start, ti->len,	                  dm_table_get_mode(ti->table), &cc->dev)) {		ti->error = PFX "Device lookup failed";		goto bad5;	}	if (ivmode && cc->iv_gen_ops) {		if (ivopts)			*(ivopts - 1) = ':';		cc->iv_mode = kmalloc(strlen(ivmode) + 1, GFP_KERNEL);		if (!cc->iv_mode) {			ti->error = PFX "Error kmallocing iv_mode string";			goto bad5;		}		strcpy(cc->iv_mode, ivmode);	} else		cc->iv_mode = NULL;	ti->private = cc;	return 0;bad5:	mempool_destroy(cc->page_pool);bad4:	mempool_destroy(cc->io_pool);bad3:	if (cc->iv_gen_ops && cc->iv_gen_ops->dtr)		cc->iv_gen_ops->dtr(cc);bad2:	crypto_free_tfm(tfm);bad1:	kfree(cc);	return -EINVAL;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/eb6f1160ddb2fdadf50f350da79d0796c37f17e2/dm-crypt.c/clean/drivers/md/dm-crypt.c