.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * 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. |
---|
15 | 4 | */ |
---|
16 | 5 | |
---|
17 | 6 | /* |
---|
.. | .. |
---|
49 | 38 | SPU2_DTLS_AEAD = 10 |
---|
50 | 39 | }; |
---|
51 | 40 | |
---|
52 | | -char *spu2_cipher_type_names[] = { "None", "AES128", "AES192", "AES256", |
---|
| 41 | +static char *spu2_cipher_type_names[] = { "None", "AES128", "AES192", "AES256", |
---|
53 | 42 | "DES", "3DES" |
---|
54 | 43 | }; |
---|
55 | 44 | |
---|
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" |
---|
58 | 47 | }; |
---|
59 | 48 | |
---|
60 | | -char *spu2_hash_type_names[] = { "None", "AES128", "AES192", "AES256", |
---|
| 49 | +static char *spu2_hash_type_names[] = { "None", "AES128", "AES192", "AES256", |
---|
61 | 50 | "Reserved", "Reserved", "MD5", "SHA1", "SHA224", "SHA256", "SHA384", |
---|
62 | 51 | "SHA512", "SHA512/224", "SHA512/256", "SHA3-224", "SHA3-256", |
---|
63 | 52 | "SHA3-384", "SHA3-512" |
---|
64 | 53 | }; |
---|
65 | 54 | |
---|
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", |
---|
67 | 56 | "Rabin", "CCM", "GCM", "Reserved" |
---|
68 | 57 | }; |
---|
69 | 58 | |
---|
.. | .. |
---|
553 | 542 | |
---|
554 | 543 | /** |
---|
555 | 544 | * 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. |
---|
557 | 546 | * @spu2_cipher_type: Cipher algorithm |
---|
558 | 547 | * @spu2_mode: Cipher mode |
---|
559 | 548 | * @cipher_key_len: Length of cipher key, in bytes |
---|
.. | .. |
---|
1118 | 1107 | } |
---|
1119 | 1108 | |
---|
1120 | 1109 | /** |
---|
1121 | | - * spu_cipher_req_init() - Build an ablkcipher SPU2 request message header, |
---|
| 1110 | + * spu_cipher_req_init() - Build an skcipher SPU2 request message header, |
---|
1122 | 1111 | * including FMD and OMD. |
---|
1123 | 1112 | * @spu_hdr: Location of start of SPU request (FMD field) |
---|
1124 | 1113 | * @cipher_parms: Parameters describing cipher request |
---|
1125 | 1114 | * |
---|
1126 | 1115 | * 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. |
---|
1128 | 1117 | * Caller should allocate this buffer in DMA-able memory at least |
---|
1129 | 1118 | * SPU_HEADER_ALLOC_LEN bytes long. |
---|
1130 | 1119 | * |
---|
.. | .. |
---|
1181 | 1170 | * @spu_req_hdr_len: Length in bytes of the SPU request header |
---|
1182 | 1171 | * @isInbound: 0 encrypt, 1 decrypt |
---|
1183 | 1172 | * @cipher_parms: Parameters describing cipher operation to be performed |
---|
1184 | | - * @update_key: If true, rewrite the cipher key in SCTX |
---|
1185 | 1173 | * @data_size: Length of the data in the BD field |
---|
1186 | 1174 | * |
---|
1187 | 1175 | * Assumes much of the header was already filled in at setkey() time in |
---|
1188 | 1176 | * 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. |
---|
1193 | 1178 | */ |
---|
1194 | 1179 | void spu2_cipher_req_finish(u8 *spu_hdr, |
---|
1195 | 1180 | u16 spu_req_hdr_len, |
---|
1196 | 1181 | unsigned int is_inbound, |
---|
1197 | 1182 | struct spu_cipher_parms *cipher_parms, |
---|
1198 | | - bool update_key, |
---|
1199 | 1183 | unsigned int data_size) |
---|
1200 | 1184 | { |
---|
1201 | 1185 | struct SPU2_FMD *fmd; |
---|
.. | .. |
---|
1207 | 1191 | flow_log(" in: %u\n", is_inbound); |
---|
1208 | 1192 | flow_log(" cipher alg: %u, cipher_type: %u\n", cipher_parms->alg, |
---|
1209 | 1193 | 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 | | - } |
---|
1215 | 1194 | flow_log(" iv len: %d\n", cipher_parms->iv_len); |
---|
1216 | 1195 | flow_dump(" iv: ", cipher_parms->iv_buf, cipher_parms->iv_len); |
---|
1217 | 1196 | flow_log(" data_size: %u\n", data_size); |
---|