aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@fieldses.org>2006-12-04 20:22:38 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-06 10:46:46 -0500
commitca54f896454852f0bc8d50e6e4c55d9defedbd0a (patch)
treef4d3c245f1b0e6edc38e4b9348d54f9f95028827 /net/sunrpc/auth_gss
parent2818bf81a8c91fb29634df68bdc3cc5e003201d0 (diff)
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/auth_gss')
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c12
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c2
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_unseal.c3
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c4
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)
130 130
131/* checksum the plaintext data and hdrlen bytes of the token header */ 131/* checksum the plaintext data and hdrlen bytes of the token header */
132s32 132s32
133make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, 133make_checksum(char *cksumname, char *header, int hdrlen, struct xdr_buf *body,
134 int body_offset, struct xdr_netobj *cksum) 134 int body_offset, struct xdr_netobj *cksum)
135{ 135{
136 char *cksumname;
137 struct hash_desc desc; /* XXX add to ctx? */ 136 struct hash_desc desc; /* XXX add to ctx? */
138 struct scatterlist sg[1]; 137 struct scatterlist sg[1];
139 int err; 138 int err;
140 139
141 switch (cksumtype) {
142 case CKSUMTYPE_RSA_MD5:
143 cksumname = "md5";
144 break;
145 default:
146 dprintk("RPC: krb5_make_checksum:"
147 " unsupported checksum %d", cksumtype);
148 return GSS_S_FAILURE;
149 }
150 desc.tfm = crypto_alloc_hash(cksumname, 0, CRYPTO_ALG_ASYNC); 140 desc.tfm = crypto_alloc_hash(cksumname, 0, CRYPTO_ALG_ASYNC);
151 if (IS_ERR(desc.tfm)) 141 if (IS_ERR(desc.tfm))
152 return GSS_S_FAILURE; 142 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,
108 *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5); 108 *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5);
109 memset(krb5_hdr + 4, 0xff, 4); 109 memset(krb5_hdr + 4, 0xff, 4);
110 110
111 if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, text, 0, &md5cksum)) 111 if (make_checksum("md5", krb5_hdr, 8, text, 0, &md5cksum))
112 goto out_err; 112 goto out_err;
113 113
114 if (krb5_encrypt(ctx->seq, NULL, md5cksum.data, 114 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,
114 if (signalg != SGN_ALG_DES_MAC_MD5) 114 if (signalg != SGN_ALG_DES_MAC_MD5)
115 goto out; 115 goto out;
116 116
117 ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8, 117 ret = make_checksum("md5", ptr - 2, 8, message_buffer, 0, &md5cksum);
118 message_buffer, 0, &md5cksum);
119 if (ret) 118 if (ret)
120 goto out; 119 goto out;
121 120
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,
176 /* XXXJBF: UGH!: */ 176 /* XXXJBF: UGH!: */
177 tmp_pages = buf->pages; 177 tmp_pages = buf->pages;
178 buf->pages = pages; 178 buf->pages = pages;
179 if (make_checksum(CKSUMTYPE_RSA_MD5, krb5_hdr, 8, buf, 179 if (make_checksum("md5", krb5_hdr, 8, buf,
180 offset + headlen - blocksize, &md5cksum)) 180 offset + headlen - blocksize, &md5cksum))
181 goto out_err; 181 goto out_err;
182 buf->pages = tmp_pages; 182 buf->pages = tmp_pages;
@@ -272,7 +272,7 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
272 ptr + 22 - (unsigned char *)buf->head[0].iov_base)) 272 ptr + 22 - (unsigned char *)buf->head[0].iov_base))
273 goto out; 273 goto out;
274 274
275 ret = make_checksum(CKSUMTYPE_RSA_MD5, ptr - 2, 8, buf, 275 ret = make_checksum("md5", ptr - 2, 8, buf,
276 ptr + 22 - (unsigned char *)buf->head[0].iov_base, &md5cksum); 276 ptr + 22 - (unsigned char *)buf->head[0].iov_base, &md5cksum);
277 if (ret) 277 if (ret)
278 goto out; 278 goto out;