From nobody Thu Dec 30 00:47:50 2021 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 A00F01909555; Thu, 30 Dec 2021 00:47:51 +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 4JPV470q9yz4Sx9; Thu, 30 Dec 2021 00:47:51 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F01797200; Thu, 30 Dec 2021 00:47:50 +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 1BU0lomb023721; Thu, 30 Dec 2021 00:47:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BU0loCE023719; Thu, 30 Dec 2021 00:47:50 GMT (envelope-from git) Date: Thu, 30 Dec 2021 00:47:50 GMT Message-Id: <202112300047.1BU0loCE023719@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c3a688ef4dcb - main - OCF: Hook up plain RIPEMD160 in cryptosoft and /dev/crypto. 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c3a688ef4dcb6566dc57fdaf816445ac2dc30f0e Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640825271; 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=uVa4bs1/6eXSrlVS2JN2YxGJ73yXq66ZRyS+Sl9bu7w=; b=mqjtIM9OxPz85Ux/967mJ24FcmE08Jfidieu0WTzJ8MiDCjGx/fTFotPlqkJgk3SbOUwsz 6phMpzUthrDwK8Y5SLdNrrxhbbzltb584/mhWf1WUyqW5pUjAto8onuJJ44uiIZfWz4C4O wuCP8Jn9zzPLOJvARO1HoNiv9XXcl6CNvlVICAJqS1bR6yzZniNzzM22Klky9apmuXH0lc 4D8b4/JHC89TSYnTzGQsQ437rBXierVFR9m3nWhVWLR4a5sYCGrreUlgBwv5ca7VN+c7hu hDg/fgFqMlMmRUKkW3PwZcM+hTGeGvdEacs0cAuHWXDJnwo31PKZ2Rr6MzfbLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640825271; a=rsa-sha256; cv=none; b=a1t2sHBfc8OEzuGUTe5Fjn1hAr/C7GbsNYBc/MOXTFll8Xg9Yr3A4bAd/aAtUD+y/7Hinc q+tFP0JARBKJbede6sVvu+uHFGd97NbnLASArpa5huuuagAF6Nia+GxcJvytZvUYqiSuVn PAzyvJFR5WTCE++8hryzFodSHucBvaXHuHArBQAeSGp4fMgcsqjY1k+D5lcumdlkmQ5Jz1 BfGkjFmxtHw81wKzKBTSGHFPLWC97D2gA+8mKDT3X8sNv2ZAl4R/pSarssXyO8XdC+x8le Q7kqaVW6OU+t4j3mZfMX5U5W+yH0P3tTQ3/us3GTmFFdHD6h2gwlEP1iQIR16g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c3a688ef4dcb6566dc57fdaf816445ac2dc30f0e commit c3a688ef4dcb6566dc57fdaf816445ac2dc30f0e Author: John Baldwin AuthorDate: 2021-12-30 00:46:48 +0000 Commit: John Baldwin CommitDate: 2021-12-30 00:46:48 +0000 OCF: Hook up plain RIPEMD160 in cryptosoft and /dev/crypto. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33612 --- sys/opencrypto/crypto.c | 2 ++ sys/opencrypto/cryptodev.c | 3 +++ sys/opencrypto/cryptosoft.c | 1 + sys/opencrypto/xform_auth.h | 1 + sys/opencrypto/xform_rmd160.c | 12 ++++++++++++ tools/tools/crypto/cryptocheck.c | 2 ++ 6 files changed, 21 insertions(+) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index d1b627df8232..0ddde1e50899 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -511,6 +511,8 @@ crypto_auth_hash(const struct crypto_session_params *csp) return (&auth_hash_null); case CRYPTO_RIPEMD160_HMAC: return (&auth_hash_hmac_ripemd_160); + case CRYPTO_RIPEMD160: + return (&auth_hash_ripemd_160); case CRYPTO_SHA1: return (&auth_hash_sha1); case CRYPTO_SHA2_224: diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index d8a5f4116876..6e943735242d 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -449,6 +449,9 @@ cse_create(struct fcrypt *fcr, struct session2_op *sop) return (EINVAL); } break; + case CRYPTO_RIPEMD160: + thash = &auth_hash_ripemd_160; + break; case CRYPTO_SHA1: thash = &auth_hash_sha1; break; diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 430c8c12bf1e..43fefae99c40 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -1177,6 +1177,7 @@ swcr_setup_auth(struct swcr_session *ses, csp->csp_auth_klen, swa->sw_octx); } break; + case CRYPTO_RIPEMD160: case CRYPTO_SHA1: case CRYPTO_SHA2_224: case CRYPTO_SHA2_256: diff --git a/sys/opencrypto/xform_auth.h b/sys/opencrypto/xform_auth.h index b5fd2efdb3b4..859e451fcc0d 100644 --- a/sys/opencrypto/xform_auth.h +++ b/sys/opencrypto/xform_auth.h @@ -70,6 +70,7 @@ extern const struct auth_hash auth_hash_hmac_sha2_224; extern const struct auth_hash auth_hash_hmac_sha2_256; extern const struct auth_hash auth_hash_hmac_sha2_384; extern const struct auth_hash auth_hash_hmac_sha2_512; +extern const struct auth_hash auth_hash_ripemd_160; extern const struct auth_hash auth_hash_sha1; extern const struct auth_hash auth_hash_sha2_224; extern const struct auth_hash auth_hash_sha2_256; diff --git a/sys/opencrypto/xform_rmd160.c b/sys/opencrypto/xform_rmd160.c index 8480a63d12dc..4814fe8d67b3 100644 --- a/sys/opencrypto/xform_rmd160.c +++ b/sys/opencrypto/xform_rmd160.c @@ -57,6 +57,18 @@ static void RMD160Init_int(void *); static int RMD160Update_int(void *, const void *, u_int); static void RMD160Final_int(uint8_t *, void *); +/* Plain hash */ +const struct auth_hash auth_hash_ripemd_160 = { + .type = CRYPTO_RIPEMD160, + .name = "RIPEMD-160", + .hashsize = RIPEMD160_HASH_LEN, + .ctxsize = sizeof(RMD160_CTX), + .blocksize = RIPEMD160_BLOCK_LEN, + .Init = RMD160Init_int, + .Update = RMD160Update_int, + .Final = RMD160Final_int, +}; + /* Authentication instances */ const struct auth_hash auth_hash_hmac_ripemd_160 = { .type = CRYPTO_RIPEMD160_HMAC, diff --git a/tools/tools/crypto/cryptocheck.c b/tools/tools/crypto/cryptocheck.c index a2343675b927..d4c0968173c6 100644 --- a/tools/tools/crypto/cryptocheck.c +++ b/tools/tools/crypto/cryptocheck.c @@ -168,6 +168,8 @@ static const struct alg { const EVP_MD *(*evp_md)(void); int pkey; } algs[] = { + { .name = "ripemd160", .mac = CRYPTO_RIPEMD160, .type = T_HASH, + .evp_md = EVP_ripemd160 }, { .name = "sha1", .mac = CRYPTO_SHA1, .type = T_HASH, .evp_md = EVP_sha1 }, { .name = "sha224", .mac = CRYPTO_SHA2_224, .type = T_HASH,