diff options
author | J. Bruce Fields <bfields@fieldses.org> | 2006-12-04 20:22:38 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-12-06 10:46:46 -0500 |
commit | ca54f896454852f0bc8d50e6e4c55d9defedbd0a (patch) | |
tree | f4d3c245f1b0e6edc38e4b9348d54f9f95028827 /net/sunrpc | |
parent | 2818bf81a8c91fb29634df68bdc3cc5e003201d0 (diff) | |
download | blackbird-op-linux-ca54f896454852f0bc8d50e6e4c55d9defedbd0a.tar.gz blackbird-op-linux-ca54f896454852f0bc8d50e6e4c55d9defedbd0a.zip |
rpcgss: simplify make_checksum
We're doing some pointless translation between krb5 constants and kernel
crypto string names.
Also clean up some related spkm3 code as necessary.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_crypto.c | 12 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_seal.c | 2 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_unseal.c | 3 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 |
4 files changed, 5 insertions, 16 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c index 10d05ea37213..d926cda88623 100644 --- a/net/sunrpc/auth_gss/gss_krb5_crypto.c +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c @@ -130,23 +130,13 @@ checksummer(struct scatterlist *sg, void *data) /* checksum the plaintext data and hdrlen bytes of the token header */ s32 -make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, +make_checksum(char *cksumname, char *header, int hdrlen, struct xdr_buf *body, int body_offset, struct xdr_netobj *cksum) { - char *cksumname; struct hash_desc desc; /* XXX add to ctx? */ struct scatterlist sg[1]; int err; - switch (cksumtype) { - case CKSUMTYPE_RSA_MD5: - cksumname = "md5"; - break; - default: - dprintk("RPC: krb5_make_checksum:" - " unsupported checksum %d", cksumtype); - return GSS_S_FAILURE; - } desc.tfm = crypto_alloc_hash(cksumname, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(desc.tfm)) return GSS_S_FAILURE; diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c index 2bc22776be55..c187f7f1520f 100644 --- a/net/sunrpc/auth_gss/gss_krb5_seal.c +++ b/net/sunrpc/auth_gss/gss_krb5_seal.c @@ -108,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); memset(krb5_hdr + 4, 0xff, 4); - if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, text, 0, &md5cksum)) + if (make_checksum("md5", krb5_hdr, 8, text, 0, &md5cksum)) goto out_err; if (krb5_encrypt(ctx->seq, NULL, md5cksum.data, diff --git a/net/sunrpc/auth_gss/gss_krb5_unseal.c b/net/sunrpc/auth_gss/gss_krb5_unseal.c index 60469d9ab226..62807ac1e2ca 100644 --- a/net/sunrpc/auth_gss/gss_krb5_unseal.c +++ b/net/sunrpc/auth_gss/gss_krb5_unseal.c @@ -114,8 +114,7 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx, if (signalg != SGN_ALG_DES_MAC_MD5) goto out; - ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8, - message_buffer, 0, &md5cksum); + ret = make_checksum("md5", ptr - 2, 8, message_buffer, 0, &md5cksum); if (ret) goto out; diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index 206937187274..6d508d77adf9 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c @@ -176,7 +176,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, /* XXXJBF: UGH!: */ tmp_pages = buf->pages; buf->pages = pages; - if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, buf, + if (make_checksum("md5", krb5_hdr, 8, buf, offset + headlen - blocksize, &md5cksum)) goto out_err; buf->pages = tmp_pages; @@ -272,7 +272,7 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf) ptr + 22 - (unsigned char *)buf->head[0].iov_base)) goto out; - ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8, buf, + ret = make_checksum("md5", ptr - 2, 8, buf, ptr + 22 - (unsigned char *)buf->head[0].iov_base, &md5cksum); if (ret) goto out; |