* [PATCH] SUNRPC: Remove unused make_checksum
@ 2025-02-03 2:07 linux
2025-02-03 9:47 ` Simon Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: linux @ 2025-02-03 2:07 UTC (permalink / raw)
To: trondmy, anna, chuck.lever, jlayton, neilb, okorniev, Dai.Ngo,
tom
Cc: davem, edumazet, kuba, pabeni, horms, linux-nfs, netdev,
linux-kernel, Dr. David Alan Gilbert
From: "Dr. David Alan Gilbert" <linux@treblig.org>
Commit ec596aaf9b48 ("SUNRPC: Remove code behind
CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED") was the last user of the
make_checksum() function.
Remove it.
Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
---
net/sunrpc/auth_gss/gss_krb5_crypto.c | 90 -------------------------
net/sunrpc/auth_gss/gss_krb5_internal.h | 4 --
2 files changed, 94 deletions(-)
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index 7e09b15c5538..8f2d65c1e831 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -148,96 +148,6 @@ checksummer(struct scatterlist *sg, void *data)
return crypto_ahash_update(req);
}
-/*
- * checksum the plaintext data and hdrlen bytes of the token header
- * The checksum is performed over the first 8 bytes of the
- * gss token header and then over the data body
- */
-u32
-make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
- struct xdr_buf *body, int body_offset, u8 *cksumkey,
- unsigned int usage, struct xdr_netobj *cksumout)
-{
- struct crypto_ahash *tfm;
- struct ahash_request *req;
- struct scatterlist sg[1];
- int err = -1;
- u8 *checksumdata;
- unsigned int checksumlen;
-
- if (cksumout->len < kctx->gk5e->cksumlength) {
- dprintk("%s: checksum buffer length, %u, too small for %s\n",
- __func__, cksumout->len, kctx->gk5e->name);
- return GSS_S_FAILURE;
- }
-
- checksumdata = kmalloc(GSS_KRB5_MAX_CKSUM_LEN, GFP_KERNEL);
- if (checksumdata == NULL)
- return GSS_S_FAILURE;
-
- tfm = crypto_alloc_ahash(kctx->gk5e->cksum_name, 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(tfm))
- goto out_free_cksum;
-
- req = ahash_request_alloc(tfm, GFP_KERNEL);
- if (!req)
- goto out_free_ahash;
-
- ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL);
-
- checksumlen = crypto_ahash_digestsize(tfm);
-
- if (cksumkey != NULL) {
- err = crypto_ahash_setkey(tfm, cksumkey,
- kctx->gk5e->keylength);
- if (err)
- goto out;
- }
-
- err = crypto_ahash_init(req);
- if (err)
- goto out;
- sg_init_one(sg, header, hdrlen);
- ahash_request_set_crypt(req, sg, NULL, hdrlen);
- err = crypto_ahash_update(req);
- if (err)
- goto out;
- err = xdr_process_buf(body, body_offset, body->len - body_offset,
- checksummer, req);
- if (err)
- goto out;
- ahash_request_set_crypt(req, NULL, checksumdata, 0);
- err = crypto_ahash_final(req);
- if (err)
- goto out;
-
- switch (kctx->gk5e->ctype) {
- case CKSUMTYPE_RSA_MD5:
- err = krb5_encrypt(kctx->seq, NULL, checksumdata,
- checksumdata, checksumlen);
- if (err)
- goto out;
- memcpy(cksumout->data,
- checksumdata + checksumlen - kctx->gk5e->cksumlength,
- kctx->gk5e->cksumlength);
- break;
- case CKSUMTYPE_HMAC_SHA1_DES3:
- memcpy(cksumout->data, checksumdata, kctx->gk5e->cksumlength);
- break;
- default:
- BUG();
- break;
- }
- cksumout->len = kctx->gk5e->cksumlength;
-out:
- ahash_request_free(req);
-out_free_ahash:
- crypto_free_ahash(tfm);
-out_free_cksum:
- kfree(checksumdata);
- return err ? GSS_S_FAILURE : 0;
-}
-
/**
* gss_krb5_checksum - Compute the MAC for a GSS Wrap or MIC token
* @tfm: an initialized hash transform
diff --git a/net/sunrpc/auth_gss/gss_krb5_internal.h b/net/sunrpc/auth_gss/gss_krb5_internal.h
index 0bda0078d7d8..8769e9e705bf 100644
--- a/net/sunrpc/auth_gss/gss_krb5_internal.h
+++ b/net/sunrpc/auth_gss/gss_krb5_internal.h
@@ -155,10 +155,6 @@ static inline int krb5_derive_key(struct krb5_ctx *kctx,
void krb5_make_confounder(u8 *p, int conflen);
-u32 make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
- struct xdr_buf *body, int body_offset, u8 *cksumkey,
- unsigned int usage, struct xdr_netobj *cksumout);
-
u32 gss_krb5_checksum(struct crypto_ahash *tfm, char *header, int hdrlen,
const struct xdr_buf *body, int body_offset,
struct xdr_netobj *cksumout);
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] SUNRPC: Remove unused make_checksum
2025-02-03 2:07 [PATCH] SUNRPC: Remove unused make_checksum linux
@ 2025-02-03 9:47 ` Simon Horman
2025-02-03 11:17 ` Jeff Layton
2025-02-03 14:32 ` cel
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-02-03 9:47 UTC (permalink / raw)
To: linux
Cc: trondmy, anna, chuck.lever, jlayton, neilb, okorniev, Dai.Ngo,
tom, davem, edumazet, kuba, pabeni, linux-nfs, netdev,
linux-kernel
On Mon, Feb 03, 2025 at 02:07:43AM +0000, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> Commit ec596aaf9b48 ("SUNRPC: Remove code behind
> CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED") was the last user of the
> make_checksum() function.
>
> Remove it.
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SUNRPC: Remove unused make_checksum
2025-02-03 2:07 [PATCH] SUNRPC: Remove unused make_checksum linux
2025-02-03 9:47 ` Simon Horman
@ 2025-02-03 11:17 ` Jeff Layton
2025-02-03 14:32 ` cel
2 siblings, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2025-02-03 11:17 UTC (permalink / raw)
To: linux, trondmy, anna, chuck.lever, neilb, okorniev, Dai.Ngo, tom
Cc: davem, edumazet, kuba, pabeni, horms, linux-nfs, netdev,
linux-kernel
On Mon, 2025-02-03 at 02:07 +0000, linux@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <linux@treblig.org>
>
> Commit ec596aaf9b48 ("SUNRPC: Remove code behind
> CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED") was the last user of the
> make_checksum() function.
>
> Remove it.
>
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
> net/sunrpc/auth_gss/gss_krb5_crypto.c | 90 -------------------------
> net/sunrpc/auth_gss/gss_krb5_internal.h | 4 --
> 2 files changed, 94 deletions(-)
>
> diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
> index 7e09b15c5538..8f2d65c1e831 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
> +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
> @@ -148,96 +148,6 @@ checksummer(struct scatterlist *sg, void *data)
> return crypto_ahash_update(req);
> }
>
> -/*
> - * checksum the plaintext data and hdrlen bytes of the token header
> - * The checksum is performed over the first 8 bytes of the
> - * gss token header and then over the data body
> - */
> -u32
> -make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
> - struct xdr_buf *body, int body_offset, u8 *cksumkey,
> - unsigned int usage, struct xdr_netobj *cksumout)
> -{
> - struct crypto_ahash *tfm;
> - struct ahash_request *req;
> - struct scatterlist sg[1];
> - int err = -1;
> - u8 *checksumdata;
> - unsigned int checksumlen;
> -
> - if (cksumout->len < kctx->gk5e->cksumlength) {
> - dprintk("%s: checksum buffer length, %u, too small for %s\n",
> - __func__, cksumout->len, kctx->gk5e->name);
> - return GSS_S_FAILURE;
> - }
> -
> - checksumdata = kmalloc(GSS_KRB5_MAX_CKSUM_LEN, GFP_KERNEL);
> - if (checksumdata == NULL)
> - return GSS_S_FAILURE;
> -
> - tfm = crypto_alloc_ahash(kctx->gk5e->cksum_name, 0, CRYPTO_ALG_ASYNC);
> - if (IS_ERR(tfm))
> - goto out_free_cksum;
> -
> - req = ahash_request_alloc(tfm, GFP_KERNEL);
> - if (!req)
> - goto out_free_ahash;
> -
> - ahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL);
> -
> - checksumlen = crypto_ahash_digestsize(tfm);
> -
> - if (cksumkey != NULL) {
> - err = crypto_ahash_setkey(tfm, cksumkey,
> - kctx->gk5e->keylength);
> - if (err)
> - goto out;
> - }
> -
> - err = crypto_ahash_init(req);
> - if (err)
> - goto out;
> - sg_init_one(sg, header, hdrlen);
> - ahash_request_set_crypt(req, sg, NULL, hdrlen);
> - err = crypto_ahash_update(req);
> - if (err)
> - goto out;
> - err = xdr_process_buf(body, body_offset, body->len - body_offset,
> - checksummer, req);
> - if (err)
> - goto out;
> - ahash_request_set_crypt(req, NULL, checksumdata, 0);
> - err = crypto_ahash_final(req);
> - if (err)
> - goto out;
> -
> - switch (kctx->gk5e->ctype) {
> - case CKSUMTYPE_RSA_MD5:
> - err = krb5_encrypt(kctx->seq, NULL, checksumdata,
> - checksumdata, checksumlen);
> - if (err)
> - goto out;
> - memcpy(cksumout->data,
> - checksumdata + checksumlen - kctx->gk5e->cksumlength,
> - kctx->gk5e->cksumlength);
> - break;
> - case CKSUMTYPE_HMAC_SHA1_DES3:
> - memcpy(cksumout->data, checksumdata, kctx->gk5e->cksumlength);
> - break;
> - default:
> - BUG();
> - break;
> - }
> - cksumout->len = kctx->gk5e->cksumlength;
> -out:
> - ahash_request_free(req);
> -out_free_ahash:
> - crypto_free_ahash(tfm);
> -out_free_cksum:
> - kfree(checksumdata);
> - return err ? GSS_S_FAILURE : 0;
> -}
> -
> /**
> * gss_krb5_checksum - Compute the MAC for a GSS Wrap or MIC token
> * @tfm: an initialized hash transform
> diff --git a/net/sunrpc/auth_gss/gss_krb5_internal.h b/net/sunrpc/auth_gss/gss_krb5_internal.h
> index 0bda0078d7d8..8769e9e705bf 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_internal.h
> +++ b/net/sunrpc/auth_gss/gss_krb5_internal.h
> @@ -155,10 +155,6 @@ static inline int krb5_derive_key(struct krb5_ctx *kctx,
>
> void krb5_make_confounder(u8 *p, int conflen);
>
> -u32 make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen,
> - struct xdr_buf *body, int body_offset, u8 *cksumkey,
> - unsigned int usage, struct xdr_netobj *cksumout);
> -
> u32 gss_krb5_checksum(struct crypto_ahash *tfm, char *header, int hdrlen,
> const struct xdr_buf *body, int body_offset,
> struct xdr_netobj *cksumout);
> --
> 2.48.1
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] SUNRPC: Remove unused make_checksum
2025-02-03 2:07 [PATCH] SUNRPC: Remove unused make_checksum linux
2025-02-03 9:47 ` Simon Horman
2025-02-03 11:17 ` Jeff Layton
@ 2025-02-03 14:32 ` cel
2 siblings, 0 replies; 4+ messages in thread
From: cel @ 2025-02-03 14:32 UTC (permalink / raw)
To: trondmy, anna, jlayton, neilb, okorniev, Dai.Ngo, tom, linux
Cc: Chuck Lever, davem, edumazet, kuba, pabeni, horms, linux-nfs,
netdev, linux-kernel
From: Chuck Lever <chuck.lever@oracle.com>
On Mon, 03 Feb 2025 02:07:43 +0000, linux@treblig.org wrote:
> Commit ec596aaf9b48 ("SUNRPC: Remove code behind
> CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED") was the last user of the
> make_checksum() function.
>
> Remove it.
>
>
> [...]
Applied to nfsd-testing, thanks!
[1/1] SUNRPC: Remove unused make_checksum
commit: f168d32d0fd2dae44bb438ed6c22d9ab7d9106f7
--
Chuck Lever
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-03 14:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 2:07 [PATCH] SUNRPC: Remove unused make_checksum linux
2025-02-03 9:47 ` Simon Horman
2025-02-03 11:17 ` Jeff Layton
2025-02-03 14:32 ` cel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).