Commit 0a137674 authored by Herbert Xu's avatar Herbert Xu
Browse files

crypto: cbcmac - Set block size properly



The block size of a hash algorithm is meant to be the number of
bytes its block function can handle.  For cbcmac that should be
the block size of the underlying block cipher instead of one.

Set the block size of all cbcmac implementations accordingly.

Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent e13b67e9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1009,7 +1009,7 @@ static struct shash_alg mac_algs[] = { {
	.base.cra_name		= "cbcmac(aes)",
	.base.cra_driver_name	= "cbcmac-aes-" MODE,
	.base.cra_priority	= PRIO,
	.base.cra_blocksize	= 1,
	.base.cra_blocksize	= AES_BLOCK_SIZE,
	.base.cra_ctxsize	= sizeof(struct mac_tfm_ctx),
	.base.cra_module	= THIS_MODULE,

+1 −1
Original line number Diff line number Diff line
@@ -723,7 +723,7 @@ static struct shash_alg sm4_mac_algs[] = {
			.cra_name		= "cbcmac(sm4)",
			.cra_driver_name	= "cbcmac-sm4-ce",
			.cra_priority		= 400,
			.cra_blocksize		= 1,
			.cra_blocksize		= SM4_BLOCK_SIZE,
			.cra_ctxsize		= sizeof(struct sm4_mac_tfm_ctx),
			.cra_module		= THIS_MODULE,
		},
+1 −1
Original line number Diff line number Diff line
@@ -883,7 +883,7 @@ static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb)
		goto err_free_inst;

	inst->alg.base.cra_priority = alg->cra_priority;
	inst->alg.base.cra_blocksize = 1;
	inst->alg.base.cra_blocksize = alg->cra_blocksize;

	inst->alg.digestsize = alg->cra_blocksize;
	inst->alg.descsize = sizeof(struct cbcmac_desc_ctx) +
+1 −1
Original line number Diff line number Diff line
@@ -2043,7 +2043,7 @@ struct safexcel_alg_template safexcel_alg_cbcmac = {
				.cra_flags = CRYPTO_ALG_ASYNC |
					     CRYPTO_ALG_ALLOCATES_MEMORY |
					     CRYPTO_ALG_KERN_DRIVER_ONLY,
				.cra_blocksize = 1,
				.cra_blocksize = AES_BLOCK_SIZE,
				.cra_ctxsize = sizeof(struct safexcel_ahash_ctx),
				.cra_init = safexcel_ahash_cra_init,
				.cra_exit = safexcel_ahash_cra_exit,