summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2018-12-16 18:55:06 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2018-12-22 22:52:45 -0500
commitc79b411eaa7257204f89c30651c45cea22278769 (patch)
tree8618422aba6b486d76cd0ab5f3d3515d9e823558
parentdec5d0db0de7271c7616d713f6c434c6366c9bfb (diff)
crypto: skcipher - remove remnants of internal IV generators
Remove dead code related to internal IV generators, which are no longer used since they've been replaced with the "seqiv" and "echainiv" templates. The removed code includes: - The "givcipher" (GIVCIPHER) algorithm type. No algorithms are registered with this type anymore, so it's unneeded. - The "const char *geniv" member of aead_alg, ablkcipher_alg, and blkcipher_alg. A few algorithms still set this, but it isn't used anymore except to show via /proc/crypto and CRYPTO_MSG_GETALG. Just hardcode "<default>" or "<none>" in those cases. - The 'skcipher_givcrypt_request' structure, which is never used. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--Documentation/crypto/api.rst9
-rw-r--r--Documentation/crypto/architecture.rst31
-rw-r--r--crypto/ablkcipher.c76
-rw-r--r--crypto/blkcipher.c6
-rw-r--r--crypto/cryptd.c4
-rw-r--r--crypto/ctr.c2
-rw-r--r--crypto/skcipher.c6
-rw-r--r--drivers/crypto/bcm/cipher.c1
-rw-r--r--drivers/crypto/chelsio/chcr_algo.c1
-rw-r--r--drivers/crypto/ixp4xx_crypto.c5
-rw-r--r--drivers/crypto/nx/nx-aes-ctr.c1
-rw-r--r--drivers/crypto/omap-aes.c1
-rw-r--r--drivers/crypto/picoxcell_crypto.c3
-rw-r--r--drivers/crypto/talitos.c1
-rw-r--r--include/crypto/aead.h3
-rw-r--r--include/crypto/internal/skcipher.h2
-rw-r--r--include/crypto/skcipher.h13
-rw-r--r--include/linux/crypto.h34
18 files changed, 17 insertions, 182 deletions
diff --git a/Documentation/crypto/api.rst b/Documentation/crypto/api.rst
index 2e519193ab4a..b91b31736df8 100644
--- a/Documentation/crypto/api.rst
+++ b/Documentation/crypto/api.rst
@@ -1,15 +1,6 @@
1Programming Interface 1Programming Interface
2===================== 2=====================
3 3
4Please note that the kernel crypto API contains the AEAD givcrypt API
5(crypto_aead_giv\* and aead_givcrypt\* function calls in
6include/crypto/aead.h). This API is obsolete and will be removed in the
7future. To obtain the functionality of an AEAD cipher with internal IV
8generation, use the IV generator as a regular cipher. For example,
9rfc4106(gcm(aes)) is the AEAD cipher with external IV generation and
10seqniv(rfc4106(gcm(aes))) implies that the kernel crypto API generates
11the IV. Different IV generators are available.
12
13.. class:: toc-title 4.. class:: toc-title
14 5
15 Table of contents 6 Table of contents
diff --git a/Documentation/crypto/architecture.rst b/Documentation/crypto/architecture.rst
index ca2d09b991f5..ee8ff0762d7f 100644
--- a/Documentation/crypto/architecture.rst
+++ b/Documentation/crypto/architecture.rst
@@ -157,10 +157,6 @@ applicable to a cipher, it is not displayed:
157 157
158 - rng for random number generator 158 - rng for random number generator
159 159
160 - givcipher for cipher with associated IV generator (see the geniv
161 entry below for the specification of the IV generator type used by
162 the cipher implementation)
163
164 - kpp for a Key-agreement Protocol Primitive (KPP) cipher such as 160 - kpp for a Key-agreement Protocol Primitive (KPP) cipher such as
165 an ECDH or DH implementation 161 an ECDH or DH implementation
166 162
@@ -174,16 +170,7 @@ applicable to a cipher, it is not displayed:
174 170
175- digestsize: output size of the message digest 171- digestsize: output size of the message digest
176 172
177- geniv: IV generation type: 173- geniv: IV generator (obsolete)
178
179 - eseqiv for encrypted sequence number based IV generation
180
181 - seqiv for sequence number based IV generation
182
183 - chainiv for chain iv generation
184
185 - <builtin> is a marker that the cipher implements IV generation and
186 handling as it is specific to the given cipher
187 174
188Key Sizes 175Key Sizes
189--------- 176---------
@@ -218,10 +205,6 @@ the aforementioned cipher types:
218 205
219- CRYPTO_ALG_TYPE_ABLKCIPHER Asynchronous multi-block cipher 206- CRYPTO_ALG_TYPE_ABLKCIPHER Asynchronous multi-block cipher
220 207
221- CRYPTO_ALG_TYPE_GIVCIPHER Asynchronous multi-block cipher packed
222 together with an IV generator (see geniv field in the /proc/crypto
223 listing for the known IV generators)
224
225- CRYPTO_ALG_TYPE_KPP Key-agreement Protocol Primitive (KPP) such as 208- CRYPTO_ALG_TYPE_KPP Key-agreement Protocol Primitive (KPP) such as
226 an ECDH or DH implementation 209 an ECDH or DH implementation
227 210
@@ -338,18 +321,14 @@ uses the API applicable to the cipher type specified for the block.
338 321
339The following call sequence is applicable when the IPSEC layer triggers 322The following call sequence is applicable when the IPSEC layer triggers
340an encryption operation with the esp_output function. During 323an encryption operation with the esp_output function. During
341configuration, the administrator set up the use of rfc4106(gcm(aes)) as 324configuration, the administrator set up the use of seqiv(rfc4106(gcm(aes)))
342the cipher for ESP. The following call sequence is now depicted in the 325as the cipher for ESP. The following call sequence is now depicted in
343ASCII art above: 326the ASCII art above:
344 327
3451. esp_output() invokes crypto_aead_encrypt() to trigger an 3281. esp_output() invokes crypto_aead_encrypt() to trigger an
346 encryption operation of the AEAD cipher with IV generator. 329 encryption operation of the AEAD cipher with IV generator.
347 330
348 In case of GCM, the SEQIV implementation is registered as GIVCIPHER 331 The SEQIV generates the IV.
349 in crypto_rfc4106_alloc().
350
351 The SEQIV performs its operation to generate an IV where the core
352 function is seqiv_geniv().
353 332
3542. Now, SEQIV uses the AEAD API function calls to invoke the associated 3332. Now, SEQIV uses the AEAD API function calls to invoke the associated
355 AEAD cipher. In our case, during the instantiation of SEQIV, the 334 AEAD cipher. In our case, during the instantiation of SEQIV, the
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index b5e9ce19d324..b339587073c3 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -368,8 +368,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
368 memset(&rblkcipher, 0, sizeof(rblkcipher)); 368 memset(&rblkcipher, 0, sizeof(rblkcipher));
369 369
370 strscpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type)); 370 strscpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
371 strscpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>", 371 strscpy(rblkcipher.geniv, "<default>", sizeof(rblkcipher.geniv));
372 sizeof(rblkcipher.geniv));
373 372
374 rblkcipher.blocksize = alg->cra_blocksize; 373 rblkcipher.blocksize = alg->cra_blocksize;
375 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize; 374 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
@@ -399,7 +398,7 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
399 seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize); 398 seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
400 seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize); 399 seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
401 seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize); 400 seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
402 seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<default>"); 401 seq_printf(m, "geniv : <default>\n");
403} 402}
404 403
405const struct crypto_type crypto_ablkcipher_type = { 404const struct crypto_type crypto_ablkcipher_type = {
@@ -411,74 +410,3 @@ const struct crypto_type crypto_ablkcipher_type = {
411 .report = crypto_ablkcipher_report, 410 .report = crypto_ablkcipher_report,
412}; 411};
413EXPORT_SYMBOL_GPL(crypto_ablkcipher_type); 412EXPORT_SYMBOL_GPL(crypto_ablkcipher_type);
414
415static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
416 u32 mask)
417{
418 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher;
419 struct ablkcipher_tfm *crt = &tfm->crt_ablkcipher;
420
421 if (alg->ivsize > PAGE_SIZE / 8)
422 return -EINVAL;
423
424 crt->setkey = tfm->__crt_alg->cra_flags & CRYPTO_ALG_GENIV ?
425 alg->setkey : setkey;
426 crt->encrypt = alg->encrypt;
427 crt->decrypt = alg->decrypt;
428 crt->base = __crypto_ablkcipher_cast(tfm);
429 crt->ivsize = alg->ivsize;
430
431 return 0;
432}
433
434#ifdef CONFIG_NET
435static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
436{
437 struct crypto_report_blkcipher rblkcipher;
438
439 memset(&rblkcipher, 0, sizeof(rblkcipher));
440
441 strscpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type));
442 strscpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>",
443 sizeof(rblkcipher.geniv));
444
445 rblkcipher.blocksize = alg->cra_blocksize;
446 rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
447 rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;
448 rblkcipher.ivsize = alg->cra_ablkcipher.ivsize;
449
450 return nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,
451 sizeof(rblkcipher), &rblkcipher);
452}
453#else
454static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
455{
456 return -ENOSYS;
457}
458#endif
459
460static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
461 __maybe_unused;
462static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
463{
464 struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher;
465
466 seq_printf(m, "type : givcipher\n");
467 seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
468 "yes" : "no");
469 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
470 seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
471 seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
472 seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
473 seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<built-in>");
474}
475
476const struct crypto_type crypto_givcipher_type = {
477 .ctxsize = crypto_ablkcipher_ctxsize,
478 .init = crypto_init_givcipher_ops,
479#ifdef CONFIG_PROC_FS
480 .show = crypto_givcipher_show,
481#endif
482 .report = crypto_givcipher_report,
483};
484EXPORT_SYMBOL_GPL(crypto_givcipher_type);
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 193237514e90..c5398bd54942 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -510,8 +510,7 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
510 memset(&rblkcipher, 0, sizeof(rblkcipher)); 510 memset(&rblkcipher, 0, sizeof(rblkcipher));
511 511
512 strscpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type)); 512 strscpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type));
513 strscpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>", 513 strscpy(rblkcipher.geniv, "<default>", sizeof(rblkcipher.geniv));
514 sizeof(rblkcipher.geniv));
515 514
516 rblkcipher.blocksize = alg->cra_blocksize; 515 rblkcipher.blocksize = alg->cra_blocksize;
517 rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize; 516 rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
@@ -537,8 +536,7 @@ static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg)
537 seq_printf(m, "min keysize : %u\n", alg->cra_blkcipher.min_keysize); 536 seq_printf(m, "min keysize : %u\n", alg->cra_blkcipher.min_keysize);
538 seq_printf(m, "max keysize : %u\n", alg->cra_blkcipher.max_keysize); 537 seq_printf(m, "max keysize : %u\n", alg->cra_blkcipher.max_keysize);
539 seq_printf(m, "ivsize : %u\n", alg->cra_blkcipher.ivsize); 538 seq_printf(m, "ivsize : %u\n", alg->cra_blkcipher.ivsize);
540 seq_printf(m, "geniv : %s\n", alg->cra_blkcipher.geniv ?: 539 seq_printf(m, "geniv : <default>\n");
541 "<default>");
542} 540}
543 541
544const struct crypto_type crypto_blkcipher_type = { 542const struct crypto_type crypto_blkcipher_type = {
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 7118fb5efbaa..5640e5db7bdb 100644
--- a/crypto/cryptd.c
+++ b/crypto/cryptd.c
@@ -422,8 +422,6 @@ static int cryptd_create_blkcipher(struct crypto_template *tmpl,
422 inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize; 422 inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
423 inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize; 423 inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize;
424 424
425 inst->alg.cra_ablkcipher.geniv = alg->cra_blkcipher.geniv;
426
427 inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx); 425 inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx);
428 426
429 inst->alg.cra_init = cryptd_blkcipher_init_tfm; 427 inst->alg.cra_init = cryptd_blkcipher_init_tfm;
@@ -1174,7 +1172,7 @@ struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
1174 return ERR_PTR(-EINVAL); 1172 return ERR_PTR(-EINVAL);
1175 type = crypto_skcipher_type(type); 1173 type = crypto_skcipher_type(type);
1176 mask &= ~CRYPTO_ALG_TYPE_MASK; 1174 mask &= ~CRYPTO_ALG_TYPE_MASK;
1177 mask |= (CRYPTO_ALG_GENIV | CRYPTO_ALG_TYPE_BLKCIPHER_MASK); 1175 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
1178 tfm = crypto_alloc_base(cryptd_alg_name, type, mask); 1176 tfm = crypto_alloc_base(cryptd_alg_name, type, mask);
1179 if (IS_ERR(tfm)) 1177 if (IS_ERR(tfm))
1180 return ERR_CAST(tfm); 1178 return ERR_CAST(tfm);
diff --git a/crypto/ctr.c b/crypto/ctr.c
index 435b75bd619e..30f3946efc6d 100644
--- a/crypto/ctr.c
+++ b/crypto/ctr.c
@@ -233,8 +233,6 @@ static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb)
233 inst->alg.cra_blkcipher.encrypt = crypto_ctr_crypt; 233 inst->alg.cra_blkcipher.encrypt = crypto_ctr_crypt;
234 inst->alg.cra_blkcipher.decrypt = crypto_ctr_crypt; 234 inst->alg.cra_blkcipher.decrypt = crypto_ctr_crypt;
235 235
236 inst->alg.cra_blkcipher.geniv = "chainiv";
237
238out: 236out:
239 crypto_mod_put(alg); 237 crypto_mod_put(alg);
240 return inst; 238 return inst;
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 41b4f7f27f45..2a969296bc24 100644
--- a/crypto/skcipher.c
+++ b/crypto/skcipher.c
@@ -579,8 +579,7 @@ static unsigned int crypto_skcipher_extsize(struct crypto_alg *alg)
579 if (alg->cra_type == &crypto_blkcipher_type) 579 if (alg->cra_type == &crypto_blkcipher_type)
580 return sizeof(struct crypto_blkcipher *); 580 return sizeof(struct crypto_blkcipher *);
581 581
582 if (alg->cra_type == &crypto_ablkcipher_type || 582 if (alg->cra_type == &crypto_ablkcipher_type)
583 alg->cra_type == &crypto_givcipher_type)
584 return sizeof(struct crypto_ablkcipher *); 583 return sizeof(struct crypto_ablkcipher *);
585 584
586 return crypto_alg_extsize(alg); 585 return crypto_alg_extsize(alg);
@@ -844,8 +843,7 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
844 if (tfm->__crt_alg->cra_type == &crypto_blkcipher_type) 843 if (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)
845 return crypto_init_skcipher_ops_blkcipher(tfm); 844 return crypto_init_skcipher_ops_blkcipher(tfm);
846 845
847 if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type || 846 if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type)
848 tfm->__crt_alg->cra_type == &crypto_givcipher_type)
849 return crypto_init_skcipher_ops_ablkcipher(tfm); 847 return crypto_init_skcipher_ops_ablkcipher(tfm);
850 848
851 skcipher->setkey = skcipher_setkey; 849 skcipher->setkey = skcipher_setkey;
diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 2ce3a16d3d10..c9393ffb70ed 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -3868,7 +3868,6 @@ static struct iproc_alg_s driver_algs[] = {
3868 .cra_driver_name = "ctr-aes-iproc", 3868 .cra_driver_name = "ctr-aes-iproc",
3869 .cra_blocksize = AES_BLOCK_SIZE, 3869 .cra_blocksize = AES_BLOCK_SIZE,
3870 .cra_ablkcipher = { 3870 .cra_ablkcipher = {
3871 /* .geniv = "chainiv", */
3872 .min_keysize = AES_MIN_KEY_SIZE, 3871 .min_keysize = AES_MIN_KEY_SIZE,
3873 .max_keysize = AES_MAX_KEY_SIZE, 3872 .max_keysize = AES_MAX_KEY_SIZE,
3874 .ivsize = AES_BLOCK_SIZE, 3873 .ivsize = AES_BLOCK_SIZE,
diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
index eedc33128da4..bcef76508dfa 100644
--- a/drivers/crypto/chelsio/chcr_algo.c
+++ b/drivers/crypto/chelsio/chcr_algo.c
@@ -3816,7 +3816,6 @@ static struct chcr_alg_template driver_algs[] = {
3816 .setkey = chcr_aes_rfc3686_setkey, 3816 .setkey = chcr_aes_rfc3686_setkey,
3817 .encrypt = chcr_aes_encrypt, 3817 .encrypt = chcr_aes_encrypt,
3818 .decrypt = chcr_aes_decrypt, 3818 .decrypt = chcr_aes_decrypt,
3819 .geniv = "seqiv",
3820 } 3819 }
3821 } 3820 }
3822 }, 3821 },
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 27f7dad2d45d..19fba998b86b 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -1194,7 +1194,6 @@ static struct ixp_alg ixp4xx_algos[] = {
1194 .min_keysize = DES_KEY_SIZE, 1194 .min_keysize = DES_KEY_SIZE,
1195 .max_keysize = DES_KEY_SIZE, 1195 .max_keysize = DES_KEY_SIZE,
1196 .ivsize = DES_BLOCK_SIZE, 1196 .ivsize = DES_BLOCK_SIZE,
1197 .geniv = "eseqiv",
1198 } 1197 }
1199 } 1198 }
1200 }, 1199 },
@@ -1221,7 +1220,6 @@ static struct ixp_alg ixp4xx_algos[] = {
1221 .min_keysize = DES3_EDE_KEY_SIZE, 1220 .min_keysize = DES3_EDE_KEY_SIZE,
1222 .max_keysize = DES3_EDE_KEY_SIZE, 1221 .max_keysize = DES3_EDE_KEY_SIZE,
1223 .ivsize = DES3_EDE_BLOCK_SIZE, 1222 .ivsize = DES3_EDE_BLOCK_SIZE,
1224 .geniv = "eseqiv",
1225 } 1223 }
1226 } 1224 }
1227 }, 1225 },
@@ -1247,7 +1245,6 @@ static struct ixp_alg ixp4xx_algos[] = {
1247 .min_keysize = AES_MIN_KEY_SIZE, 1245 .min_keysize = AES_MIN_KEY_SIZE,
1248 .max_keysize = AES_MAX_KEY_SIZE, 1246 .max_keysize = AES_MAX_KEY_SIZE,
1249 .ivsize = AES_BLOCK_SIZE, 1247 .ivsize = AES_BLOCK_SIZE,
1250 .geniv = "eseqiv",
1251 } 1248 }
1252 } 1249 }
1253 }, 1250 },
@@ -1273,7 +1270,6 @@ static struct ixp_alg ixp4xx_algos[] = {
1273 .min_keysize = AES_MIN_KEY_SIZE, 1270 .min_keysize = AES_MIN_KEY_SIZE,
1274 .max_keysize = AES_MAX_KEY_SIZE, 1271 .max_keysize = AES_MAX_KEY_SIZE,
1275 .ivsize = AES_BLOCK_SIZE, 1272 .ivsize = AES_BLOCK_SIZE,
1276 .geniv = "eseqiv",
1277 } 1273 }
1278 } 1274 }
1279 }, 1275 },
@@ -1287,7 +1283,6 @@ static struct ixp_alg ixp4xx_algos[] = {
1287 .min_keysize = AES_MIN_KEY_SIZE, 1283 .min_keysize = AES_MIN_KEY_SIZE,
1288 .max_keysize = AES_MAX_KEY_SIZE, 1284 .max_keysize = AES_MAX_KEY_SIZE,
1289 .ivsize = AES_BLOCK_SIZE, 1285 .ivsize = AES_BLOCK_SIZE,
1290 .geniv = "eseqiv",
1291 .setkey = ablk_rfc3686_setkey, 1286 .setkey = ablk_rfc3686_setkey,
1292 .encrypt = ablk_rfc3686_crypt, 1287 .encrypt = ablk_rfc3686_crypt,
1293 .decrypt = ablk_rfc3686_crypt } 1288 .decrypt = ablk_rfc3686_crypt }
diff --git a/drivers/crypto/nx/nx-aes-ctr.c b/drivers/crypto/nx/nx-aes-ctr.c
index 898c0a280511..5a26fcd75d2d 100644
--- a/drivers/crypto/nx/nx-aes-ctr.c
+++ b/drivers/crypto/nx/nx-aes-ctr.c
@@ -159,7 +159,6 @@ struct crypto_alg nx_ctr3686_aes_alg = {
159 .min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, 159 .min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
160 .max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE, 160 .max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
161 .ivsize = CTR_RFC3686_IV_SIZE, 161 .ivsize = CTR_RFC3686_IV_SIZE,
162 .geniv = "seqiv",
163 .setkey = ctr3686_aes_nx_set_key, 162 .setkey = ctr3686_aes_nx_set_key,
164 .encrypt = ctr3686_aes_nx_crypt, 163 .encrypt = ctr3686_aes_nx_crypt,
165 .decrypt = ctr3686_aes_nx_crypt, 164 .decrypt = ctr3686_aes_nx_crypt,
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index 4c0ea8142923..0120feb2d746 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -749,7 +749,6 @@ static struct crypto_alg algs_ctr[] = {
749 .cra_u.ablkcipher = { 749 .cra_u.ablkcipher = {
750 .min_keysize = AES_MIN_KEY_SIZE, 750 .min_keysize = AES_MIN_KEY_SIZE,
751 .max_keysize = AES_MAX_KEY_SIZE, 751 .max_keysize = AES_MAX_KEY_SIZE,
752 .geniv = "eseqiv",
753 .ivsize = AES_BLOCK_SIZE, 752 .ivsize = AES_BLOCK_SIZE,
754 .setkey = omap_aes_setkey, 753 .setkey = omap_aes_setkey,
755 .encrypt = omap_aes_ctr_encrypt, 754 .encrypt = omap_aes_ctr_encrypt,
diff --git a/drivers/crypto/picoxcell_crypto.c b/drivers/crypto/picoxcell_crypto.c
index a28f1d18fe01..17068b55fea5 100644
--- a/drivers/crypto/picoxcell_crypto.c
+++ b/drivers/crypto/picoxcell_crypto.c
@@ -1585,8 +1585,7 @@ static struct spacc_alg l2_engine_algs[] = {
1585 .cra_name = "f8(kasumi)", 1585 .cra_name = "f8(kasumi)",
1586 .cra_driver_name = "f8-kasumi-picoxcell", 1586 .cra_driver_name = "f8-kasumi-picoxcell",
1587 .cra_priority = SPACC_CRYPTO_ALG_PRIORITY, 1587 .cra_priority = SPACC_CRYPTO_ALG_PRIORITY,
1588 .cra_flags = CRYPTO_ALG_TYPE_GIVCIPHER | 1588 .cra_flags = CRYPTO_ALG_ASYNC |
1589 CRYPTO_ALG_ASYNC |
1590 CRYPTO_ALG_KERN_DRIVER_ONLY, 1589 CRYPTO_ALG_KERN_DRIVER_ONLY,
1591 .cra_blocksize = 8, 1590 .cra_blocksize = 8,
1592 .cra_ctxsize = sizeof(struct spacc_ablk_ctx), 1591 .cra_ctxsize = sizeof(struct spacc_ablk_ctx),
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 6988012deca4..45e20707cef8 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -3155,7 +3155,6 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
3155 alg->cra_ablkcipher.setkey = ablkcipher_setkey; 3155 alg->cra_ablkcipher.setkey = ablkcipher_setkey;
3156 alg->cra_ablkcipher.encrypt = ablkcipher_encrypt; 3156 alg->cra_ablkcipher.encrypt = ablkcipher_encrypt;
3157 alg->cra_ablkcipher.decrypt = ablkcipher_decrypt; 3157 alg->cra_ablkcipher.decrypt = ablkcipher_decrypt;
3158 alg->cra_ablkcipher.geniv = "eseqiv";
3159 break; 3158 break;
3160 case CRYPTO_ALG_TYPE_AEAD: 3159 case CRYPTO_ALG_TYPE_AEAD:
3161 alg = &t_alg->algt.alg.aead.base; 3160 alg = &t_alg->algt.alg.aead.base;
diff --git a/include/crypto/aead.h b/include/crypto/aead.h
index b7b8d24cf765..9ad595f97c65 100644
--- a/include/crypto/aead.h
+++ b/include/crypto/aead.h
@@ -115,7 +115,6 @@ struct aead_request {
115 * @setkey: see struct skcipher_alg 115 * @setkey: see struct skcipher_alg
116 * @encrypt: see struct skcipher_alg 116 * @encrypt: see struct skcipher_alg
117 * @decrypt: see struct skcipher_alg 117 * @decrypt: see struct skcipher_alg
118 * @geniv: see struct skcipher_alg
119 * @ivsize: see struct skcipher_alg 118 * @ivsize: see struct skcipher_alg
120 * @chunksize: see struct skcipher_alg 119 * @chunksize: see struct skcipher_alg
121 * @init: Initialize the cryptographic transformation object. This function 120 * @init: Initialize the cryptographic transformation object. This function
@@ -142,8 +141,6 @@ struct aead_alg {
142 int (*init)(struct crypto_aead *tfm); 141 int (*init)(struct crypto_aead *tfm);
143 void (*exit)(struct crypto_aead *tfm); 142 void (*exit)(struct crypto_aead *tfm);
144 143
145 const char *geniv;
146
147 unsigned int ivsize; 144 unsigned int ivsize;
148 unsigned int maxauthsize; 145 unsigned int maxauthsize;
149 unsigned int chunksize; 146 unsigned int chunksize;
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h
index e42f7063f245..453e867b4bd9 100644
--- a/include/crypto/internal/skcipher.h
+++ b/include/crypto/internal/skcipher.h
@@ -70,8 +70,6 @@ struct skcipher_walk {
70 unsigned int alignmask; 70 unsigned int alignmask;
71}; 71};
72 72
73extern const struct crypto_type crypto_givcipher_type;
74
75static inline struct crypto_instance *skcipher_crypto_instance( 73static inline struct crypto_instance *skcipher_crypto_instance(
76 struct skcipher_instance *inst) 74 struct skcipher_instance *inst)
77{ 75{
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h
index 480f8301a47d..e555294ed77f 100644
--- a/include/crypto/skcipher.h
+++ b/include/crypto/skcipher.h
@@ -39,19 +39,6 @@ struct skcipher_request {
39 void *__ctx[] CRYPTO_MINALIGN_ATTR; 39 void *__ctx[] CRYPTO_MINALIGN_ATTR;
40}; 40};
41 41
42/**
43 * struct skcipher_givcrypt_request - Crypto request with IV generation
44 * @seq: Sequence number for IV generation
45 * @giv: Space for generated IV
46 * @creq: The crypto request itself
47 */
48struct skcipher_givcrypt_request {
49 u64 seq;
50 u8 *giv;
51
52 struct ablkcipher_request creq;
53};
54
55struct crypto_skcipher { 42struct crypto_skcipher {
56 int (*setkey)(struct crypto_skcipher *tfm, const u8 *key, 43 int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
57 unsigned int keylen); 44 unsigned int keylen);
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index 81e178fb9ed8..902ec171fc6d 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -49,7 +49,6 @@
49#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004 49#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
50#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005 50#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
51#define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005 51#define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005
52#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
53#define CRYPTO_ALG_TYPE_KPP 0x00000008 52#define CRYPTO_ALG_TYPE_KPP 0x00000008
54#define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a 53#define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a
55#define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b 54#define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b
@@ -77,12 +76,6 @@
77#define CRYPTO_ALG_NEED_FALLBACK 0x00000100 76#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
78 77
79/* 78/*
80 * This bit is set for symmetric key ciphers that have already been wrapped
81 * with a generic IV generator to prevent them from being wrapped again.
82 */
83#define CRYPTO_ALG_GENIV 0x00000200
84
85/*
86 * Set if the algorithm has passed automated run-time testing. Note that 79 * Set if the algorithm has passed automated run-time testing. Note that
87 * if there is no run-time testing for a given algorithm it is considered 80 * if there is no run-time testing for a given algorithm it is considered
88 * to have passed. 81 * to have passed.
@@ -157,7 +150,6 @@ struct crypto_async_request;
157struct crypto_blkcipher; 150struct crypto_blkcipher;
158struct crypto_tfm; 151struct crypto_tfm;
159struct crypto_type; 152struct crypto_type;
160struct skcipher_givcrypt_request;
161 153
162typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); 154typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
163 155
@@ -246,31 +238,16 @@ struct cipher_desc {
246 * be called in parallel with the same transformation object. 238 * be called in parallel with the same transformation object.
247 * @decrypt: Decrypt a single block. This is a reverse counterpart to @encrypt 239 * @decrypt: Decrypt a single block. This is a reverse counterpart to @encrypt
248 * and the conditions are exactly the same. 240 * and the conditions are exactly the same.
249 * @givencrypt: Update the IV for encryption. With this function, a cipher
250 * implementation may provide the function on how to update the IV
251 * for encryption.
252 * @givdecrypt: Update the IV for decryption. This is the reverse of
253 * @givencrypt .
254 * @geniv: The transformation implementation may use an "IV generator" provided
255 * by the kernel crypto API. Several use cases have a predefined
256 * approach how IVs are to be updated. For such use cases, the kernel
257 * crypto API provides ready-to-use implementations that can be
258 * referenced with this variable.
259 * @ivsize: IV size applicable for transformation. The consumer must provide an 241 * @ivsize: IV size applicable for transformation. The consumer must provide an
260 * IV of exactly that size to perform the encrypt or decrypt operation. 242 * IV of exactly that size to perform the encrypt or decrypt operation.
261 * 243 *
262 * All fields except @givencrypt , @givdecrypt , @geniv and @ivsize are 244 * All fields except @ivsize are mandatory and must be filled.
263 * mandatory and must be filled.
264 */ 245 */
265struct ablkcipher_alg { 246struct ablkcipher_alg {
266 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key, 247 int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
267 unsigned int keylen); 248 unsigned int keylen);
268 int (*encrypt)(struct ablkcipher_request *req); 249 int (*encrypt)(struct ablkcipher_request *req);
269 int (*decrypt)(struct ablkcipher_request *req); 250 int (*decrypt)(struct ablkcipher_request *req);
270 int (*givencrypt)(struct skcipher_givcrypt_request *req);
271 int (*givdecrypt)(struct skcipher_givcrypt_request *req);
272
273 const char *geniv;
274 251
275 unsigned int min_keysize; 252 unsigned int min_keysize;
276 unsigned int max_keysize; 253 unsigned int max_keysize;
@@ -284,10 +261,9 @@ struct ablkcipher_alg {
284 * @setkey: see struct ablkcipher_alg 261 * @setkey: see struct ablkcipher_alg
285 * @encrypt: see struct ablkcipher_alg 262 * @encrypt: see struct ablkcipher_alg
286 * @decrypt: see struct ablkcipher_alg 263 * @decrypt: see struct ablkcipher_alg
287 * @geniv: see struct ablkcipher_alg
288 * @ivsize: see struct ablkcipher_alg 264 * @ivsize: see struct ablkcipher_alg
289 * 265 *
290 * All fields except @geniv and @ivsize are mandatory and must be filled. 266 * All fields except @ivsize are mandatory and must be filled.
291 */ 267 */
292struct blkcipher_alg { 268struct blkcipher_alg {
293 int (*setkey)(struct crypto_tfm *tfm, const u8 *key, 269 int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
@@ -299,8 +275,6 @@ struct blkcipher_alg {
299 struct scatterlist *dst, struct scatterlist *src, 275 struct scatterlist *dst, struct scatterlist *src,
300 unsigned int nbytes); 276 unsigned int nbytes);
301 277
302 const char *geniv;
303
304 unsigned int min_keysize; 278 unsigned int min_keysize;
305 unsigned int max_keysize; 279 unsigned int max_keysize;
306 unsigned int ivsize; 280 unsigned int ivsize;
@@ -931,14 +905,14 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
931 905
932static inline u32 crypto_skcipher_type(u32 type) 906static inline u32 crypto_skcipher_type(u32 type)
933{ 907{
934 type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); 908 type &= ~CRYPTO_ALG_TYPE_MASK;
935 type |= CRYPTO_ALG_TYPE_BLKCIPHER; 909 type |= CRYPTO_ALG_TYPE_BLKCIPHER;
936 return type; 910 return type;
937} 911}
938 912
939static inline u32 crypto_skcipher_mask(u32 mask) 913static inline u32 crypto_skcipher_mask(u32 mask)
940{ 914{
941 mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); 915 mask &= ~CRYPTO_ALG_TYPE_MASK;
942 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK; 916 mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
943 return mask; 917 return mask;
944} 918}