| .. | .. |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | #define CHAP_DIGEST_UNKNOWN 0 |
|---|
| 8 | 8 | #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 |
|---|
| 10 | 12 | |
|---|
| 11 | | -#define CHAP_CHALLENGE_LENGTH 16 |
|---|
| 13 | +#define MAX_CHAP_CHALLENGE_LEN 32 |
|---|
| 12 | 14 | #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 */ |
|---|
| 14 | 16 | #define MAX_CHAP_N_SIZE 512 |
|---|
| 15 | 17 | |
|---|
| 16 | 18 | #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 */ |
|---|
| 17 | 22 | |
|---|
| 18 | 23 | #define CHAP_STAGE_CLIENT_A 1 |
|---|
| 19 | 24 | #define CHAP_STAGE_SERVER_AIC 2 |
|---|
| .. | .. |
|---|
| 28 | 33 | int *, int *); |
|---|
| 29 | 34 | |
|---|
| 30 | 35 | struct iscsi_chap { |
|---|
| 31 | | - unsigned char digest_type; |
|---|
| 32 | 36 | 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; |
|---|
| 34 | 41 | unsigned int authenticate_target; |
|---|
| 35 | 42 | unsigned int chap_state; |
|---|
| 36 | 43 | } ____cacheline_aligned; |
|---|