aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/iscsi/iscsi_target_auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/target/iscsi/iscsi_target_auth.c')
-rw-r--r--drivers/target/iscsi/iscsi_target_auth.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
index db0cf7c8adde..a0fc7b9eea65 100644
--- a/drivers/target/iscsi/iscsi_target_auth.c
+++ b/drivers/target/iscsi/iscsi_target_auth.c
@@ -166,6 +166,7 @@ static int chap_server_compute_md5(
166{ 166{
167 char *endptr; 167 char *endptr;
168 unsigned long id; 168 unsigned long id;
169 unsigned char id_as_uchar;
169 unsigned char digest[MD5_SIGNATURE_SIZE]; 170 unsigned char digest[MD5_SIGNATURE_SIZE];
170 unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; 171 unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2];
171 unsigned char identifier[10], *challenge = NULL; 172 unsigned char identifier[10], *challenge = NULL;
@@ -355,7 +356,9 @@ static int chap_server_compute_md5(
355 goto out; 356 goto out;
356 } 357 }
357 358
358 sg_init_one(&sg, &id, 1); 359 /* To handle both endiannesses */
360 id_as_uchar = id;
361 sg_init_one(&sg, &id_as_uchar, 1);
359 ret = crypto_hash_update(&desc, &sg, 1); 362 ret = crypto_hash_update(&desc, &sg, 1);
360 if (ret < 0) { 363 if (ret < 0) {
361 pr_err("crypto_hash_update() failed for id\n"); 364 pr_err("crypto_hash_update() failed for id\n");