26
26
#include "iscsi_target_nego.h"
27
27
#include "iscsi_target_auth.h"
28
28
29
- static void chap_binaryhex_to_asciihex (char * dst , char * src , int src_len )
30
- {
31
- int i ;
32
-
33
- for (i = 0 ; i < src_len ; i ++ ) {
34
- sprintf (& dst [i * 2 ], "%02x" , (int ) src [i ] & 0xff );
35
- }
36
- }
37
-
38
29
static int chap_gen_challenge (
39
30
struct iscsi_conn * conn ,
40
31
int caller ,
@@ -50,7 +41,7 @@ static int chap_gen_challenge(
50
41
ret = get_random_bytes_wait (chap -> challenge , CHAP_CHALLENGE_LENGTH );
51
42
if (unlikely (ret ))
52
43
return ret ;
53
- chap_binaryhex_to_asciihex (challenge_asciihex , chap -> challenge ,
44
+ bin2hex (challenge_asciihex , chap -> challenge ,
54
45
CHAP_CHALLENGE_LENGTH );
55
46
/*
56
47
* Set CHAP_C, and copy the generated challenge into c_str.
@@ -289,7 +280,7 @@ static int chap_server_compute_md5(
289
280
goto out ;
290
281
}
291
282
292
- chap_binaryhex_to_asciihex (response , server_digest , MD5_SIGNATURE_SIZE );
283
+ bin2hex (response , server_digest , MD5_SIGNATURE_SIZE );
293
284
pr_debug ("[server] MD5 Server Digest: %s\n" , response );
294
285
295
286
if (memcmp (server_digest , client_digest , MD5_SIGNATURE_SIZE ) != 0 ) {
@@ -411,7 +402,7 @@ static int chap_server_compute_md5(
411
402
/*
412
403
* Convert response from binary hex to ascii hext.
413
404
*/
414
- chap_binaryhex_to_asciihex (response , digest , MD5_SIGNATURE_SIZE );
405
+ bin2hex (response , digest , MD5_SIGNATURE_SIZE );
415
406
* nr_out_len += sprintf (nr_out_ptr + * nr_out_len , "CHAP_R=0x%s" ,
416
407
response );
417
408
* nr_out_len += 1 ;
0 commit comments