Commit 2818bf81 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Trond Myklebust

rpcgss: krb5: kill checksum_type, miscellaneous small cleanup

Previous changes reveal some obvious cruft.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 5eb064f9
...@@ -77,7 +77,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text, ...@@ -77,7 +77,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
struct xdr_netobj *token) struct xdr_netobj *token)
{ {
struct krb5_ctx *ctx = gss_ctx->internal_ctx_id; struct krb5_ctx *ctx = gss_ctx->internal_ctx_id;
s32 checksum_type;
char cksumdata[16]; char cksumdata[16];
struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata}; struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
unsigned char *ptr, *krb5_hdr, *msg_start; unsigned char *ptr, *krb5_hdr, *msg_start;
...@@ -88,7 +87,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text, ...@@ -88,7 +87,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
now = get_seconds(); now = get_seconds();
checksum_type = CKSUMTYPE_RSA_MD5;
if (ctx->sealalg != SEAL_ALG_NONE && ctx->sealalg != SEAL_ALG_DES) { if (ctx->sealalg != SEAL_ALG_NONE && ctx->sealalg != SEAL_ALG_DES) {
dprintk("RPC: gss_krb5_seal: ctx->sealalg %d not supported\n", dprintk("RPC: gss_krb5_seal: ctx->sealalg %d not supported\n",
ctx->sealalg); ctx->sealalg);
...@@ -110,7 +108,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text, ...@@ -110,7 +108,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
*(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5); *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5);
memset(krb5_hdr + 4, 0xff, 4); memset(krb5_hdr + 4, 0xff, 4);
if (make_checksum(checksum_type, krb5_hdr, 8, text, 0, &md5cksum)) if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, text, 0, &md5cksum))
goto out_err; goto out_err;
if (krb5_encrypt(ctx->seq, NULL, md5cksum.data, if (krb5_encrypt(ctx->seq, NULL, md5cksum.data,
......
...@@ -78,7 +78,6 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx, ...@@ -78,7 +78,6 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,
struct krb5_ctx *ctx = gss_ctx->internal_ctx_id; struct krb5_ctx *ctx = gss_ctx->internal_ctx_id;
int signalg; int signalg;
int sealalg; int sealalg;
s32 checksum_type;
char cksumdata[16]; char cksumdata[16];
struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata}; struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
s32 now; s32 now;
...@@ -115,12 +114,7 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx, ...@@ -115,12 +114,7 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,
if (signalg != SGN_ALG_DES_MAC_MD5) if (signalg != SGN_ALG_DES_MAC_MD5)
goto out; goto out;
/* compute the checksum of the message */ ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8,
/* initialize the the cksum */
checksum_type = CKSUMTYPE_RSA_MD5;
ret = make_checksum(checksum_type, ptr - 2, 8,
message_buffer, 0, &md5cksum); message_buffer, 0, &md5cksum);
if (ret) if (ret)
goto out; goto out;
......
...@@ -120,7 +120,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, ...@@ -120,7 +120,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
struct xdr_buf *buf, struct page **pages) struct xdr_buf *buf, struct page **pages)
{ {
struct krb5_ctx *kctx = ctx->internal_ctx_id; struct krb5_ctx *kctx = ctx->internal_ctx_id;
s32 checksum_type;
char cksumdata[16]; char cksumdata[16];
struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata}; struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
int blocksize = 0, plainlen; int blocksize = 0, plainlen;
...@@ -134,7 +133,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, ...@@ -134,7 +133,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
now = get_seconds(); now = get_seconds();
checksum_type = CKSUMTYPE_RSA_MD5;
if (kctx->sealalg != SEAL_ALG_NONE && kctx->sealalg != SEAL_ALG_DES) { if (kctx->sealalg != SEAL_ALG_NONE && kctx->sealalg != SEAL_ALG_DES) {
dprintk("RPC: gss_krb5_seal: kctx->sealalg %d not supported\n", dprintk("RPC: gss_krb5_seal: kctx->sealalg %d not supported\n",
kctx->sealalg); kctx->sealalg);
...@@ -178,7 +176,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, ...@@ -178,7 +176,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
/* XXXJBF: UGH!: */ /* XXXJBF: UGH!: */
tmp_pages = buf->pages; tmp_pages = buf->pages;
buf->pages = pages; buf->pages = pages;
if (make_checksum(checksum_type, krb5_hdr, 8, buf, if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, buf,
offset + headlen - blocksize, &md5cksum)) offset + headlen - blocksize, &md5cksum))
goto out_err; goto out_err;
buf->pages = tmp_pages; buf->pages = tmp_pages;
...@@ -215,7 +213,6 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf) ...@@ -215,7 +213,6 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
struct krb5_ctx *kctx = ctx->internal_ctx_id; struct krb5_ctx *kctx = ctx->internal_ctx_id;
int signalg; int signalg;
int sealalg; int sealalg;
s32 checksum_type;
char cksumdata[16]; char cksumdata[16];
struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata}; struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
s32 now; s32 now;
...@@ -275,12 +272,7 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf) ...@@ -275,12 +272,7 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
ptr + 22 - (unsigned char *)buf->head[0].iov_base)) ptr + 22 - (unsigned char *)buf->head[0].iov_base))
goto out; goto out;
/* compute the checksum of the message */ ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8, buf,
/* initialize the the cksum */
checksum_type = CKSUMTYPE_RSA_MD5;
ret = make_checksum(checksum_type, ptr - 2, 8, buf,
ptr + 22 - (unsigned char *)buf->head[0].iov_base, &md5cksum); ptr + 22 - (unsigned char *)buf->head[0].iov_base, &md5cksum);
if (ret) if (ret)
goto out; goto out;
......
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