git: c3a688ef4dcb - main - OCF: Hook up plain RIPEMD160 in cryptosoft and /dev/crypto.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 30 Dec 2021 00:47:50 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c3a688ef4dcb6566dc57fdaf816445ac2dc30f0e commit c3a688ef4dcb6566dc57fdaf816445ac2dc30f0e Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2021-12-30 00:46:48 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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,