Lines Matching full:iv

114 	int (*generator)(struct crypt_config *cc, u8 *iv,
116 void (*post)(struct crypt_config *cc, u8 *iv,
151 CRYPT_IV_LARGE_SECTORS, /* Calculate IV from sector_size, not 512B sectors */
204 * IV
206 * The padding is added so that dm_crypt_request and the IV are
325 * Different IV generation algorithms:
350 * with an IV derived from the sector number, the data and
351 * optionally extra IV seed.
356 * version 2: uses 64 multikey scheme with lmk IV generator
357 * version 3: the same as version 2 with additional IV seed
358 * (it uses 65 keys, last key is used as IV seed)
364 * with an IV derived from initial key and the sector number.
370 * eboiv: Encrypted byte-offset IV (used in Bitlocker in CBC mode)
371 * The IV is encrypted little-endian byte-offset (with the same key
380 static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv,
383 memset(iv, 0, cc->iv_size);
384 *(__le32 *)iv = cpu_to_le32(dmreq->iv_sector & 0xffffffff);
389 static int crypt_iv_plain64_gen(struct crypt_config *cc, u8 *iv,
392 memset(iv, 0, cc->iv_size);
393 *(__le64 *)iv = cpu_to_le64(dmreq->iv_sector);
398 static int crypt_iv_plain64be_gen(struct crypt_config *cc, u8 *iv,
401 memset(iv, 0, cc->iv_size);
403 *(__be64 *)&iv[cc->iv_size - sizeof(u64)] = cpu_to_be64(dmreq->iv_sector);
408 static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv,
412 * ESSIV encryption of the IV is now handled by the crypto API,
415 memset(iv, 0, cc->iv_size);
416 *(__le64 *)iv = cpu_to_le64(dmreq->iv_sector);
456 static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv,
461 memset(iv, 0, cc->iv_size - sizeof(u64)); /* rest is cleared below */
464 put_unaligned(val, (__be64 *)(iv + cc->iv_size - sizeof(u64)));
469 static int crypt_iv_null_gen(struct crypt_config *cc, u8 *iv,
472 memset(iv, 0, cc->iv_size);
537 static void crypt_iv_lmk_one(struct crypt_config *cc, u8 *iv,
561 memcpy(iv, ctx.state.h, cc->iv_size);
564 static int crypt_iv_lmk_gen(struct crypt_config *cc, u8 *iv,
573 crypt_iv_lmk_one(cc, iv, dmreq, src + sg->offset);
576 memset(iv, 0, cc->iv_size);
580 static void crypt_iv_lmk_post(struct crypt_config *cc, u8 *iv,
591 crypt_iv_lmk_one(cc, iv, dmreq, dst + sg->offset);
594 crypto_xor(dst + sg->offset, iv, cc->iv_size);
679 static int crypt_iv_tcw_gen(struct crypt_config *cc, u8 *iv,
695 /* Calculate IV */
696 crypto_xor_cpy(iv, tcw->iv_seed, (u8 *)&sector, 8);
698 crypto_xor_cpy(&iv[8], tcw->iv_seed + 8, (u8 *)&sector,
704 static void crypt_iv_tcw_post(struct crypt_config *cc, u8 *iv,
720 static int crypt_iv_random_gen(struct crypt_config *cc, u8 *iv,
723 /* Used only for writes, there must be an additional space to store IV */
724 get_random_bytes(iv, cc->iv_size);
737 ti->error = "Block size of EBOIV cipher does not match IV size of block cipher";
744 static int crypt_iv_eboiv_gen(struct crypt_config *cc, u8 *iv,
769 sg_init_one(&dst, iv, cc->iv_size);
1003 static int crypt_iv_elephant_gen(struct crypt_config *cc, u8 *iv,
1009 return crypt_iv_eboiv_gen(cc, iv, dmreq);
1012 static void crypt_iv_elephant_post(struct crypt_config *cc, u8 *iv,
1168 DMDEBUG("%s: Integrity AEAD, tag size %u, IV size %u.", dm_device_name(md),
1176 DMDEBUG("%s: Additional per-sector space %u bytes for IV.", dm_device_name(md),
1276 u8 *iv, *org_iv, *tag_iv, *tag;
1297 iv = iv_of_dmreq(cc, dmreq);
1305 * | sector_LE | IV | sector in/out | tag in/out |
1320 /* For READs use IV stored in integrity metadata */
1327 /* Store generated IV in integrity metadata */
1331 /* Working copy of IV, to be modified in crypto API */
1332 memcpy(iv, org_iv, cc->iv_size);
1338 cc->sector_size, iv);
1345 cc->sector_size + cc->integrity_tag_size, iv);
1379 u8 *iv, *org_iv, *tag_iv;
1395 iv = iv_of_dmreq(cc, dmreq);
1413 /* For READs use IV stored in integrity metadata */
1423 /* Store generated IV in integrity metadata */
1427 /* Working copy of IV, to be modified in crypto API */
1428 memcpy(iv, org_iv, cc->iv_size);
1431 skcipher_request_set_crypt(req, sg_in, sg_out, cc->sector_size, iv);
2410 /* Ignore extra keys (which are used for IV etc) */
2660 /* Wipe IV private keys */
2788 /* Choose ivmode, see comments at iv code. */
2817 * If present (version 3), last key is used as IV seed.
2818 * All keys (including IV seed) are always the same size.
2826 cc->key_parts += 2; /* IV + whitening */
2833 ti->error = "Invalid IV mode";
2890 * capi:cipher_api_spec-iv:ivopts
2894 /* Separate IV options if present, it can contain another '-' in hash name */
2900 /* Parse IV mode */
2973 * cipher[:keycount]-mode-iv:ivopts
3002 ti->error = "IV mechanism required";
3061 /* Initialize IV */
3073 /* Allocate IV */
3077 ti->error = "Error creating IV";
3082 /* Initialize IV (set keys for ESSIV etc) */
3086 ti->error = "Error initialising IV";
3282 /* ...| IV + padding | original IV | original sec. number | bio tag offset | */
3346 * cypher IV mode uses sector values, all data targeting a
3350 * for the actual data locations, resulting in IV mismatch.