Skip to content

Commit 54eea8e

Browse files
ebiggersherbertx
authored andcommitted
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 8c87553 commit 54eea8e

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

drivers/crypto/stm32/stm32-hash.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ static struct ahash_engine_alg algs_md5[] = {
12831283
CRYPTO_ALG_KERN_DRIVER_ONLY,
12841284
.cra_blocksize = MD5_HMAC_BLOCK_SIZE,
12851285
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1286-
.cra_alignmask = 3,
12871286
.cra_init = stm32_hash_cra_init,
12881287
.cra_exit = stm32_hash_cra_exit,
12891288
.cra_module = THIS_MODULE,
@@ -1313,7 +1312,6 @@ static struct ahash_engine_alg algs_md5[] = {
13131312
CRYPTO_ALG_KERN_DRIVER_ONLY,
13141313
.cra_blocksize = MD5_HMAC_BLOCK_SIZE,
13151314
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1316-
.cra_alignmask = 3,
13171315
.cra_init = stm32_hash_cra_hmac_init,
13181316
.cra_exit = stm32_hash_cra_exit,
13191317
.cra_module = THIS_MODULE,
@@ -1345,7 +1343,6 @@ static struct ahash_engine_alg algs_sha1[] = {
13451343
CRYPTO_ALG_KERN_DRIVER_ONLY,
13461344
.cra_blocksize = SHA1_BLOCK_SIZE,
13471345
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1348-
.cra_alignmask = 3,
13491346
.cra_init = stm32_hash_cra_init,
13501347
.cra_exit = stm32_hash_cra_exit,
13511348
.cra_module = THIS_MODULE,
@@ -1375,7 +1372,6 @@ static struct ahash_engine_alg algs_sha1[] = {
13751372
CRYPTO_ALG_KERN_DRIVER_ONLY,
13761373
.cra_blocksize = SHA1_BLOCK_SIZE,
13771374
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1378-
.cra_alignmask = 3,
13791375
.cra_init = stm32_hash_cra_hmac_init,
13801376
.cra_exit = stm32_hash_cra_exit,
13811377
.cra_module = THIS_MODULE,
@@ -1407,7 +1403,6 @@ static struct ahash_engine_alg algs_sha224[] = {
14071403
CRYPTO_ALG_KERN_DRIVER_ONLY,
14081404
.cra_blocksize = SHA224_BLOCK_SIZE,
14091405
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1410-
.cra_alignmask = 3,
14111406
.cra_init = stm32_hash_cra_init,
14121407
.cra_exit = stm32_hash_cra_exit,
14131408
.cra_module = THIS_MODULE,
@@ -1437,7 +1432,6 @@ static struct ahash_engine_alg algs_sha224[] = {
14371432
CRYPTO_ALG_KERN_DRIVER_ONLY,
14381433
.cra_blocksize = SHA224_BLOCK_SIZE,
14391434
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1440-
.cra_alignmask = 3,
14411435
.cra_init = stm32_hash_cra_hmac_init,
14421436
.cra_exit = stm32_hash_cra_exit,
14431437
.cra_module = THIS_MODULE,
@@ -1469,7 +1463,6 @@ static struct ahash_engine_alg algs_sha256[] = {
14691463
CRYPTO_ALG_KERN_DRIVER_ONLY,
14701464
.cra_blocksize = SHA256_BLOCK_SIZE,
14711465
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1472-
.cra_alignmask = 3,
14731466
.cra_init = stm32_hash_cra_init,
14741467
.cra_exit = stm32_hash_cra_exit,
14751468
.cra_module = THIS_MODULE,
@@ -1499,7 +1492,6 @@ static struct ahash_engine_alg algs_sha256[] = {
14991492
CRYPTO_ALG_KERN_DRIVER_ONLY,
15001493
.cra_blocksize = SHA256_BLOCK_SIZE,
15011494
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1502-
.cra_alignmask = 3,
15031495
.cra_init = stm32_hash_cra_hmac_init,
15041496
.cra_exit = stm32_hash_cra_exit,
15051497
.cra_module = THIS_MODULE,
@@ -1531,7 +1523,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
15311523
CRYPTO_ALG_KERN_DRIVER_ONLY,
15321524
.cra_blocksize = SHA384_BLOCK_SIZE,
15331525
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1534-
.cra_alignmask = 3,
15351526
.cra_init = stm32_hash_cra_init,
15361527
.cra_exit = stm32_hash_cra_exit,
15371528
.cra_module = THIS_MODULE,
@@ -1561,7 +1552,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
15611552
CRYPTO_ALG_KERN_DRIVER_ONLY,
15621553
.cra_blocksize = SHA384_BLOCK_SIZE,
15631554
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1564-
.cra_alignmask = 3,
15651555
.cra_init = stm32_hash_cra_hmac_init,
15661556
.cra_exit = stm32_hash_cra_exit,
15671557
.cra_module = THIS_MODULE,
@@ -1590,7 +1580,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
15901580
CRYPTO_ALG_KERN_DRIVER_ONLY,
15911581
.cra_blocksize = SHA512_BLOCK_SIZE,
15921582
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1593-
.cra_alignmask = 3,
15941583
.cra_init = stm32_hash_cra_init,
15951584
.cra_exit = stm32_hash_cra_exit,
15961585
.cra_module = THIS_MODULE,
@@ -1620,7 +1609,6 @@ static struct ahash_engine_alg algs_sha384_sha512[] = {
16201609
CRYPTO_ALG_KERN_DRIVER_ONLY,
16211610
.cra_blocksize = SHA512_BLOCK_SIZE,
16221611
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1623-
.cra_alignmask = 3,
16241612
.cra_init = stm32_hash_cra_hmac_init,
16251613
.cra_exit = stm32_hash_cra_exit,
16261614
.cra_module = THIS_MODULE,
@@ -1652,7 +1640,6 @@ static struct ahash_engine_alg algs_sha3[] = {
16521640
CRYPTO_ALG_KERN_DRIVER_ONLY,
16531641
.cra_blocksize = SHA3_224_BLOCK_SIZE,
16541642
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1655-
.cra_alignmask = 3,
16561643
.cra_init = stm32_hash_cra_sha3_init,
16571644
.cra_exit = stm32_hash_cra_exit,
16581645
.cra_module = THIS_MODULE,
@@ -1682,7 +1669,6 @@ static struct ahash_engine_alg algs_sha3[] = {
16821669
CRYPTO_ALG_KERN_DRIVER_ONLY,
16831670
.cra_blocksize = SHA3_224_BLOCK_SIZE,
16841671
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1685-
.cra_alignmask = 3,
16861672
.cra_init = stm32_hash_cra_sha3_hmac_init,
16871673
.cra_exit = stm32_hash_cra_exit,
16881674
.cra_module = THIS_MODULE,
@@ -1711,7 +1697,6 @@ static struct ahash_engine_alg algs_sha3[] = {
17111697
CRYPTO_ALG_KERN_DRIVER_ONLY,
17121698
.cra_blocksize = SHA3_256_BLOCK_SIZE,
17131699
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1714-
.cra_alignmask = 3,
17151700
.cra_init = stm32_hash_cra_sha3_init,
17161701
.cra_exit = stm32_hash_cra_exit,
17171702
.cra_module = THIS_MODULE,
@@ -1741,7 +1726,6 @@ static struct ahash_engine_alg algs_sha3[] = {
17411726
CRYPTO_ALG_KERN_DRIVER_ONLY,
17421727
.cra_blocksize = SHA3_256_BLOCK_SIZE,
17431728
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1744-
.cra_alignmask = 3,
17451729
.cra_init = stm32_hash_cra_sha3_hmac_init,
17461730
.cra_exit = stm32_hash_cra_exit,
17471731
.cra_module = THIS_MODULE,
@@ -1770,7 +1754,6 @@ static struct ahash_engine_alg algs_sha3[] = {
17701754
CRYPTO_ALG_KERN_DRIVER_ONLY,
17711755
.cra_blocksize = SHA3_384_BLOCK_SIZE,
17721756
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1773-
.cra_alignmask = 3,
17741757
.cra_init = stm32_hash_cra_sha3_init,
17751758
.cra_exit = stm32_hash_cra_exit,
17761759
.cra_module = THIS_MODULE,
@@ -1800,7 +1783,6 @@ static struct ahash_engine_alg algs_sha3[] = {
18001783
CRYPTO_ALG_KERN_DRIVER_ONLY,
18011784
.cra_blocksize = SHA3_384_BLOCK_SIZE,
18021785
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1803-
.cra_alignmask = 3,
18041786
.cra_init = stm32_hash_cra_sha3_hmac_init,
18051787
.cra_exit = stm32_hash_cra_exit,
18061788
.cra_module = THIS_MODULE,
@@ -1829,7 +1811,6 @@ static struct ahash_engine_alg algs_sha3[] = {
18291811
CRYPTO_ALG_KERN_DRIVER_ONLY,
18301812
.cra_blocksize = SHA3_512_BLOCK_SIZE,
18311813
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1832-
.cra_alignmask = 3,
18331814
.cra_init = stm32_hash_cra_sha3_init,
18341815
.cra_exit = stm32_hash_cra_exit,
18351816
.cra_module = THIS_MODULE,
@@ -1859,7 +1840,6 @@ static struct ahash_engine_alg algs_sha3[] = {
18591840
CRYPTO_ALG_KERN_DRIVER_ONLY,
18601841
.cra_blocksize = SHA3_512_BLOCK_SIZE,
18611842
.cra_ctxsize = sizeof(struct stm32_hash_ctx),
1862-
.cra_alignmask = 3,
18631843
.cra_init = stm32_hash_cra_sha3_hmac_init,
18641844
.cra_exit = stm32_hash_cra_exit,
18651845
.cra_module = THIS_MODULE,

0 commit comments

Comments
 (0)