From owner-svn-src-all@freebsd.org Fri Jul 20 07:07:29 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F3B411034A93; Fri, 20 Jul 2018 07:07:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A273170DA3; Fri, 20 Jul 2018 07:07:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80E854EB3; Fri, 20 Jul 2018 07:07:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6K77SUK074390; Fri, 20 Jul 2018 07:07:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6K77Sk7074389; Fri, 20 Jul 2018 07:07:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201807200707.w6K77Sk7074389@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Fri, 20 Jul 2018 07:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336540 - head/lib/libcrypt X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/lib/libcrypt X-SVN-Commit-Revision: 336540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jul 2018 07:07:29 -0000 Author: delphij Date: Fri Jul 20 07:07:27 2018 New Revision: 336540 URL: https://svnweb.freebsd.org/changeset/base/336540 Log: Get rid of unused variables. copied_key and copied_salt are assigned with NULL and never used otherwise. Remove the two variables and related code. Reviewed by: pfg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D16314 Modified: head/lib/libcrypt/crypt-sha256.c head/lib/libcrypt/crypt-sha512.c Modified: head/lib/libcrypt/crypt-sha256.c ============================================================================== --- head/lib/libcrypt/crypt-sha256.c Fri Jul 20 07:01:28 2018 (r336539) +++ head/lib/libcrypt/crypt-sha256.c Fri Jul 20 07:07:27 2018 (r336540) @@ -68,13 +68,10 @@ crypt_sha256(const char *key, const char *salt, char * uint8_t alt_result[32], temp_result[32]; SHA256_CTX ctx, alt_ctx; size_t salt_len, key_len, cnt, rounds; - char *cp, *copied_key, *copied_salt, *p_bytes, *s_bytes, *endp; + char *cp, *p_bytes, *s_bytes, *endp; const char *num; bool rounds_custom; - copied_key = NULL; - copied_salt = NULL; - /* Default number of rounds. */ rounds = ROUNDS_DEFAULT; rounds_custom = false; @@ -244,10 +241,6 @@ crypt_sha256(const char *key, const char *salt, char * memset(s_bytes, '\0', salt_len); memset(&ctx, '\0', sizeof(ctx)); memset(&alt_ctx, '\0', sizeof(alt_ctx)); - if (copied_key != NULL) - memset(copied_key, '\0', key_len); - if (copied_salt != NULL) - memset(copied_salt, '\0', salt_len); return (0); } Modified: head/lib/libcrypt/crypt-sha512.c ============================================================================== --- head/lib/libcrypt/crypt-sha512.c Fri Jul 20 07:01:28 2018 (r336539) +++ head/lib/libcrypt/crypt-sha512.c Fri Jul 20 07:07:27 2018 (r336540) @@ -68,13 +68,10 @@ crypt_sha512(const char *key, const char *salt, char * uint8_t alt_result[64], temp_result[64]; SHA512_CTX ctx, alt_ctx; size_t salt_len, key_len, cnt, rounds; - char *cp, *copied_key, *copied_salt, *p_bytes, *s_bytes, *endp; + char *cp, *p_bytes, *s_bytes, *endp; const char *num; bool rounds_custom; - copied_key = NULL; - copied_salt = NULL; - /* Default number of rounds. */ rounds = ROUNDS_DEFAULT; rounds_custom = false; @@ -256,10 +253,6 @@ crypt_sha512(const char *key, const char *salt, char * memset(s_bytes, '\0', salt_len); memset(&ctx, '\0', sizeof(ctx)); memset(&alt_ctx, '\0', sizeof(alt_ctx)); - if (copied_key != NULL) - memset(copied_key, '\0', key_len); - if (copied_salt != NULL) - memset(copied_salt, '\0', salt_len); return (0); }