hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/crypto/bcm/spu.c
....@@ -1,17 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright 2016 Broadcom
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License, version 2, as
6
- * published by the Free Software Foundation (the "GPL").
7
- *
8
- * This program is distributed in the hope that it will be useful, but
9
- * WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
- * General Public License version 2 (GPLv2) for more details.
12
- *
13
- * You should have received a copy of the GNU General Public License
14
- * version 2 (GPLv2) along with this source code.
154 */
165
176 #include <linux/kernel.h>
....@@ -21,9 +10,6 @@
2110 #include "spu.h"
2211 #include "spum.h"
2312 #include "cipher.h"
24
-
25
-/* This array is based on the hash algo type supported in spu.h */
26
-char *tag_to_hash_idx[] = { "none", "md5", "sha1", "sha224", "sha256" };
2713
2814 char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes",
2915 "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" };
....@@ -235,10 +221,6 @@
235221 case CIPHER_ALG_3DES:
236222 cipher_key_len = 24;
237223 name = "3DES";
238
- break;
239
- case CIPHER_ALG_RC4:
240
- cipher_key_len = 260;
241
- name = "ARC4";
242224 break;
243225 case CIPHER_ALG_AES:
244226 switch (cipher_type) {
....@@ -933,21 +915,16 @@
933915 * @spu_req_hdr_len: Length in bytes of the SPU request header
934916 * @isInbound: 0 encrypt, 1 decrypt
935917 * @cipher_parms: Parameters describing cipher operation to be performed
936
- * @update_key: If true, rewrite the cipher key in SCTX
937918 * @data_size: Length of the data in the BD field
938919 *
939920 * Assumes much of the header was already filled in at setkey() time in
940921 * spum_cipher_req_init().
941
- * spum_cipher_req_init() fills in the encryption key. For RC4, when submitting
942
- * a request for a non-first chunk, we use the 260-byte SUPDT field from the
943
- * previous response as the key. update_key is true for this case. Unused in all
944
- * other cases.
922
+ * spum_cipher_req_init() fills in the encryption key.
945923 */
946924 void spum_cipher_req_finish(u8 *spu_hdr,
947925 u16 spu_req_hdr_len,
948926 unsigned int is_inbound,
949927 struct spu_cipher_parms *cipher_parms,
950
- bool update_key,
951928 unsigned int data_size)
952929 {
953930 struct SPUHEADER *spuh;
....@@ -962,11 +939,6 @@
962939 flow_log(" in: %u\n", is_inbound);
963940 flow_log(" cipher alg: %u, cipher_type: %u\n", cipher_parms->alg,
964941 cipher_parms->type);
965
- if (update_key) {
966
- flow_log(" cipher key len: %u\n", cipher_parms->key_len);
967
- flow_dump(" key: ", cipher_parms->key_buf,
968
- cipher_parms->key_len);
969
- }
970942
971943 /*
972944 * In XTS mode, API puts "i" parameter (block tweak) in IV. For
....@@ -994,13 +966,6 @@
994966 cipher_bits |= CIPHER_INBOUND;
995967 else
996968 cipher_bits &= ~CIPHER_INBOUND;
997
-
998
- /* update encryption key for RC4 on non-first chunk */
999
- if (update_key) {
1000
- spuh->sa.cipher_flags |=
1001
- cipher_parms->type << CIPHER_TYPE_SHIFT;
1002
- memcpy(spuh + 1, cipher_parms->key_buf, cipher_parms->key_len);
1003
- }
1004969
1005970 if (cipher_parms->alg && cipher_parms->iv_buf && cipher_parms->iv_len)
1006971 /* cipher iv provided so put it in here */