162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ISCSI_CHAP_H_ 362306a36Sopenharmony_ci#define _ISCSI_CHAP_H_ 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <linux/types.h> 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#define CHAP_DIGEST_UNKNOWN 0 862306a36Sopenharmony_ci#define CHAP_DIGEST_MD5 5 962306a36Sopenharmony_ci#define CHAP_DIGEST_SHA1 6 1062306a36Sopenharmony_ci#define CHAP_DIGEST_SHA256 7 1162306a36Sopenharmony_ci#define CHAP_DIGEST_SHA3_256 8 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define MAX_CHAP_CHALLENGE_LEN 32 1462306a36Sopenharmony_ci#define CHAP_CHALLENGE_STR_LEN 4096 1562306a36Sopenharmony_ci#define MAX_RESPONSE_LENGTH 128 /* sufficient for SHA3 256 */ 1662306a36Sopenharmony_ci#define MAX_CHAP_N_SIZE 512 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */ 1962306a36Sopenharmony_ci#define SHA1_SIGNATURE_SIZE 20 /* 20 bytes in a SHA1 message digest */ 2062306a36Sopenharmony_ci#define SHA256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA256 message digest */ 2162306a36Sopenharmony_ci#define SHA3_256_SIGNATURE_SIZE 32 /* 32 bytes in a SHA3 256 message digest */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#define CHAP_STAGE_CLIENT_A 1 2462306a36Sopenharmony_ci#define CHAP_STAGE_SERVER_AIC 2 2562306a36Sopenharmony_ci#define CHAP_STAGE_CLIENT_NR 3 2662306a36Sopenharmony_ci#define CHAP_STAGE_CLIENT_NRIC 4 2762306a36Sopenharmony_ci#define CHAP_STAGE_SERVER_NR 5 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cistruct iscsi_node_auth; 3062306a36Sopenharmony_cistruct iscsit_conn; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciextern u32 chap_main_loop(struct iscsit_conn *, struct iscsi_node_auth *, char *, char *, 3362306a36Sopenharmony_ci int *, int *); 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_cistruct iscsi_chap { 3662306a36Sopenharmony_ci unsigned char id; 3762306a36Sopenharmony_ci unsigned char challenge[MAX_CHAP_CHALLENGE_LEN]; 3862306a36Sopenharmony_ci unsigned int challenge_len; 3962306a36Sopenharmony_ci unsigned char *digest_name; 4062306a36Sopenharmony_ci unsigned int digest_size; 4162306a36Sopenharmony_ci unsigned int authenticate_target; 4262306a36Sopenharmony_ci unsigned int chap_state; 4362306a36Sopenharmony_ci} ____cacheline_aligned; 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci#endif /*** _ISCSI_CHAP_H_ ***/ 46