Source
361
361
}
362
362
363
363
#ifdef CONFIG_NET
364
364
static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
365
365
{
366
366
struct crypto_report_blkcipher rblkcipher;
367
367
368
368
memset(&rblkcipher, 0, sizeof(rblkcipher));
369
369
370
370
strscpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
371
-
strscpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>",
372
-
sizeof(rblkcipher.geniv));
371
+
strscpy(rblkcipher.geniv, "<default>", sizeof(rblkcipher.geniv));
373
372
374
373
rblkcipher.blocksize = alg->cra_blocksize;
375
374
rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
376
375
rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;
377
376
rblkcipher.ivsize = alg->cra_ablkcipher.ivsize;
378
377
379
378
return nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,
380
379
sizeof(rblkcipher), &rblkcipher);
381
380
}
382
381
#else
392
391
{
393
392
struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher;
394
393
395
394
seq_printf(m, "type : ablkcipher\n");
396
395
seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
397
396
"yes" : "no");
398
397
seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
399
398
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
400
399
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
401
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
405
404
const struct crypto_type crypto_ablkcipher_type = {
406
405
.ctxsize = crypto_ablkcipher_ctxsize,
407
406
.init = crypto_init_ablkcipher_ops,
408
407
#ifdef CONFIG_PROC_FS
409
408
.show = crypto_ablkcipher_show,
410
409
#endif
411
410
.report = crypto_ablkcipher_report,
412
411
};
413
412
EXPORT_SYMBOL_GPL(crypto_ablkcipher_type);
414
-
415
-
static 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
435
-
static 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
454
-
static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
455
-
{
456
-
return -ENOSYS;
457
-
}
458
-
#endif
459
-
460
-
static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
461
-
__maybe_unused;
462
-
static 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
-
476
-
const 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
-
};
484
-
EXPORT_SYMBOL_GPL(crypto_givcipher_type);