diff options
author | Andy Grover <agrover@redhat.com> | 2013-03-04 13:52:09 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-28 12:17:48 -0700 |
commit | 36dd1474a1b29616381b16a7f1b3fbb430e2d44f (patch) | |
tree | 081e17a020c04ab68b0b80a05e4f3e67aa4abb5c | |
parent | 6ad6c406dddbca431b5bd86585b085fd005dd87b (diff) | |
download | linux-stable-36dd1474a1b29616381b16a7f1b3fbb430e2d44f.tar.gz linux-stable-36dd1474a1b29616381b16a7f1b3fbb430e2d44f.tar.bz2 linux-stable-36dd1474a1b29616381b16a7f1b3fbb430e2d44f.zip |
target/iscsi: Fix mutual CHAP auth on big-endian arches
commit 7ac9ad11b2a5cf77a92b58ee6b672ad2fa155eb1 upstream.
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: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/target/iscsi/iscsi_target_auth.c | 5 |
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( { char *endptr; unsigned long id; + unsigned char id_as_uchar; unsigned char digest[MD5_SIGNATURE_SIZE]; unsigned char type, response[MD5_SIGNATURE_SIZE * 2 + 2]; unsigned char identifier[10], *challenge = NULL; @@ -355,7 +356,9 @@ static int chap_server_compute_md5( 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); if (ret < 0) { pr_err("crypto_hash_update() failed for id\n"); |