135
135
#define regk_crypto_ext 0x00000001
136
136
#define regk_crypto_hmac_sha1 0x00000007
137
137
#define regk_crypto_hmac_sha256 0x00000009
138
- #define regk_crypto_hmac_sha384 0x0000000b
139
138
#define regk_crypto_hmac_sha512 0x0000000d
140
139
#define regk_crypto_init 0x00000000
141
140
#define regk_crypto_key_128 0x00000000
144
143
#define regk_crypto_null 0x00000000
145
144
#define regk_crypto_sha1 0x00000006
146
145
#define regk_crypto_sha256 0x00000008
147
- #define regk_crypto_sha384 0x0000000a
148
146
#define regk_crypto_sha512 0x0000000c
149
147
150
148
/* DMA descriptor structures */
@@ -190,7 +188,6 @@ struct pdma_stat_descr {
190
188
/* Hash modes (including HMAC variants) */
191
189
#define ARTPEC6_CRYPTO_HASH_SHA1 1
192
190
#define ARTPEC6_CRYPTO_HASH_SHA256 2
193
- #define ARTPEC6_CRYPTO_HASH_SHA384 3
194
191
#define ARTPEC6_CRYPTO_HASH_SHA512 4
195
192
196
193
/* Crypto modes */
@@ -1315,8 +1312,7 @@ static int artpec6_crypto_prepare_hash(struct ahash_request *areq)
1315
1312
struct artpec6_hashalg_context * ctx = crypto_tfm_ctx (areq -> base .tfm );
1316
1313
struct artpec6_hash_request_context * req_ctx = ahash_request_ctx (areq );
1317
1314
size_t digestsize = crypto_ahash_digestsize (crypto_ahash_reqtfm (areq ));
1318
- size_t contextsize = digestsize == SHA384_DIGEST_SIZE ?
1319
- SHA512_DIGEST_SIZE : digestsize ;
1315
+ size_t contextsize = digestsize ;
1320
1316
size_t blocksize = crypto_tfm_alg_blocksize (
1321
1317
crypto_ahash_tfm (crypto_ahash_reqtfm (areq )));
1322
1318
struct artpec6_crypto_req_common * common = & req_ctx -> common ;
@@ -1456,7 +1452,6 @@ static int artpec6_crypto_prepare_hash(struct ahash_request *areq)
1456
1452
1457
1453
/* Finalize */
1458
1454
if (req_ctx -> hash_flags & HASH_FLAG_FINALIZE ) {
1459
- bool needtrim = contextsize != digestsize ;
1460
1455
size_t hash_pad_len ;
1461
1456
u64 digest_bits ;
1462
1457
u32 oper ;
@@ -1502,19 +1497,10 @@ static int artpec6_crypto_prepare_hash(struct ahash_request *areq)
1502
1497
/* Descriptor for the final result */
1503
1498
error = artpec6_crypto_setup_in_descr (common , areq -> result ,
1504
1499
digestsize ,
1505
- ! needtrim );
1500
+ true );
1506
1501
if (error )
1507
1502
return error ;
1508
1503
1509
- if (needtrim ) {
1510
- /* Discard the extra context bytes for SHA-384 */
1511
- error = artpec6_crypto_setup_in_descr (common ,
1512
- req_ctx -> partial_buffer ,
1513
- digestsize - contextsize , true);
1514
- if (error )
1515
- return error ;
1516
- }
1517
-
1518
1504
} else { /* This is not the final operation for this request */
1519
1505
if (!run_hw )
1520
1506
return ARTPEC6_CRYPTO_PREPARE_HASH_NO_START ;
@@ -2266,9 +2252,6 @@ artpec6_crypto_init_hash(struct ahash_request *req, u8 type, int hmac)
2266
2252
case ARTPEC6_CRYPTO_HASH_SHA256 :
2267
2253
oper = hmac ? regk_crypto_hmac_sha256 : regk_crypto_sha256 ;
2268
2254
break ;
2269
- case ARTPEC6_CRYPTO_HASH_SHA384 :
2270
- oper = hmac ? regk_crypto_hmac_sha384 : regk_crypto_sha384 ;
2271
- break ;
2272
2255
case ARTPEC6_CRYPTO_HASH_SHA512 :
2273
2256
oper = hmac ? regk_crypto_hmac_sha512 : regk_crypto_sha512 ;
2274
2257
break ;
@@ -2368,22 +2351,6 @@ static int artpec6_crypto_sha256_digest(struct ahash_request *req)
2368
2351
return artpec6_crypto_prepare_submit_hash (req );
2369
2352
}
2370
2353
2371
- static int __maybe_unused artpec6_crypto_sha384_init (struct ahash_request * req )
2372
- {
2373
- return artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA384 , 0 );
2374
- }
2375
-
2376
- static int __maybe_unused
2377
- artpec6_crypto_sha384_digest (struct ahash_request * req )
2378
- {
2379
- struct artpec6_hash_request_context * req_ctx = ahash_request_ctx (req );
2380
-
2381
- artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA384 , 0 );
2382
- req_ctx -> hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE ;
2383
-
2384
- return artpec6_crypto_prepare_submit_hash (req );
2385
- }
2386
-
2387
2354
static int artpec6_crypto_sha512_init (struct ahash_request * req )
2388
2355
{
2389
2356
return artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA512 , 0 );
@@ -2404,12 +2371,6 @@ static int artpec6_crypto_hmac_sha256_init(struct ahash_request *req)
2404
2371
return artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA256 , 1 );
2405
2372
}
2406
2373
2407
- static int __maybe_unused
2408
- artpec6_crypto_hmac_sha384_init (struct ahash_request * req )
2409
- {
2410
- return artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA384 , 1 );
2411
- }
2412
-
2413
2374
static int artpec6_crypto_hmac_sha512_init (struct ahash_request * req )
2414
2375
{
2415
2376
return artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA512 , 1 );
@@ -2425,17 +2386,6 @@ static int artpec6_crypto_hmac_sha256_digest(struct ahash_request *req)
2425
2386
return artpec6_crypto_prepare_submit_hash (req );
2426
2387
}
2427
2388
2428
- static int __maybe_unused
2429
- artpec6_crypto_hmac_sha384_digest (struct ahash_request * req )
2430
- {
2431
- struct artpec6_hash_request_context * req_ctx = ahash_request_ctx (req );
2432
-
2433
- artpec6_crypto_init_hash (req , ARTPEC6_CRYPTO_HASH_SHA384 , 1 );
2434
- req_ctx -> hash_flags |= HASH_FLAG_UPDATE | HASH_FLAG_FINALIZE ;
2435
-
2436
- return artpec6_crypto_prepare_submit_hash (req );
2437
- }
2438
-
2439
2389
static int artpec6_crypto_hmac_sha512_digest (struct ahash_request * req )
2440
2390
{
2441
2391
struct artpec6_hash_request_context * req_ctx = ahash_request_ctx (req );
@@ -2480,12 +2430,6 @@ static int artpec6_crypto_ahash_init_hmac_sha256(struct crypto_tfm *tfm)
2480
2430
return artpec6_crypto_ahash_init_common (tfm , "sha256" );
2481
2431
}
2482
2432
2483
- static int __maybe_unused
2484
- artpec6_crypto_ahash_init_hmac_sha384 (struct crypto_tfm * tfm )
2485
- {
2486
- return artpec6_crypto_ahash_init_common (tfm , "sha384" );
2487
- }
2488
-
2489
2433
static int artpec6_crypto_ahash_init_hmac_sha512 (struct crypto_tfm * tfm )
2490
2434
{
2491
2435
return artpec6_crypto_ahash_init_common (tfm , "sha512" );
@@ -2762,53 +2706,6 @@ static struct ahash_alg hash_algos[] = {
2762
2706
};
2763
2707
2764
2708
static struct ahash_alg artpec7_hash_algos [] = {
2765
- /* SHA-384 */
2766
- {
2767
- .init = artpec6_crypto_sha384_init ,
2768
- .update = artpec6_crypto_hash_update ,
2769
- .final = artpec6_crypto_hash_final ,
2770
- .digest = artpec6_crypto_sha384_digest ,
2771
- .import = artpec6_crypto_hash_import ,
2772
- .export = artpec6_crypto_hash_export ,
2773
- .halg .digestsize = SHA384_DIGEST_SIZE ,
2774
- .halg .statesize = sizeof (struct artpec6_hash_export_state ),
2775
- .halg .base = {
2776
- .cra_name = "sha384" ,
2777
- .cra_driver_name = "artpec-sha384" ,
2778
- .cra_priority = 300 ,
2779
- .cra_flags = CRYPTO_ALG_ASYNC ,
2780
- .cra_blocksize = SHA384_BLOCK_SIZE ,
2781
- .cra_ctxsize = sizeof (struct artpec6_hashalg_context ),
2782
- .cra_alignmask = 3 ,
2783
- .cra_module = THIS_MODULE ,
2784
- .cra_init = artpec6_crypto_ahash_init ,
2785
- .cra_exit = artpec6_crypto_ahash_exit ,
2786
- }
2787
- },
2788
- /* HMAC SHA-384 */
2789
- {
2790
- .init = artpec6_crypto_hmac_sha384_init ,
2791
- .update = artpec6_crypto_hash_update ,
2792
- .final = artpec6_crypto_hash_final ,
2793
- .digest = artpec6_crypto_hmac_sha384_digest ,
2794
- .import = artpec6_crypto_hash_import ,
2795
- .export = artpec6_crypto_hash_export ,
2796
- .setkey = artpec6_crypto_hash_set_key ,
2797
- .halg .digestsize = SHA384_DIGEST_SIZE ,
2798
- .halg .statesize = sizeof (struct artpec6_hash_export_state ),
2799
- .halg .base = {
2800
- .cra_name = "hmac(sha384)" ,
2801
- .cra_driver_name = "artpec-hmac-sha384" ,
2802
- .cra_priority = 300 ,
2803
- .cra_flags = CRYPTO_ALG_ASYNC ,
2804
- .cra_blocksize = SHA384_BLOCK_SIZE ,
2805
- .cra_ctxsize = sizeof (struct artpec6_hashalg_context ),
2806
- .cra_alignmask = 3 ,
2807
- .cra_module = THIS_MODULE ,
2808
- .cra_init = artpec6_crypto_ahash_init_hmac_sha384 ,
2809
- .cra_exit = artpec6_crypto_ahash_exit ,
2810
- }
2811
- },
2812
2709
/* SHA-512 */
2813
2710
{
2814
2711
.init = artpec6_crypto_sha512_init ,
0 commit comments