crypto: ccp - fix AES CFB error exposed by new test vectors
Updated testmgr will exhibit this error message when loading the
ccp-crypto module:
alg: skcipher: cfb-aes-ccp encryption failed with err -22 on test vector 3, cfg="in-place"
Update the CCP crypto driver to correctly treat CFB as a streaming mode
cipher (instead of block mode). Update the configuration for CFB to
specify the block size as a single byte;
Fixes: 2b789435d7
('crypto: ccp - CCP AES crypto API support')
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0
|
||||||
/*
|
/*
|
||||||
* AMD Cryptographic Coprocessor (CCP) AES crypto API support
|
* AMD Cryptographic Coprocessor (CCP) AES crypto API support
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013,2016 Advanced Micro Devices, Inc.
|
* Copyright (C) 2013-2019 Advanced Micro Devices, Inc.
|
||||||
*
|
*
|
||||||
* Author: Tom Lendacky <thomas.lendacky@amd.com>
|
* Author: Tom Lendacky <thomas.lendacky@amd.com>
|
||||||
*
|
*
|
||||||
@@ -79,8 +80,7 @@ static int ccp_aes_crypt(struct ablkcipher_request *req, bool encrypt)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) ||
|
if (((ctx->u.aes.mode == CCP_AES_MODE_ECB) ||
|
||||||
(ctx->u.aes.mode == CCP_AES_MODE_CBC) ||
|
(ctx->u.aes.mode == CCP_AES_MODE_CBC)) &&
|
||||||
(ctx->u.aes.mode == CCP_AES_MODE_CFB)) &&
|
|
||||||
(req->nbytes & (AES_BLOCK_SIZE - 1)))
|
(req->nbytes & (AES_BLOCK_SIZE - 1)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ static struct ccp_aes_def aes_algs[] = {
|
|||||||
.version = CCP_VERSION(3, 0),
|
.version = CCP_VERSION(3, 0),
|
||||||
.name = "cfb(aes)",
|
.name = "cfb(aes)",
|
||||||
.driver_name = "cfb-aes-ccp",
|
.driver_name = "cfb-aes-ccp",
|
||||||
.blocksize = AES_BLOCK_SIZE,
|
.blocksize = 1,
|
||||||
.ivsize = AES_BLOCK_SIZE,
|
.ivsize = AES_BLOCK_SIZE,
|
||||||
.alg_defaults = &ccp_aes_defaults,
|
.alg_defaults = &ccp_aes_defaults,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user