Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1774314imm; Thu, 27 Sep 2018 02:14:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV62zJi75kbnjeD91gQLzN8VGMdfmlwPG86yCISSfGEWv3VXMoD4X3qnood58K4KGfdA7CYK8 X-Received: by 2002:a62:5f82:: with SMTP id t124-v6mr10302450pfb.223.1538039650508; Thu, 27 Sep 2018 02:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538039650; cv=none; d=google.com; s=arc-20160816; b=aAIqIg04BDhwpqa57PIBNa8qcbvKPA+L5rDZ5xPgxVYsRy59ScN0GxjGgoaILOtVFe 9rl7u0K/A4l60YbYrwm9DVOvyKWXvaAFEW/XAffZT8mR+KrjcA0fjOVyO+FL+w69GXu3 WEkbDsM3mLHCXAr08+B264XGa2GD8VOlKFmvOQKfCAzoRoNYZXbwz+U+ttzL82FcLVCa awQWZY+qyhsXMMmaYuLRZ+IlDzuXMs7MFWVBWBzPBOsiGuJ7OoaoLR93e/MooEfqJJnh G8yfeEqB+7Exn1VBosdrBte5lpDYFH+6M4vl1Ou3o5iOCrFKF/LdRt92weObTEryjCFx R9dg== 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; bh=cv9HZuO6Pd9wxrAWgUkWzmcj5/c907IEAC31P2YHX34=; b=JMY9vxEHtMQG+HiyspxAiGThiNsqgPhD5jIrooORKyVXONn50Az89cZQXMOKXeUmpt uiK3GvMscikmf8fbJGoED8xU1JfZk+NYs0+xZT5NLVRp+AGScZPwC0YQIG00VTNnLwn4 dChqND2kMU2XoDCivNu6ritwqg1IqU6yDGfxlPE+8xADByUV5XQAhJCPmweF4nLaQA6W xtId+tLqFMflQ5zligOzvGqDXRX1wJK9tk1HIcG1kjwOFJZRu+dTGuP5ufUq/LEuoq/O 74k+Atne3H3z24Ivk1u0xG3g+s2bo7400XE/ZvnARJG0c1GH7qgF2wyAC5yvjSV25EyF TREA== ARC-Authentication-Results: i=1; mx.google.com; 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 x3-v6si1442060pgr.27.2018.09.27.02.13.55; Thu, 27 Sep 2018 02:14:10 -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; 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 S1728302AbeI0P3D (ORCPT + 99 others); Thu, 27 Sep 2018 11:29:03 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55296 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727562AbeI0P3D (ORCPT ); Thu, 27 Sep 2018 11:29:03 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1B74F10A4; Thu, 27 Sep 2018 09:11:46 +0000 (UTC) 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.18 57/88] scsi: target: iscsi: Use bin2hex instead of a re-implementation Date: Thu, 27 Sep 2018 11:03:38 +0200 Message-Id: <20180927090307.718143161@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090300.631426620@linuxfoundation.org> References: <20180927090300.631426620@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.18-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 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 int chap_gen_challenge( struct iscsi_conn *conn, int caller, @@ -50,7 +41,7 @@ static int chap_gen_challenge( ret = get_random_bytes_wait(chap->challenge, CHAP_CHALLENGE_LENGTH); if (unlikely(ret)) return ret; - 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. @@ -289,7 +280,7 @@ static int chap_server_compute_md5( goto out; } - 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) { @@ -411,7 +402,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;