Commit b36e9c44 authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust

sunrpc: clean up sparse endianness warnings in gss_krb5_wrap.c

Fix the endianness handling in gss_wrap_kerberos_v1 and drop the memset
call there in favor of setting the filler bytes directly.

In gss_wrap_kerberos_v2, get rid of the "ec" variable which is always
zero, and drop the endianness conversion of 0. Sparse handles 0 as a
special case, so it's not necessary.
Signed-off-by: default avatarJeff Layton <jlayton@primarydata.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 6ac0fbbf
...@@ -201,9 +201,15 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, ...@@ -201,9 +201,15 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,
msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength; msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength;
*(__be16 *)(ptr + 2) = cpu_to_le16(kctx->gk5e->signalg); /*
memset(ptr + 4, 0xff, 4); * signalg and sealalg are stored as if they were converted from LE
*(__be16 *)(ptr + 4) = cpu_to_le16(kctx->gk5e->sealalg); * to host endian, even though they're opaque pairs of bytes according
* to the RFC.
*/
*(__le16 *)(ptr + 2) = cpu_to_le16(kctx->gk5e->signalg);
*(__le16 *)(ptr + 4) = cpu_to_le16(kctx->gk5e->sealalg);
ptr[6] = 0xff;
ptr[7] = 0xff;
gss_krb5_make_confounder(msg_start, conflen); gss_krb5_make_confounder(msg_start, conflen);
...@@ -438,7 +444,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, ...@@ -438,7 +444,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset,
u8 *ptr, *plainhdr; u8 *ptr, *plainhdr;
s32 now; s32 now;
u8 flags = 0x00; u8 flags = 0x00;
__be16 *be16ptr, ec = 0; __be16 *be16ptr;
__be64 *be64ptr; __be64 *be64ptr;
u32 err; u32 err;
...@@ -468,16 +474,16 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, ...@@ -468,16 +474,16 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset,
be16ptr = (__be16 *)ptr; be16ptr = (__be16 *)ptr;
blocksize = crypto_blkcipher_blocksize(kctx->acceptor_enc); blocksize = crypto_blkcipher_blocksize(kctx->acceptor_enc);
*be16ptr++ = cpu_to_be16(ec); *be16ptr++ = 0;
/* "inner" token header always uses 0 for RRC */ /* "inner" token header always uses 0 for RRC */
*be16ptr++ = cpu_to_be16(0); *be16ptr++ = 0;
be64ptr = (__be64 *)be16ptr; be64ptr = (__be64 *)be16ptr;
spin_lock(&krb5_seq_lock); spin_lock(&krb5_seq_lock);
*be64ptr = cpu_to_be64(kctx->seq_send64++); *be64ptr = cpu_to_be64(kctx->seq_send64++);
spin_unlock(&krb5_seq_lock); spin_unlock(&krb5_seq_lock);
err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, ec, pages); err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, 0, pages);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment