mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
crypto: stm32 - remove unnecessary alignmask for ahashes
The crypto API's support for alignmasks for ahash algorithms is nearly useless, as its only effect is to cause the API to align the key and result buffers. The drivers that happen to be specifying an alignmask for ahash rarely actually need it. When they do, it's easily fixable, especially considering that these buffers cannot be used for DMA. In preparation for removing alignmask support from ahash, this patch makes the stm32 driver no longer use it. This driver didn't actually rely on it; it only writes to the result buffer in stm32_hash_finish(), simply using memcpy(). And stm32_hash_setkey() does not assume any alignment for the key buffer. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
8c87553e2d
commit
54eea8e290
@ -1283,7 +1283,6 @@ static struct ahash_engine_alg algs_md5[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = MD5_HMAC_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1313,7 +1312,6 @@ static struct ahash_engine_alg algs_md5[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = MD5_HMAC_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1345,7 +1343,6 @@ static struct ahash_engine_alg algs_sha1[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA1_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1375,7 +1372,6 @@ static struct ahash_engine_alg algs_sha1[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA1_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1407,7 +1403,6 @@ static struct ahash_engine_alg algs_sha224[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1437,7 +1432,6 @@ static struct ahash_engine_alg algs_sha224[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1469,7 +1463,6 @@ static struct ahash_engine_alg algs_sha256[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1499,7 +1492,6 @@ static struct ahash_engine_alg algs_sha256[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1531,7 +1523,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1561,7 +1552,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1590,7 +1580,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1620,7 +1609,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1652,7 +1640,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1682,7 +1669,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_224_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1711,7 +1697,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1741,7 +1726,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_256_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1770,7 +1754,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1800,7 +1783,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_384_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1829,7 +1811,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
@ -1859,7 +1840,6 @@ static struct ahash_engine_alg algs_sha3[] = {
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = SHA3_512_BLOCK_SIZE,
|
||||
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
|
||||
.cra_alignmask = 3,
|
||||
.cra_init = stm32_hash_cra_sha3_hmac_init,
|
||||
.cra_exit = stm32_hash_cra_exit,
|
||||
.cra_module = THIS_MODULE,
|
||||
|
Loading…
Reference in New Issue
Block a user