hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/target/iscsi/iscsi_target_auth.h
....@@ -6,14 +6,19 @@
66
77 #define CHAP_DIGEST_UNKNOWN 0
88 #define CHAP_DIGEST_MD5 5
9
-#define CHAP_DIGEST_SHA 6
9
+#define CHAP_DIGEST_SHA1 6
10
+#define CHAP_DIGEST_SHA256 7
11
+#define CHAP_DIGEST_SHA3_256 8
1012
11
-#define CHAP_CHALLENGE_LENGTH 16
13
+#define MAX_CHAP_CHALLENGE_LEN 32
1214 #define CHAP_CHALLENGE_STR_LEN 4096
13
-#define MAX_RESPONSE_LENGTH 64 /* sufficient for MD5 */
15
+#define MAX_RESPONSE_LENGTH 128 /* sufficient for SHA3 256 */
1416 #define MAX_CHAP_N_SIZE 512
1517
1618 #define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */
19
+#define SHA1_SIGNATURE_SIZE 20 /* 20 bytes in a SHA1 message digest */
20
+#define SHA256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA256 message digest */
21
+#define SHA3_256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA3 256 message digest */
1722
1823 #define CHAP_STAGE_CLIENT_A 1
1924 #define CHAP_STAGE_SERVER_AIC 2
....@@ -28,9 +33,11 @@
2833 int *, int *);
2934
3035 struct iscsi_chap {
31
- unsigned char digest_type;
3236 unsigned char id;
33
- unsigned char challenge[CHAP_CHALLENGE_LENGTH];
37
+ unsigned char challenge[MAX_CHAP_CHALLENGE_LEN];
38
+ unsigned int challenge_len;
39
+ unsigned char *digest_name;
40
+ unsigned int digest_size;
3441 unsigned int authenticate_target;
3542 unsigned int chap_state;
3643 } ____cacheline_aligned;