iscsi_target_auth.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ISCSI_CHAP_H_
  3. #define _ISCSI_CHAP_H_
  4. #include <linux/types.h>
  5. #define CHAP_DIGEST_UNKNOWN 0
  6. #define CHAP_DIGEST_MD5 5
  7. #define CHAP_DIGEST_SHA1 6
  8. #define CHAP_DIGEST_SHA256 7
  9. #define CHAP_DIGEST_SHA3_256 8
  10. #define MAX_CHAP_CHALLENGE_LEN 32
  11. #define CHAP_CHALLENGE_STR_LEN 4096
  12. #define MAX_RESPONSE_LENGTH 128 /* sufficient for SHA3 256 */
  13. #define MAX_CHAP_N_SIZE 512
  14. #define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */
  15. #define SHA1_SIGNATURE_SIZE 20 /* 20 bytes in a SHA1 message digest */
  16. #define SHA256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA256 message digest */
  17. #define SHA3_256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA3 256 message digest */
  18. #define CHAP_STAGE_CLIENT_A 1
  19. #define CHAP_STAGE_SERVER_AIC 2
  20. #define CHAP_STAGE_CLIENT_NR 3
  21. #define CHAP_STAGE_CLIENT_NRIC 4
  22. #define CHAP_STAGE_SERVER_NR 5
  23. struct iscsi_node_auth;
  24. struct iscsit_conn;
  25. extern u32 chap_main_loop(struct iscsit_conn *, struct iscsi_node_auth *, char *, char *,
  26. int *, int *);
  27. struct iscsi_chap {
  28. unsigned char id;
  29. unsigned char challenge[MAX_CHAP_CHALLENGE_LEN];
  30. unsigned int challenge_len;
  31. unsigned char *digest_name;
  32. unsigned int digest_size;
  33. unsigned int authenticate_target;
  34. unsigned int chap_state;
  35. } ____cacheline_aligned;
  36. #endif /*** _ISCSI_CHAP_H_ ***/