From nobody Wed Aug 03 19:25:11 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Lyhdg6Ndbz4YTrS; Wed, 3 Aug 2022 19:25:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Lyhdg5dZlz3Cjx; Wed, 3 Aug 2022 19:25:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659554711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/b3Qm7M+KIpcCPMLzI63hSFggatvm/Jd4+G+Si61iXc=; b=gJ4VAX+jts9D1GxUSy1iKyVZYuxtvgLVZ3WViFT/GHBY5eW8n4LcKEphRoXcl0fu2eCXlW u72u/dYz/QrTvN7b3K0AkW7uwKWvX1oXpGLWPXYi6XwGo6CXvKFoYUSGseS4N7saVxkk4l hYYB2utsN3TFkbxeWIbxfSetpYVSKhuUNYPo3FEKrVFzsn57TzmGpHI0pIEnm6lQJxejWK iSPxeWq4q3tvNCj+V+J3on5DOClxgUV4977T79f/4W0ySlWrCqsjSmaF6nT/zwqr8zK2Uy LECTjC6aqzwepAdhr328bWfwFB+6Ze9wubLY7s8oC1EWIMbBEdsNUe28R0nFmQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Lyhdg4Spmz12YM; Wed, 3 Aug 2022 19:25:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 273JPBCO049063; Wed, 3 Aug 2022 19:25:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 273JPBMo049062; Wed, 3 Aug 2022 19:25:11 GMT (envelope-from git) Date: Wed, 3 Aug 2022 19:25:11 GMT Message-Id: <202208031925.273JPBMo049062@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: c7a8e8d372b2 - main - xinstall: make md5 and ripemd160 conditional List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7a8e8d372b212c97dde6ce2731db27aa0b2201c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659554711; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/b3Qm7M+KIpcCPMLzI63hSFggatvm/Jd4+G+Si61iXc=; b=aXQ+017T6U9KXo6zqX5jIZV04qxc95YMNqwZJjl37GmOMmN2BJndUhHJM8V7YTiFomFZJl ubZ+1UOI1Kr8Uwf2I7GQ7MzYpJGPco7BP5o2/KSkID4Dl99kDgybIX4wdXPTTW6USQeOld 1q6fiTL2Cg/3sXeeIyZ3nDUA+H9oQgo+EbjYUE/3sA08kBJTtdy8tQN4CUORS9nVWf3vXB yEJkq7I/jH6X3R88RaZvoyMcABF8XDV8839tYbybltKBAAlyKDLuMqNuzFlETC6LGmgvFK K1YZdZU/v2pr6+vovTiLx696ZHNQen6FHWHaZuVs0IxbBBiTjpaVxxyeoQC3ZQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659554711; a=rsa-sha256; cv=none; b=V0dVHYplEdyYYdCVTGv0fpWcCPoY6NSCpHvjg/EjFH+CTSLVsiXd7/8nqFtiLvzgFejFEA 95wzXAXdmKGdotuXUjWGjs1WQmAtvoTNtuMxuZ864Hf2oOQLhhbNfJHcWhtLAQ6KX+GXjv 7RYt6ZT1yTHcvfZN/zGIaAcuZEcoupx+KrTX4FnN+wd48cpfdUYSVZti+fTOoBIx109O+B tVi8FF8qan1tmkJixB9r4ta3kFYpFCQGFAb4RBGMpGs7KtTeFKOngE79EQCJ8DLc0Av8Fs 8L53bC1q/YTidY/qL+P8g099jIgSVircL9J68xHenTghbhDRfXvnx0GtJ7zQhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=c7a8e8d372b212c97dde6ce2731db27aa0b2201c commit c7a8e8d372b212c97dde6ce2731db27aa0b2201c Author: Dag-Erling Smørgrav AuthorDate: 2022-08-03 19:20:47 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2022-08-03 19:24:07 +0000 xinstall: make md5 and ripemd160 conditional Sponsored by: Klara, Inc. --- usr.bin/xinstall/Makefile | 3 ++- usr.bin/xinstall/xinstall.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/usr.bin/xinstall/Makefile b/usr.bin/xinstall/Makefile index ce70cb882190..9969ef104e98 100644 --- a/usr.bin/xinstall/Makefile +++ b/usr.bin/xinstall/Makefile @@ -14,7 +14,8 @@ MAN= install.1 CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd -LIBADD= md +LIBADD= md +CFLAGS+= -DWITH_MD5 -DWITH_RIPEMD160 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index ddad7ba9115e..a236838c8fd1 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -57,10 +57,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef WITH_MD5 #include +#endif #include #include +#ifdef WITH_RIPEMD160 #include +#endif #include #include #include @@ -100,8 +104,12 @@ __FBSDID("$FreeBSD$"); #define BACKUP_SUFFIX ".old" typedef union { +#ifdef WITH_MD5 MD5_CTX MD5; +#endif +#ifdef WITH_RIPEMD160 RIPEMD160_CTX RIPEMD160; +#endif SHA1_CTX SHA1; SHA256_CTX SHA256; SHA512_CTX SHA512; @@ -109,8 +117,12 @@ typedef union { static enum { DIGEST_NONE = 0, +#ifdef WITH_MD5 DIGEST_MD5, +#endif +#ifdef WITH_RIPEMD160 DIGEST_RIPEMD160, +#endif DIGEST_SHA1, DIGEST_SHA256, DIGEST_SHA512, @@ -288,10 +300,14 @@ main(int argc, char *argv[]) if (digest != NULL) { if (strcmp(digest, "none") == 0) { digesttype = DIGEST_NONE; +#ifdef WITH_MD5 } else if (strcmp(digest, "md5") == 0) { digesttype = DIGEST_MD5; +#endif +#ifdef WITH_RIPEMD160 } else if (strcmp(digest, "rmd160") == 0) { digesttype = DIGEST_RIPEMD160; +#endif } else if (strcmp(digest, "sha1") == 0) { digesttype = DIGEST_SHA1; } else if (strcmp(digest, "sha256") == 0) { @@ -402,10 +418,14 @@ digest_file(const char *name) { switch (digesttype) { +#ifdef WITH_MD5 case DIGEST_MD5: return (MD5File(name, NULL)); +#endif +#ifdef WITH_RIPEMD160 case DIGEST_RIPEMD160: return (RIPEMD160_File(name, NULL)); +#endif case DIGEST_SHA1: return (SHA1_File(name, NULL)); case DIGEST_SHA256: @@ -424,12 +444,16 @@ digest_init(DIGEST_CTX *c) switch (digesttype) { case DIGEST_NONE: break; +#ifdef WITH_MD5 case DIGEST_MD5: MD5Init(&(c->MD5)); break; +#endif +#ifdef WITH_RIPEMD160 case DIGEST_RIPEMD160: RIPEMD160_Init(&(c->RIPEMD160)); break; +#endif case DIGEST_SHA1: SHA1_Init(&(c->SHA1)); break; @@ -449,12 +473,16 @@ digest_update(DIGEST_CTX *c, const char *data, size_t len) switch (digesttype) { case DIGEST_NONE: break; +#ifdef WITH_MD5 case DIGEST_MD5: MD5Update(&(c->MD5), data, len); break; +#endif +#ifdef WITH_RIPEMD160 case DIGEST_RIPEMD160: RIPEMD160_Update(&(c->RIPEMD160), data, len); break; +#endif case DIGEST_SHA1: SHA1_Update(&(c->SHA1), data, len); break; @@ -472,10 +500,14 @@ digest_end(DIGEST_CTX *c, char *buf) { switch (digesttype) { +#ifdef WITH_MD5 case DIGEST_MD5: return (MD5End(&(c->MD5), buf)); +#endif +#ifdef WITH_RIPEMD160 case DIGEST_RIPEMD160: return (RIPEMD160_End(&(c->RIPEMD160), buf)); +#endif case DIGEST_SHA1: return (SHA1_End(&(c->SHA1), buf)); case DIGEST_SHA256: