aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_gss/gss_krb5_seal.c
diff options
context:
space:
mode:
authorKevin Coffman <kwc@citi.umich.edu>2010-03-17 13:02:52 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-05-14 15:09:16 -0400
commite1f6c07b1160ef28e8754d12e6c03288dd9d5ca8 (patch)
tree5be1f97a1a51feaed4bed2b4a83a568c94921faf /net/sunrpc/auth_gss/gss_krb5_seal.c
parent81d4a4333a1dfd6070f046265d928bb4c79aff88 (diff)
gss_krb5: add ability to have a keyed checksum (hmac)
Encryption types besides DES may use a keyed checksum (hmac). Modify the make_checksum() function to allow for a key and take care of enctype-specific processing such as truncating the resulting hash. 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_seal.c')
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index 46c6f44e5c3f..cd512719092b 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -101,6 +101,7 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,
101 void *ptr; 101 void *ptr;
102 s32 now; 102 s32 now;
103 u32 seq_send; 103 u32 seq_send;
104 u8 *cksumkey;
104 105
105 dprintk("RPC: %s\n", __func__); 106 dprintk("RPC: %s\n", __func__);
106 BUG_ON(ctx == NULL); 107 BUG_ON(ctx == NULL);
@@ -109,15 +110,15 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,
109 110
110 ptr = setup_token(ctx, token); 111 ptr = setup_token(ctx, token);
111 112
112 if (make_checksum((char *)ctx->gk5e->cksum_name, ptr, 8, 113 if (ctx->gk5e->keyed_cksum)
113 text, 0, &md5cksum)) 114 cksumkey = ctx->cksum;
114 return GSS_S_FAILURE; 115 else
116 cksumkey = NULL;
115 117
116 if (krb5_encrypt(ctx->seq, NULL, md5cksum.data, 118 if (make_checksum(ctx, ptr, 8, text, 0, cksumkey, &md5cksum))
117 md5cksum.data, md5cksum.len))
118 return GSS_S_FAILURE; 119 return GSS_S_FAILURE;
119 120
120 memcpy(ptr + GSS_KRB5_TOK_HDR_LEN, md5cksum.data + md5cksum.len - 8, 8); 121 memcpy(ptr + GSS_KRB5_TOK_HDR_LEN, md5cksum.data, md5cksum.len);
121 122
122 spin_lock(&krb5_seq_lock); 123 spin_lock(&krb5_seq_lock);
123 seq_send = ctx->seq_send++; 124 seq_send = ctx->seq_send++;