hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/crypto/bcm/spu2.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 /*
....@@ -49,21 +38,21 @@
4938 SPU2_DTLS_AEAD = 10
5039 };
5140
52
-char *spu2_cipher_type_names[] = { "None", "AES128", "AES192", "AES256",
41
+static char *spu2_cipher_type_names[] = { "None", "AES128", "AES192", "AES256",
5342 "DES", "3DES"
5443 };
5544
56
-char *spu2_cipher_mode_names[] = { "ECB", "CBC", "CTR", "CFB", "OFB", "XTS",
57
- "CCM", "GCM"
45
+static char *spu2_cipher_mode_names[] = { "ECB", "CBC", "CTR", "CFB", "OFB",
46
+ "XTS", "CCM", "GCM"
5847 };
5948
60
-char *spu2_hash_type_names[] = { "None", "AES128", "AES192", "AES256",
49
+static char *spu2_hash_type_names[] = { "None", "AES128", "AES192", "AES256",
6150 "Reserved", "Reserved", "MD5", "SHA1", "SHA224", "SHA256", "SHA384",
6251 "SHA512", "SHA512/224", "SHA512/256", "SHA3-224", "SHA3-256",
6352 "SHA3-384", "SHA3-512"
6453 };
6554
66
-char *spu2_hash_mode_names[] = { "CMAC", "CBC-MAC", "XCBC-MAC", "HMAC",
55
+static char *spu2_hash_mode_names[] = { "CMAC", "CBC-MAC", "XCBC-MAC", "HMAC",
6756 "Rabin", "CCM", "GCM", "Reserved"
6857 };
6958
....@@ -553,7 +542,7 @@
553542
554543 /**
555544 * spu2_fmd_init() - At setkey time, initialize the fixed meta data for
556
- * subsequent ablkcipher requests for this context.
545
+ * subsequent skcipher requests for this context.
557546 * @spu2_cipher_type: Cipher algorithm
558547 * @spu2_mode: Cipher mode
559548 * @cipher_key_len: Length of cipher key, in bytes
....@@ -1118,13 +1107,13 @@
11181107 }
11191108
11201109 /**
1121
- * spu_cipher_req_init() - Build an ablkcipher SPU2 request message header,
1110
+ * spu_cipher_req_init() - Build an skcipher SPU2 request message header,
11221111 * including FMD and OMD.
11231112 * @spu_hdr: Location of start of SPU request (FMD field)
11241113 * @cipher_parms: Parameters describing cipher request
11251114 *
11261115 * Called at setkey time to initialize a msg header that can be reused for all
1127
- * subsequent ablkcipher requests. Construct the message starting at spu_hdr.
1116
+ * subsequent skcipher requests. Construct the message starting at spu_hdr.
11281117 * Caller should allocate this buffer in DMA-able memory at least
11291118 * SPU_HEADER_ALLOC_LEN bytes long.
11301119 *
....@@ -1181,21 +1170,16 @@
11811170 * @spu_req_hdr_len: Length in bytes of the SPU request header
11821171 * @isInbound: 0 encrypt, 1 decrypt
11831172 * @cipher_parms: Parameters describing cipher operation to be performed
1184
- * @update_key: If true, rewrite the cipher key in SCTX
11851173 * @data_size: Length of the data in the BD field
11861174 *
11871175 * Assumes much of the header was already filled in at setkey() time in
11881176 * spu_cipher_req_init().
1189
- * spu_cipher_req_init() fills in the encryption key. For RC4, when submitting a
1190
- * request for a non-first chunk, we use the 260-byte SUPDT field from the
1191
- * previous response as the key. update_key is true for this case. Unused in all
1192
- * other cases.
1177
+ * spu_cipher_req_init() fills in the encryption key.
11931178 */
11941179 void spu2_cipher_req_finish(u8 *spu_hdr,
11951180 u16 spu_req_hdr_len,
11961181 unsigned int is_inbound,
11971182 struct spu_cipher_parms *cipher_parms,
1198
- bool update_key,
11991183 unsigned int data_size)
12001184 {
12011185 struct SPU2_FMD *fmd;
....@@ -1207,11 +1191,6 @@
12071191 flow_log(" in: %u\n", is_inbound);
12081192 flow_log(" cipher alg: %u, cipher_type: %u\n", cipher_parms->alg,
12091193 cipher_parms->type);
1210
- if (update_key) {
1211
- flow_log(" cipher key len: %u\n", cipher_parms->key_len);
1212
- flow_dump(" key: ", cipher_parms->key_buf,
1213
- cipher_parms->key_len);
1214
- }
12151194 flow_log(" iv len: %d\n", cipher_parms->iv_len);
12161195 flow_dump(" iv: ", cipher_parms->iv_buf, cipher_parms->iv_len);
12171196 flow_log(" data_size: %u\n", data_size);