提交 7ac9ad11 编写于 作者: A Andy Grover 提交者: Nicholas Bellinger

target/iscsi: Fix mutual CHAP auth on big-endian arches

See https://bugzilla.redhat.com/show_bug.cgi?id=916290

Used a temp var since we take its address in sg_init_one.
Signed-off-by: NAndy Grover <agrover@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 882e3f8e
...@@ -166,6 +166,7 @@ static int chap_server_compute_md5( ...@@ -166,6 +166,7 @@ static int chap_server_compute_md5(
{ {
char *endptr; char *endptr;
unsigned long id; unsigned long id;
unsigned char id_as_uchar;
unsigned char digest[MD5_SIGNATURE_SIZE]; unsigned char digest[MD5_SIGNATURE_SIZE];
unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2];
unsigned char identifier[10], *challenge = NULL; unsigned char identifier[10], *challenge = NULL;
...@@ -355,7 +356,9 @@ static int chap_server_compute_md5( ...@@ -355,7 +356,9 @@ static int chap_server_compute_md5(
goto out; goto out;
} }
sg_init_one(&sg, &id, 1); /* To handle both endiannesses */
id_as_uchar = id;
sg_init_one(&sg, &id_as_uchar, 1);
ret = crypto_hash_update(&desc, &sg, 1); ret = crypto_hash_update(&desc, &sg, 1);
if (ret < 0) { if (ret < 0) {
pr_err("crypto_hash_update() failed for id\n"); pr_err("crypto_hash_update() failed for id\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册