From: "J. Bruce Fields" <bfields@fieldses.org>
To: Kevin Coffman <kwc@citi.umich.edu>
Cc: linux-nfs@vger.kernel.org, aglo@citi.umich.edu
Subject: Re: [PATCH 03/19] sunrpc: make token header values less confusing
Date: Wed, 12 Mar 2008 12:31:04 -0400 [thread overview]
Message-ID: <20080312163104.GC10015@fieldses.org> (raw)
In-Reply-To: <20080221184402.19195.57873.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
On Thu, Feb 21, 2008 at 01:44:02PM -0500, Kevin Coffman wrote:
> g_make_token_header() and g_token_size() add two too many, and
> therefore their callers pass in "(logical_value - 2)" rather
> than "logical_value" as hard-coded values which causes confusion.
>
> This dates back to the original g_make_token_header which took an
> optional token type (token_id) value and added it to the token.
> This was removed, but the routine always adds room for the token_id
> rather than not.
Looks fine, thanks, but:
>
> Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
> ---
>
> net/sunrpc/auth_gss/gss_generic_token.c | 4 ++--
> net/sunrpc/auth_gss/gss_krb5_seal.c | 4 ++--
> net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++--
> net/sunrpc/auth_gss/gss_spkm3_seal.c | 2 +-
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/net/sunrpc/auth_gss/gss_generic_token.c b/net/sunrpc/auth_gss/gss_generic_token.c
> index ea8c92e..d83b881 100644
> --- a/net/sunrpc/auth_gss/gss_generic_token.c
> +++ b/net/sunrpc/auth_gss/gss_generic_token.c
> @@ -148,7 +148,7 @@ int
> g_token_size(struct xdr_netobj *mech, unsigned int body_size)
> {
> /* set body_size to sequence contents size */
> - body_size += 4 + (int) mech->len; /* NEED overflow check */
> + body_size += 2 + (int) mech->len; /* NEED overflow check */
> return(1 + der_length_size(body_size) + body_size);
> }
>
> @@ -161,7 +161,7 @@ void
> g_make_token_header(struct xdr_netobj *mech, int body_size, unsigned char **buf)
> {
> *(*buf)++ = 0x60;
> - der_write_length(buf, 4 + mech->len + body_size);
> + der_write_length(buf, 2 + mech->len + body_size);
> *(*buf)++ = 0x06;
> *(*buf)++ = (unsigned char) mech->len;
> TWRITE_STR(*buf, mech->data, ((int) mech->len));
> diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
> index dedcbd6..b2fa785 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_seal.c
> +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
> @@ -87,10 +87,10 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
>
> now = get_seconds();
>
> - token->len = g_token_size(&ctx->mech_used, 22);
> + token->len = g_token_size(&ctx->mech_used, 24);
>
> ptr = token->data;
> - g_make_token_header(&ctx->mech_used, 22, &ptr);
> + g_make_token_header(&ctx->mech_used, 24, &ptr);
>
> *ptr++ = (unsigned char) ((KG_TOK_MIC_MSG>>8)&0xff);
> *ptr++ = (unsigned char) (KG_TOK_MIC_MSG&0xff);
> diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
> index 3bdc527..a2c92f1 100644
> --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
> +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
> @@ -137,7 +137,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
> BUG_ON((buf->len - offset) % blocksize);
> plainlen = blocksize + buf->len - offset;
>
> - headlen = g_token_size(&kctx->mech_used, 22 + plainlen) -
> + headlen = g_token_size(&kctx->mech_used, 24 + plainlen) -
> (buf->len - offset);
>
> ptr = buf->head[0].iov_base + offset;
> @@ -149,7 +149,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
> buf->len += headlen;
> BUG_ON((buf->len - offset - headlen) % blocksize);
>
> - g_make_token_header(&kctx->mech_used, 22 + plainlen, &ptr);
> + g_make_token_header(&kctx->mech_used, 24 + plainlen, &ptr);
>
>
> *ptr++ = (unsigned char) ((KG_TOK_WRAP_MSG>>8)&0xff);
> diff --git a/net/sunrpc/auth_gss/gss_spkm3_seal.c b/net/sunrpc/auth_gss/gss_spkm3_seal.c
> index abf17ce..88505d5 100644
> --- a/net/sunrpc/auth_gss/gss_spkm3_seal.c
> +++ b/net/sunrpc/auth_gss/gss_spkm3_seal.c
> @@ -104,7 +104,7 @@ spkm3_make_token(struct spkm3_ctx *ctx,
> goto out_err;
>
> asn1_bitstring_len(&md5cksum, &md5elen, &md5zbit);
> - tokenlen = 10 + ctxelen + 1 + md5elen + 1;
> + tokenlen = 12 + ctxelen + 1 + md5elen + 1;
>
> /* Create token header using generic routines */
> token->len = g_token_size(&ctx->mech_used, tokenlen);
Could you double-check this spkm3 case? It looks like tokenlen is
passed to spkm3_make_mic_token as well as the two functions you've
modified.
--b.
next prev parent reply other threads:[~2008-03-12 16:31 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 18:43 [PATCH 00/19] RFC add kernel support for newer encrytpion types Kevin Coffman
[not found] ` <20080221184208.19195.94518.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-02-21 18:43 ` [PATCH 01/19] crypto: Add CTS mode required for Kerberos AES support Kevin Coffman
2008-02-21 18:43 ` [PATCH 02/19] rpc: gss: Add oid values to the gss_api mechanism structures Kevin Coffman
2008-02-21 18:44 ` [PATCH 03/19] sunrpc: make token header values less confusing Kevin Coffman
[not found] ` <20080221184402.19195.57873.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-03-12 16:31 ` J. Bruce Fields [this message]
2008-03-12 16:44 ` Kevin Coffman
2008-02-21 18:44 ` [PATCH 04/19] Add new pipefs file indicating which Kerberos enctypes the kernel supports Kevin Coffman
[not found] ` <20080221184407.19195.62074.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-03-12 16:37 ` J. Bruce Fields
2008-02-21 18:44 ` [PATCH 05/19] Correct grammer/typos in dprintks Kevin Coffman
[not found] ` <20080221184412.19195.93743.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-03-12 16:38 ` J. Bruce Fields
2008-02-21 18:44 ` [PATCH 06/19] Use get_random_bytes() to create confounder Kevin Coffman
[not found] ` <20080221184417.19195.55123.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-03-12 16:46 ` J. Bruce Fields
2008-03-12 17:50 ` Matt Mackall
2008-03-12 18:03 ` J. Bruce Fields
2008-03-12 18:37 ` Kevin Coffman
[not found] ` <4d569c330803121137w755c5c76j4b692aac53d54619-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-03-12 18:39 ` J. Bruce Fields
2008-03-12 18:53 ` Matt Mackall
2008-02-21 18:44 ` [PATCH 07/19] Don't expect blocksize to always be 8 when calculating padding Kevin Coffman
2008-02-21 18:44 ` [PATCH 08/19] Remove define for KRB5_CKSUM_LENGTH, which will become enctype-dependent Kevin Coffman
[not found] ` <20080221184427.19195.16243.stgit-zTNJhAanYLVZN1qrTdtDg5Vzexx5G7lz@public.gmane.org>
2008-03-12 18:54 ` J. Bruce Fields
2008-02-21 18:44 ` [PATCH 09/19] gss_krb5: split up functions in preparation of adding new enctypes Kevin Coffman
2008-02-21 18:44 ` [PATCH 10/19] gss_krb5: prepare for new context format Kevin Coffman
2008-02-21 18:44 ` [PATCH 11/19] gss_krb5: introduce encryption type framework Kevin Coffman
2008-02-21 18:44 ` [PATCH 12/19] gss_krb5: add ability to have a keyed checksum (hmac) Kevin Coffman
2008-02-21 18:44 ` [PATCH 13/19] gss_krb5: import functionality to derive keys into the kernel Kevin Coffman
2008-02-21 18:44 ` [PATCH 14/19] gss_krb5: use a global static OID value for krb5 Kevin Coffman
2008-02-21 18:45 ` [PATCH 15/19] gss_krb5: handle new context format from gssd Kevin Coffman
2008-02-21 18:45 ` [PATCH 16/19] gss_krb5: add support for triple-des encryption Kevin Coffman
2008-02-21 18:45 ` [PATCH 17/19] xdr: add a new utility function to shift the head data of an xdr buffer Kevin Coffman
2008-02-21 18:45 ` [PATCH 18/19] gss_krb5: add support for new token formats in rfc4121 Kevin Coffman
2008-02-21 18:45 ` [PATCH 19/19] gss_krb5: add remaining pieces to enable AES encryption support Kevin Coffman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080312163104.GC10015@fieldses.org \
--to=bfields@fieldses.org \
--cc=aglo@citi.umich.edu \
--cc=kwc@citi.umich.edu \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox