diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c index a0fc7b9eea65..cee17543278c 100644 --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c | |||
@@ -49,32 +49,6 @@ static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len) | |||
49 | } | 49 | } |
50 | } | 50 | } |
51 | 51 | ||
52 | static void chap_set_random(char *data, int length) | ||
53 | { | ||
54 | long r; | ||
55 | unsigned n; | ||
56 | |||
57 | while (length > 0) { | ||
58 | get_random_bytes(&r, sizeof(long)); | ||
59 | r = r ^ (r >> 8); | ||
60 | r = r ^ (r >> 4); | ||
61 | n = r & 0x7; | ||
62 | |||
63 | get_random_bytes(&r, sizeof(long)); | ||
64 | r = r ^ (r >> 8); | ||
65 | r = r ^ (r >> 5); | ||
66 | n = (n << 3) | (r & 0x7); | ||
67 | |||
68 | get_random_bytes(&r, sizeof(long)); | ||
69 | r = r ^ (r >> 8); | ||
70 | r = r ^ (r >> 5); | ||
71 | n = (n << 2) | (r & 0x3); | ||
72 | |||
73 | *data++ = n; | ||
74 | length--; | ||
75 | } | ||
76 | } | ||
77 | |||
78 | static void chap_gen_challenge( | 52 | static void chap_gen_challenge( |
79 | struct iscsi_conn *conn, | 53 | struct iscsi_conn *conn, |
80 | int caller, | 54 | int caller, |
@@ -86,7 +60,7 @@ static void chap_gen_challenge( | |||
86 | 60 | ||
87 | memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); | 61 | memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); |
88 | 62 | ||
89 | chap_set_random(chap->challenge, CHAP_CHALLENGE_LENGTH); | 63 | get_random_bytes(chap->challenge, CHAP_CHALLENGE_LENGTH); |
90 | chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge, | 64 | chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge, |
91 | CHAP_CHALLENGE_LENGTH); | 65 | CHAP_CHALLENGE_LENGTH); |
92 | /* | 66 | /* |