Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3914371imm; Mon, 8 Oct 2018 11:36:23 -0700 (PDT) X-Google-Smtp-Source: ACcGV60cMJvUXnCsTTu8MHLd2OUeP7zuYTs+5qlSBRZFwJf2DaQV3VhwnhnM5Ad02c0nabwXjqv1 X-Received: by 2002:a17:902:bf48:: with SMTP id u8-v6mr25383409pls.254.1539023782989; Mon, 08 Oct 2018 11:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023782; cv=none; d=google.com; s=arc-20160816; b=gRNOg4xEkGI50CveIQNdNWk0JzSXhd9XZCIjfxRl146WFcgqJiIaHJiPkWkA8ozYkm rOT2+9MTYwT0NtvmxfygFiwaeP9h81kTf7eTr6L9/aU4Eqi5QBIGE96k7dgpitOzBLeE bVrYy7qNMesmfy9nSUYYq0fJq4AZKvi1zrsHXvu6iueeJwrB9FRfWioKwgs0Qkbuqmqv aJos46IC6qBR/7Ha/126J4dK7iKvMD2QNRnpZ+KinhnoFIRMuEIz6CrmEArsKiR4ZkSk EuHC9STW2ZdJ8/z5h47TuTcL4h/S7TnaOyWhHMjR12OnWQEHHEBRMzPj4WxNws2w1+aS /QHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ajZy8IYSdr6OdfisaYsEKTl5/DEygmcMOdoJF4K8oy4=; b=djV4fNX+yNxsctHgOtqsKRarBleWq+LjYf+aENArxcWzvAVAfoB3YqmZrzIQ6jpJ/l k17UWxoSSyYbvfniTwvd2icxnoGR/bwuPH7EZ7dc6Ppgdrxnyc2GaYEunrp9JHT6w/j5 4umXe9cKGODYDyF58k8UkYnFDAJcOGbT688ahC/hms6cmjO3LJNHOgRsfNskETxJnpZB S30/GAB1grFx6zFLlhoial/foHbDB8tUV5AALNOCh/RMmbha5BWGyyQot4OsvvPpRZF7 w871t65fV57+zuW6XhzB3XEJB3GYqTOmq2QGhx2AnlC8JDPy1tPGJySEV2wRK14Uya4K Yqbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cW+0upcw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si19706732pft.177.2018.10.08.11.36.07; Mon, 08 Oct 2018 11:36:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cW+0upcw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728185AbeJIBsT (ORCPT + 99 others); Mon, 8 Oct 2018 21:48:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:60414 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbeJIBsS (ORCPT ); Mon, 8 Oct 2018 21:48:18 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 29E672089D; Mon, 8 Oct 2018 18:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023715; bh=pBfjZJOeR6Mn80SGlfCgdLj/FkHgkpz96k76SaBlpq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cW+0upcwesXAr1ezqTdcBwfkCWW0M4jCMXXAUariLfRvJTQWqd/ldTFnNRAZGEE6b bUsEDQdHqgkvzhu6QqTdwsZwWX3WLMmV/dHhxNkK+DQdOlPYuhD02G2sqSpokztrX9 Kt8kyA+KVR0y0zQT1tHZoUfx90uQF6VILE7pnAu0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Pelletier , Mike Christie , "Martin K. Petersen" Subject: [PATCH 4.4 060/113] scsi: target: iscsi: Use bin2hex instead of a re-implementation Date: Mon, 8 Oct 2018 20:31:01 +0200 Message-Id: <20181008175534.312535208@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vincent Pelletier commit 8c39e2699f8acb2e29782a834e56306da24937fe upstream. Signed-off-by: Vincent Pelletier Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen [plr.vincent@gmail.com: hunk context change for 4.4 and 4.9, no code change] Signed-off-by: Greg Kroah-Hartman --- drivers/target/iscsi/iscsi_target_auth.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) --- a/drivers/target/iscsi/iscsi_target_auth.c +++ b/drivers/target/iscsi/iscsi_target_auth.c @@ -26,15 +26,6 @@ #include "iscsi_target_nego.h" #include "iscsi_target_auth.h" -static void chap_binaryhex_to_asciihex(char *dst, char *src, int src_len) -{ - int i; - - for (i = 0; i < src_len; i++) { - sprintf(&dst[i*2], "%02x", (int) src[i] & 0xff); - } -} - static void chap_gen_challenge( struct iscsi_conn *conn, int caller, @@ -47,7 +38,7 @@ static void chap_gen_challenge( memset(challenge_asciihex, 0, CHAP_CHALLENGE_LENGTH * 2 + 1); get_random_bytes(chap->challenge, CHAP_CHALLENGE_LENGTH); - chap_binaryhex_to_asciihex(challenge_asciihex, chap->challenge, + bin2hex(challenge_asciihex, chap->challenge, CHAP_CHALLENGE_LENGTH); /* * Set CHAP_C, and copy the generated challenge into c_str. @@ -287,7 +278,7 @@ static int chap_server_compute_md5( } crypto_free_hash(tfm); - chap_binaryhex_to_asciihex(response, server_digest, MD5_SIGNATURE_SIZE); + bin2hex(response, server_digest, MD5_SIGNATURE_SIZE); pr_debug("[server] MD5 Server Digest: %s\n", response); if (memcmp(server_digest, client_digest, MD5_SIGNATURE_SIZE) != 0) { @@ -431,7 +422,7 @@ static int chap_server_compute_md5( /* * Convert response from binary hex to ascii hext. */ - chap_binaryhex_to_asciihex(response, digest, MD5_SIGNATURE_SIZE); + bin2hex(response, digest, MD5_SIGNATURE_SIZE); *nr_out_len += sprintf(nr_out_ptr + *nr_out_len, "CHAP_R=0x%s", response); *nr_out_len += 1;