]> err.no Git - linux-2.6/commitdiff
SUNRPC: Update the spkm3 code to use the make_checksum interface
authorJ. Bruce Fields <bfields@fieldses.org>
Tue, 3 Jan 2006 08:56:00 +0000 (09:56 +0100)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 6 Jan 2006 19:58:59 +0000 (14:58 -0500)
 Also update the tokenlen calculations to accomodate g_token_size().

Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
include/linux/sunrpc/gss_spkm3.h
net/sunrpc/auth_gss/gss_spkm3_seal.c
net/sunrpc/auth_gss/gss_spkm3_token.c
net/sunrpc/auth_gss/gss_spkm3_unseal.c

index 0beb2cf00a8401b55bd6bad5430cb85960815cb1..336e218c2782786c3fc5e6899bba8dcbc5723404 100644 (file)
@@ -48,7 +48,7 @@ u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struc
 #define CKSUMTYPE_RSA_MD5            0x0007
 
 s32 make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body,
-                   struct xdr_netobj *cksum);
+                   int body_offset, struct xdr_netobj *cksum);
 void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits);
 int decode_asn1_bitstring(struct xdr_netobj *out, char *in, int enclen, 
                    int explen);
index d1e12b25d6e21f2b4e205c49b3ddd0d0fb7580b6..86fbf7c3e39ca0e96fd7b31f17bceb9f068b1ce8 100644 (file)
@@ -59,7 +59,7 @@ spkm3_make_token(struct spkm3_ctx *ctx,
        char                    tokhdrbuf[25];
        struct xdr_netobj       md5cksum = {.len = 0, .data = NULL};
        struct xdr_netobj       mic_hdr = {.len = 0, .data = tokhdrbuf};
-       int                     tmsglen, tokenlen = 0;
+       int                     tokenlen = 0;
        unsigned char           *ptr;
        s32                     now;
        int                     ctxelen = 0, ctxzbit = 0;
@@ -92,24 +92,23 @@ spkm3_make_token(struct spkm3_ctx *ctx,
        }
 
        if (toktype == SPKM_MIC_TOK) {
-               tmsglen = 0;
                /* Calculate checksum over the mic-header */
                asn1_bitstring_len(&ctx->ctx_id, &ctxelen, &ctxzbit);
                spkm3_mic_header(&mic_hdr.data, &mic_hdr.len, ctx->ctx_id.data,
                                         ctxelen, ctxzbit);
 
                if (make_checksum(checksum_type, mic_hdr.data, mic_hdr.len, 
-                                            text, &md5cksum))
+                                            text, 0, &md5cksum))
                        goto out_err;
 
                asn1_bitstring_len(&md5cksum, &md5elen, &md5zbit);
-               tokenlen = 10 + ctxelen + 1 + 2 + md5elen + 1;
+               tokenlen = 10 + ctxelen + 1 + md5elen + 1;
 
                /* Create token header using generic routines */
-               token->len = g_token_size(&ctx->mech_used, tokenlen + tmsglen);
+               token->len = g_token_size(&ctx->mech_used, tokenlen);
 
                ptr = token->data;
-               g_make_token_header(&ctx->mech_used, tokenlen + tmsglen, &ptr);
+               g_make_token_header(&ctx->mech_used, tokenlen, &ptr);
 
                spkm3_make_mic_token(&ptr, tokenlen, &mic_hdr, &md5cksum, md5elen, md5zbit);
        } else if (toktype == SPKM_WRAP_TOK) { /* Not Supported */
index 1f824578d773691c17c67daa6f76e9096730a789..af0d7ce7468682cfe6d6324e8a2a7a220d64698f 100644 (file)
@@ -182,6 +182,7 @@ spkm3_mic_header(unsigned char **hdrbuf, unsigned int *hdrlen, unsigned char *ct
  * *tokp points to the beginning of the SPKM_MIC token  described 
  * in rfc 2025, section 3.2.1: 
  *
+ * toklen is the inner token length
  */
 void
 spkm3_make_mic_token(unsigned char **tokp, int toklen, struct xdr_netobj *mic_hdr, struct xdr_netobj *md5cksum, int md5elen, int md5zbit)
@@ -189,7 +190,7 @@ spkm3_make_mic_token(unsigned char **tokp, int toklen, struct xdr_netobj *mic_hd
        unsigned char *ict = *tokp;
 
        *(u8 *)ict++ = 0xa4;
-       *(u8 *)ict++ = toklen - 2; 
+       *(u8 *)ict++ = toklen;
        memcpy(ict, mic_hdr->data, mic_hdr->len);
        ict += mic_hdr->len;
 
index 241d5b30dfcbcfb851093856f88b79698da35a81..96851b0ba1bab7758a55704d845a027f9b4e8c8f 100644 (file)
@@ -95,7 +95,7 @@ spkm3_read_token(struct spkm3_ctx *ctx,
                ret = GSS_S_DEFECTIVE_TOKEN;
                code = make_checksum(CKSUMTYPE_RSA_MD5, ptr + 2, 
                                        mic_hdrlen + 2, 
-                                       message_buffer, &md5cksum);
+                                       message_buffer, 0, &md5cksum);
 
                if (code)
                        goto out;