Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1781198imm; Thu, 27 Sep 2018 02:22:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV60nhWLQqB0+Jv+b+LyggcRp0CD6lTF49EQx7B73cgmrQQi7a5buKFIMA68Xt29uCXILgivE X-Received: by 2002:a63:d502:: with SMTP id c2-v6mr9307737pgg.324.1538040120233; Thu, 27 Sep 2018 02:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538040120; cv=none; d=google.com; s=arc-20160816; b=FAAHOZwljyp3VGJDPJ953TjROB5L6EXakjp3mN+TFPimzSv9bPSAItFMG0GUwVMkSA FhBCxcvjtaA+gS3davwxUVGG6YI8SEz4rt6FZ+3ReLK2N9sUmoXbRQt3VAkYGtS9fSYE tKmTzZ0sdpiwPvcV85b3oBsSt/Q6nHFals+U2NopX/9ZfBttXp/qzhhjdQV1jPvcD3KO G4GKHIsqcqm01g6sIAYyRBmx4mQU4OPckbJcy3HSTDGGoHUcqRk7KENCo3r2T2Ek8rFv 3JVDUwGzflR5mlq99UeLez8tU9MMXy/SlKiwufr9ihMdWiklL82FPzxAeI5fY1xAi7gX zklw== 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=XLnknR5eCrNPPt6+KDf79gKX5H5GhEE8VS/FgY8LI10=; b=s1dMMAXR1RmTtAVcVlXJOcCctdIlv/8kRAD/WT9F/VTVka6L6Uz9plleU9QDW2E3U7 4fWm+EXHZjO1QzXnQX73pvo/oL5Ub8JGaIADuN5LoOXJlMPXRAlZvSIywVDQ5P/8vKUC oo7KI8D3MXekYhj5ZWyy3+WxQyOII3ALjQiNmH+td2FkqUYpOR7y2m3XjfQtyqlxuU1D XlN7FaZiO2Hrt2uGQSArQyF2TWcPvKG/xPFcloAQYvbHHGkImYCTSzdaKU6rY0NkKEOx bOM/bpB5qPK8RX1lWXHOEZYcP3EwToP3EU6+otPcZAnWqT32ojFPXRh4LQEQ2EkN+Fa3 vNxQ== 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 v8-v6si1336698plz.355.2018.09.27.02.21.45; Thu, 27 Sep 2018 02:22:00 -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 S1728271AbeI0PhI (ORCPT + 99 others); Thu, 27 Sep 2018 11:37:08 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56254 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727439AbeI0PhI (ORCPT ); Thu, 27 Sep 2018 11:37:08 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F27D5110D; Thu, 27 Sep 2018 09:19:48 +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.14 38/64] scsi: target: iscsi: Use bin2hex instead of a re-implementation Date: Thu, 27 Sep 2018 11:03:55 +0200 Message-Id: <20180927090255.440423665@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180927090249.801943776@linuxfoundation.org> References: <20180927090249.801943776@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.14-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;