aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/gss_krb5_wrap.c
diff options
context:
space:
mode:
authorKevin Coffman <kwc@citi.umich.edu>2010-03-17 13:02:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:15 -0400
commit1ac3719a2214c545c7e19d34e272a148ca9a24f1 (patch)
treeae1a3f88f85aad50c03cd0960b3fbc392561c673 /net/sunrpc/auth_gss/gss_krb5_wrap.c
parent54ec3d462f3c2a3fe48a7bd592160bee31360087 (diff)
gss_krb5: split up functions in preparation of adding new enctypes
Add encryption type to the krb5 context structure and use it to switch to the correct functions depending on the encryption type. Signed-off-by: Kevin Coffman <kwc@citi.umich.edu> Signed-off-by: Steve Dickson <steved@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss/gss_krb5_wrap.c')
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 5d6c3b12ea70..b45b59b17ae1 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -124,11 +124,10 @@ make_confounder(char *p, u32 conflen)
124 124
125/* XXX factor out common code with seal/unseal. */ 125/* XXX factor out common code with seal/unseal. */
126 126
127u32 127static u32
128gss_wrap_kerberos(struct gss_ctx *ctx, int offset, 128gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,
129 struct xdr_buf *buf, struct page **pages) 129 struct xdr_buf *buf, struct page **pages)
130{ 130{
131 struct krb5_ctx *kctx = ctx->internal_ctx_id;
132 char cksumdata[16]; 131 char cksumdata[16];
133 struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata}; 132 struct xdr_netobj md5cksum = {.len = 0, .data = cksumdata};
134 int blocksize = 0, plainlen; 133 int blocksize = 0, plainlen;
@@ -203,10 +202,9 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
203 return (kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE; 202 return (kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE;
204} 203}
205 204
206u32 205static u32
207gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf) 206gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)
208{ 207{
209 struct krb5_ctx *kctx = ctx->internal_ctx_id;
210 int signalg; 208 int signalg;
211 int sealalg; 209 int sealalg;
212 char cksumdata[16]; 210 char cksumdata[16];
@@ -294,3 +292,31 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
294 292
295 return GSS_S_COMPLETE; 293 return GSS_S_COMPLETE;
296} 294}
295
296u32
297gss_wrap_kerberos(struct gss_ctx *gctx, int offset,
298 struct xdr_buf *buf, struct page **pages)
299{
300 struct krb5_ctx *kctx = gctx->internal_ctx_id;
301
302 switch (kctx->enctype) {
303 default:
304 BUG();
305 case ENCTYPE_DES_CBC_RAW:
306 return gss_wrap_kerberos_v1(kctx, offset, buf, pages);
307 }
308}
309
310u32
311gss_unwrap_kerberos(struct gss_ctx *gctx, int offset, struct xdr_buf *buf)
312{
313 struct krb5_ctx *kctx = gctx->internal_ctx_id;
314
315 switch (kctx->enctype) {
316 default:
317 BUG();
318 case ENCTYPE_DES_CBC_RAW:
319 return gss_unwrap_kerberos_v1(kctx, offset, buf);
320 }
321}
322