Add new enctypes for gss_krb5 (Round 5)
Subsystems (3)
cover Add new enctypes for gss_krb5 (Round 5)
From: Steve Dickson <[email protected]>
Here is the next round of Kevin Coffman's encryption patches. This series includes all of the review comments from the previous posting except for one.
Its the question as to why there were two occurrences of GSS_KRB5_TOK_HDR_LEN define in the GSS_KRB5_MAX_SLACK_NEEDED macro. Since Kevin is traveling and the reason didn't seem obvious plus I didn't see it as being a showstopper (due to all the recent testing), I decided to proceed as. If later its deemed a supplemental patch is needed, I'll post the patch
Again, the details of the original patches are at:
http://marc.info/?l=linux-nfs&m=121010783625159&w=2
steved.
J. Bruce Fields (1):
gss_krb5: Don't expect blocksize to always be 8 when calculating
padding
Kevin Coffman (21):
gss_krb5: Introduce encryption type framework
gss_krb5: Added and improved code comments
gss_krb5: split up functions in preparation of adding new enctypes
gss_krb5: prepare for new context format
gss_krb5: introduce encryption type framework
gss_krb5: add ability to have a keyed checksum (hmac)
gss_krb5: import functionality to derive keys into the kernel
gss_krb5: handle new context format from gssd
gss_krb5: add support for triple-des encryption
Add new pipefs file indicating which Kerberos enctypes the kernel
supports
Update pipefs file indicating which Kerberos enctypes the kernel
supports
xdr: Add an export for the helper function write_bytes_to_xdr_buf()
gss_krb5: add support for new token formats in rfc4121
gss_krb5: add remaining pieces to enable AES encryption support
gss_krb5: Update pipefs file
gssd_krb5: arcfour-hmac support
gss_krb5: Save the raw session key in the context
gssd_krb5: More arcfour-hmac support
gss_krb5: Use confounder length in wrap code
gss_krb5: Add support for rc4-hmac encryption
Update the pipefs file
Peter Staubach (1):
Fixed a typo in gss_verify_mic_v2()
include/linux/sunrpc/gss_krb5.h | 183 +++++++++- net/sunrpc/auth_gss/Makefile | 2 +- net/sunrpc/auth_gss/auth_gss.c | 14 +- net/sunrpc/auth_gss/gss_krb5_crypto.c | 697 ++++++++++++++++++++++++++++++++- net/sunrpc/auth_gss/gss_krb5_keys.c | 335 ++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 582 +++++++++++++++++++++++++-- net/sunrpc/auth_gss/gss_krb5_seal.c | 155 ++++++-- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 83 ++++- net/sunrpc/auth_gss/gss_krb5_unseal.c | 113 +++++- net/sunrpc/auth_gss/gss_krb5_wrap.c | 473 ++++++++++++++++++++--- net/sunrpc/auth_gss/gss_mech_switch.c | 14 + net/sunrpc/auth_gss/svcauth_gss.c | 15 + net/sunrpc/rpc_pipe.c | 27 ++ net/sunrpc/xdr.c | 1 + 14 files changed, 2527 insertions(+), 167 deletions(-) create mode 100644 net/sunrpc/auth_gss/gss_krb5_keys.c
PATCH 1/23 gss_krb5: Introduce encryption type framework
From: Kevin Coffman <[email protected]>
Make the client and server code consistent regarding the extra buffer space made available for the auth code when wrapping data.
Add some comments/documentation about the available buffer space in the xdr_buf head and tail when gss_wrap is called.
Add a compile-time check to make sure we are not exceeding the available buffer space.
Add a central function to shift head data.
--- include/linux/sunrpc/gss_krb5.h | 25 +++++++++++++++++++++ net/sunrpc/auth_gss/auth_gss.c | 2 +- net/sunrpc/auth_gss/gss_krb5_crypto.c | 38 +++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_wrap.c | 6 +--- 4 files changed, 66 insertions(+), 5 deletions(-)
include/linux/sunrpc/gss_krb5.h +25 -0
@@ -40,6 +40,12 @@#include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_asn1.h> +/* Maximum checksum function output for the supported crypto algorithms */ +#define GSS_KRB5_MAX_CKSUM_LEN (20) + +/* Maximum blocksize for the supported crypto algorithms */ +#define GSS_KRB5_MAX_BLOCKSIZE (16) +struct krb5_ctx {int initiate;/* 1 = initiating, 0 = accepting */ struct crypto_blkcipher *enc;
@@ -113,6 +119,22 @@ enum seal_alg {#define ENCTYPE_DES3_CBC_SHA1 0x0010#define ENCTYPE_UNKNOWN 0x01ff +/* +* This compile-time check verifies that we will not exceed the +* slack space allotted by the client and server auth_gss code +* before they call gss_wrap(). +*/ +#define GSS_KRB5_MAX_SLACK_NEEDED \ + GSS_KRB5_TOK_HDR_LEN/* gss token header */ \ + +GSS_KRB5_MAX_CKSUM_LEN /* gss token checksum */ \ + +GSS_KRB5_MAX_BLOCKSIZE /* confounder */ \ + +GSS_KRB5_MAX_BLOCKSIZE /* possible padding */ \ + +GSS_KRB5_TOK_HDR_LEN /* encrypted hdr in v2 token */ \ + +GSS_KRB5_MAX_CKSUM_LEN /* encryption hmac */ \ + +4 +4 /* RPC verifier */ \ + +GSS_KRB5_TOK_HDR_LEN \ + + GSS_KRB5_MAX_CKSUM_LEN +s32 make_checksum (char *,char *header,int hdrlen,struct xdr_buf *body,int body_offset,struct xdr_netobj *cksum);
@@ -157,3 +179,6 @@ s32 krb5_get_seq_num(struct crypto_blkcipher *key, unsigned char *cksum, unsigned char *buf, int *direction, u32 *seqnum); + +int +xdr_extend_head (struct xdr_buf *buf,unsigned int base,unsigned int shiftlen);
net/sunrpc/auth_gss/auth_gss.c +1 -1
@@ -61,7 +61,7 @@ static const struct rpc_credops gss_nullops;# define RPCDBG_FACILITY RPCDBG_AUTH#endif -#define GSS_CRED_SLACK 1024 +#define GSS_CRED_SLACK (RPC_MAX_AUTH_SIZE * 2)/* length of a krb5 verifier (48), plus data added before arguments when * using integrity (two 4-byte integers): */ #define GSS_VERF_SLACK 100
net/sunrpc/auth_gss/gss_krb5_crypto.c +38 -0
@@ -326,3 +326,41 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf,return xdr_process_buf (buf, offset, buf->len - offset, decryptor, &desc); } + +/* +* This function makes the assumption that it was ultimately called +* from gss_wrap(). +* +* The client auth_gss code moves any existing tail data into a +* separate page before calling gss_wrap. +* The server svcauth_gss code ensures that both the head and the +* tail have slack space of RPC_MAX_AUTH_SIZE before calling gss_wrap. +* +* Even with that guarantee, this function may be called more than +* once in the processing of gss_wrap(). The best we can do is +* verify at compile-time (see GSS_KRB5_SLACK_CHECK) that the +* largest expected shift will fit within RPC_MAX_AUTH_SIZE. +* At run-time we can verify that a single invocation of this +* function doesn't attempt to use more the RPC_MAX_AUTH_SIZE. +*/ + +int +xdr_extend_head (struct xdr_buf *buf,unsigned int base,unsigned int shiftlen) +{ +u8 *p; + +if (shiftlen ==0 ) +return 0 ; + +BUILD_BUG_ON (GSS_KRB5_MAX_SLACK_NEEDED >RPC_MAX_AUTH_SIZE ); +BUG_ON (shiftlen >RPC_MAX_AUTH_SIZE ); + + p = buf->head[0 ].iov_base + base; + +memmove (p + shiftlen, p, buf->head[0 ].iov_len - base); + + buf->head[0 ].iov_len += shiftlen; + buf->len += shiftlen; + +return 0 ; +}
net/sunrpc/auth_gss/gss_krb5_wrap.c +2 -4
@@ -156,11 +156,9 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset, ptr = buf->head[0 ].iov_base + offset;/* shift data to make room for header. */ +xdr_extend_head (buf, offset, headlen); +/* XXX Would be cleverer to encrypt while copying. */ -/* XXX bounds checking, slack, etc. */ -memmove (ptr + headlen, ptr, buf->head[0 ].iov_len - offset); - buf->head[0 ].iov_len += headlen; - buf->len += headlen;BUG_ON ((buf->len - offset - headlen) % blocksize); g_make_token_header(&kctx->mech_used,
Signature · 1 line
1.6.6.1
PATCH 2/23 gss_krb5: Added and improved code comments
In reply to [email protected]From: Kevin Coffman <[email protected]>
--- net/sunrpc/auth_gss/auth_gss.c | 12 +++++++++--- net/sunrpc/auth_gss/gss_mech_switch.c | 14 ++++++++++++++ net/sunrpc/auth_gss/svcauth_gss.c | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +9 -3
@@ -1317,15 +1317,21 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, inpages = snd_buf->pages + first; snd_buf->pages = rqstp->rq_enc_pages; snd_buf->page_base -= first <<PAGE_CACHE_SHIFT ; -/* Give the tail its own page, in case we need extra space in the -* head when wrapping: */ +/* +* Give the tail its own page, in case we need extra space in the +* head when wrapping: +* +* call_allocate() allocates twice the slack space required +* by the authentication flavor to rq_callsize. +* For GSS, slack is GSS_CRED_SLACK. +*/ if (snd_buf->page_len || snd_buf->tail[0 ].iov_len) { tmp =page_address (rqstp->rq_enc_pages[rqstp->rq_enc_pages_num -1 ]);memcpy (tmp, snd_buf->tail[0 ].iov_base, snd_buf->tail[0 ].iov_len); snd_buf->tail[0 ].iov_base = tmp; } maj_stat =gss_wrap (ctx->gc_gss_ctx, offset, snd_buf, inpages); -/* RPC_SLACK_SPACE should prevent this ever happening: */ +/* slack space should prevent this ever happening: */ BUG_ON (snd_buf->len > snd_buf->buflen); status = -EIO ;/* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was
net/sunrpc/auth_gss/gss_mech_switch.c +14 -0
@@ -285,6 +285,20 @@ gss_verify_mic(struct gss_ctx *context_handle, mic_token); } +/* +* This function is called from both the client and server code. +* Each makes guarantees about how much "slack" space is available +* for the underlying function in "buf"'s head and tail while +* performing the wrap. +* +* The client and server code allocate RPC_MAX_AUTH_SIZE extra +* space in both the head and tail which is available for use by +* the wrap function. +* +* Underlying functions should verify they do not use more than +* RPC_MAX_AUTH_SIZE of extra space in either the head or tail +* when performing the wrap. +*/ u32 gss_wrap(struct gss_ctx *ctx_id, int offset,
net/sunrpc/auth_gss/svcauth_gss.c +15 -0
@@ -1314,6 +1314,14 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) inpages = resbuf->pages;/* XXX: Would be better to write some xdr helper functions for * nfs{2,3,4}xdr.c that place the data right, instead of copying: */ + +/* +* If there is currently tail data, make sure there is +* room for the head, tail, and 2 * RPC_MAX_AUTH_SIZE in +* the page, and move the current tail data such that +* there is RPC_MAX_AUTH_SIZE slack space available in +* both the head and tail. +*/ if (resbuf->tail[0 ].iov_base) {BUG_ON (resbuf->tail[0 ].iov_base >= resbuf->head[0 ].iov_base +PAGE_SIZE );
@@ -1326,6 +1334,13 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) resbuf->tail[0].iov_len); resbuf->tail[0 ].iov_base +=RPC_MAX_AUTH_SIZE ; } +/* +* If there is no current tail data, make sure there is +* room for the head data, and 2 * RPC_MAX_AUTH_SIZE in the +* allotted page, and set up tail information such that there +* is RPC_MAX_AUTH_SIZE slack space available in both the +* head and tail. +*/ if (resbuf->tail[0 ].iov_base ==NULL ) {if (resbuf->head[0 ].iov_len +2 *RPC_MAX_AUTH_SIZE >PAGE_SIZE )return -ENOMEM ;
Signature · 1 line
1.6.6.1
Re: [PATCH 02/23] gss_krb5: Added and improved code comments
Quoted 50 lines · On 03/17/2010 01:02 PM, [email protected] wrote:
From: Kevin Coffman<[email protected]>
Signed-off-by Steve Dickson<[email protected]>--- net/sunrpc/auth_gss/auth_gss.c | 12 +++++++++--- net/sunrpc/auth_gss/gss_mech_switch.c | 14 ++++++++++++++ net/sunrpc/auth_gss/svcauth_gss.c | 15 +++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-)net/sunrpc/auth_gss/auth_gss.c +9
-3@@ -1317,15 +1317,21 @@ gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, inpages = snd_buf->pages + first; snd_buf->pages = rqstp->rq_enc_pages; snd_buf->page_base -= first<<PAGE_CACHE_SHIFT ; -/* Give the tail its own page, in case we need extra space in the -* head when wrapping: */ +/* +* Give the tail its own page, in case we need extra space in the +* head when wrapping: +* +* call_allocate() allocates twice the slack space required +* by the authentication flavor to rq_callsize. +* For GSS, slack is GSS_CRED_SLACK. +*/ if (snd_buf->page_len || snd_buf->tail[0 ].iov_len) { tmp =page_address (rqstp->rq_enc_pages[rqstp->rq_enc_pages_num -1 ]);memcpy (tmp, snd_buf->tail[0 ].iov_base, snd_buf->tail[0 ].iov_len); snd_buf->tail[0 ].iov_base = tmp; } maj_stat =gss_wrap (ctx->gc_gss_ctx, offset, snd_buf, inpages); -/* RPC_SLACK_SPACE should prevent this ever happening: */ +/* slack space should prevent this ever happening: */ BUG_ON (snd_buf->len> snd_buf->buflen); status = -EIO ;/* We're assuming that when GSS_S_CONTEXT_EXPIRED, the encryption was net/sunrpc/auth_gss/gss_mech_switch.c +4
-0@@ -285,6 +285,20 @@ gss_verify_mic(struct gss_ctx *context_handle, mic_token); } +/* +* This function is called from both the client and server code. +* Each makes guarantees about how much "slack" space is available +* for the underlying function in "buf"'s head and tail while
net/sunrpc/auth_gss/gss_mech_switch.c gss_verify_mic(struct gss_ctx *context_handle, · line 301
Quoted 10 lines
net/sunrpc/auth_gss/gss_mech_switch.c +10
-0+* performing the wrap. +* +* The client and server code allocate RPC_MAX_AUTH_SIZE extra +* space in both the head and tail which is available for use by +* the wrap function. +* +* Underlying functions should verify they do not use more than +* RPC_MAX_AUTH_SIZE of extra space in either the head or tail +* when performing the wrap. +*/
gss_wrap is globally visible, so this should be a doxygen style comment, yes?
Quoted 36 lines
net/sunrpc/auth_gss/gss_mech_switch.c +0
-0u32 gss_wrap(struct gss_ctx *ctx_id, int offset,net/sunrpc/auth_gss/svcauth_gss.c +15
-0@@ -1314,6 +1314,14 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) inpages = resbuf->pages;/* XXX: Would be better to write some xdr helper functions for * nfs{2,3,4}xdr.c that place the data right, instead of copying: */ + +/* +* If there is currently tail data, make sure there is +* room for the head, tail, and 2 * RPC_MAX_AUTH_SIZE in +* the page, and move the current tail data such that +* there is RPC_MAX_AUTH_SIZE slack space available in +* both the head and tail. +*/ if (resbuf->tail[0 ].iov_base) {BUG_ON (resbuf->tail[0 ].iov_base>= resbuf->head[0 ].iov_base +PAGE_SIZE );@@ -1326,6 +1334,13 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) resbuf->tail[0].iov_len); resbuf->tail[0 ].iov_base +=RPC_MAX_AUTH_SIZE ; } +/* +* If there is no current tail data, make sure there is +* room for the head data, and 2 * RPC_MAX_AUTH_SIZE in the +* allotted page, and set up tail information such that there +* is RPC_MAX_AUTH_SIZE slack space available in both the +* head and tail. +*/ if (resbuf->tail[0 ].iov_base ==NULL ) {if (resbuf->head[0 ].iov_len +2 *RPC_MAX_AUTH_SIZE >PAGE_SIZE )return -ENOMEM ;
Signature · 1 line
chuck[dot]lever[at]oracle[dot]com
PATCH 3/23 gss_krb5: Don't expect blocksize to always be 8 when calculating padding
In reply to [email protected]From: J. Bruce Fields <[email protected]>
--- net/sunrpc/auth_gss/gss_krb5_wrap.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
net/sunrpc/auth_gss/gss_krb5_wrap.c +1 -4
@@ -13,10 +13,7 @@static inline int gss_krb5_padding (int blocksize,int length) { -/* Most of the code is block-size independent but currently we -* use only 8: */ -BUG_ON (blocksize !=8 ); -return 8 - (length &7 ); +return blocksize - (length % blocksize); } static inline void
Signature · 1 line
1.6.6.1
PATCH 4/23 gss_krb5: split up functions in preparation of adding new enctypes
In reply to [email protected]From: Kevin Coffman <[email protected]>
Add encryption type to the krb5 context structure and use it to switch to the correct functions depending on the encryption type.
--- include/linux/sunrpc/gss_krb5.h | 1 + net/sunrpc/auth_gss/gss_krb5_mech.c | 1 + net/sunrpc/auth_gss/gss_krb5_seal.c | 20 ++++++++++++++-- net/sunrpc/auth_gss/gss_krb5_unseal.c | 21 +++++++++++++++-- net/sunrpc/auth_gss/gss_krb5_wrap.c | 38 +++++++++++++++++++++++++++----- 5 files changed, 69 insertions(+), 12 deletions(-)
include/linux/sunrpc/gss_krb5.h +1 -0
@@ -48,6 +48,7 @@struct krb5_ctx {int initiate;/* 1 = initiating, 0 = accepting */ +u32 enctype;struct crypto_blkcipher *enc;struct crypto_blkcipher *seq;s32 endtime;
net/sunrpc/auth_gss/gss_krb5_mech.c +1 -0
@@ -139,6 +139,7 @@ gss_import_sec_context_kerberos(const void *p, p =simple_get_bytes (p, end, &ctx->initiate,sizeof (ctx->initiate));if (IS_ERR (p)) goto out_err_free_ctx; + ctx->enctype =ENCTYPE_DES_CBC_RAW ;/* The downcall format was designed before we completely understood * the uses of the context fields; so it includes some stuff we * just give some minimal sanity-checking, and some we ignore
net/sunrpc/auth_gss/gss_krb5_seal.c +17 -3
@@ -71,11 +71,10 @@DEFINE_SPINLOCK (krb5_seq_lock); -u32 -gss_get_mic_kerberos (struct gss_ctx *gss_ctx,struct xdr_buf *text, +static u32 +gss_get_mic_v1 (struct krb5_ctx *ctx,struct xdr_buf *text,struct xdr_netobj *token) { -struct krb5_ctx *ctx = gss_ctx->internal_ctx_id;char cksumdata[16 ];struct xdr_netobj md5cksum = {.len =0 , .data = cksumdata};unsigned char *ptr, *msg_start;
@@ -121,3 +120,18 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,return (ctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; } + +u32 +gss_get_mic_kerberos (struct gss_ctx *gss_ctx,struct xdr_buf *text, +struct xdr_netobj *token) +{ +struct krb5_ctx *ctx = gss_ctx->internal_ctx_id; + +switch (ctx->enctype) { +default : +BUG (); +case ENCTYPE_DES_CBC_RAW : +return gss_get_mic_v1 (ctx, text, token); + } +} +
net/sunrpc/auth_gss/gss_krb5_unseal.c +18 -3
@@ -71,11 +71,10 @@/* read_token is a mic token, and message_buffer is the data that the mic was * supposedly taken over. */ -u32 -gss_verify_mic_kerberos (struct gss_ctx *gss_ctx, +static u32 +gss_verify_mic_v1 (struct krb5_ctx *ctx,struct xdr_buf *message_buffer,struct xdr_netobj *read_token) { -struct krb5_ctx *ctx = gss_ctx->internal_ctx_id;int signalg;int sealalg;char cksumdata[16 ];
@@ -136,3 +135,19 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,return GSS_S_COMPLETE ; } + +u32 +gss_verify_mic_kerberos (struct gss_ctx *gss_ctx, +struct xdr_buf *message_buffer, +struct xdr_netobj *read_token) +{ +struct krb5_ctx *ctx = gss_ctx->internal_ctx_id; + +switch (ctx->enctype) { +default : +BUG (); +case ENCTYPE_DES_CBC_RAW : +return gss_verify_mic_v1 (ctx, message_buffer, read_token); + } +} +
net/sunrpc/auth_gss/gss_krb5_wrap.c +32 -6
@@ -125,11 +125,10 @@ make_confounder(char *p, u32 conflen)/* XXX factor out common code with seal/unseal. */ -u32 -gss_wrap_kerberos (struct gss_ctx *ctx,int offset, +static u32 +gss_wrap_kerberos_v1 (struct krb5_ctx *kctx,int offset,struct xdr_buf *buf,struct page **pages) { -struct krb5_ctx *kctx = ctx->internal_ctx_id;char cksumdata[16 ];struct xdr_netobj md5cksum = {.len =0 , .data = cksumdata};int blocksize =0 , plainlen;
@@ -204,10 +203,9 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,return (kctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ; } -u32 -gss_unwrap_kerberos (struct gss_ctx *ctx,int offset,struct xdr_buf *buf) +static u32 +gss_unwrap_kerberos_v1 (struct krb5_ctx *kctx,int offset,struct xdr_buf *buf) { -struct krb5_ctx *kctx = ctx->internal_ctx_id;int signalg;int sealalg;char cksumdata[16 ];
@@ -295,3 +293,31 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)return GSS_S_COMPLETE ; } + +u32 +gss_wrap_kerberos (struct gss_ctx *gctx,int offset, +struct xdr_buf *buf,struct page **pages) +{ +struct krb5_ctx *kctx = gctx->internal_ctx_id; + +switch (kctx->enctype) { +default : +BUG (); +case ENCTYPE_DES_CBC_RAW : +return gss_wrap_kerberos_v1 (kctx, offset, buf, pages); + } +} + +u32 +gss_unwrap_kerberos (struct gss_ctx *gctx,int offset,struct xdr_buf *buf) +{ +struct krb5_ctx *kctx = gctx->internal_ctx_id; + +switch (kctx->enctype) { +default : +BUG (); +case ENCTYPE_DES_CBC_RAW : +return gss_unwrap_kerberos_v1 (kctx, offset, buf); + } +} +
Signature · 1 line
1.6.6.1
PATCH 5/23 gss_krb5: prepare for new context format
In reply to [email protected]From: Kevin Coffman <[email protected]>
Prepare for new context format by splitting out the old "v1" context processing function
--- net/sunrpc/auth_gss/gss_krb5_mech.c | 64 ++++++++++++++++++++++------------- 1 files changed, 40 insertions(+), 24 deletions(-)
net/sunrpc/auth_gss/gss_krb5_mech.c +40 -24
@@ -123,53 +123,47 @@ out_err: }static int -gss_import_sec_context_kerberos (const void *p, -size_t len, -struct gss_ctx *ctx_id) +gss_import_v1_context (const void *p,const void *end,struct krb5_ctx *ctx) { -const void *end = (const void *)((const char *)p + len); -struct krb5_ctx *ctx;int tmp; -if (!(ctx =kzalloc (sizeof (*ctx),GFP_NOFS ))) { - p =ERR_PTR (-ENOMEM ); - goto out_err; - } - p =simple_get_bytes (p, end, &ctx->initiate,sizeof (ctx->initiate));if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err; + +/* Old format supports only DES! Any other enctype uses new format */ ctx->enctype =ENCTYPE_DES_CBC_RAW ; +/* The downcall format was designed before we completely understood * the uses of the context fields; so it includes some stuff we * just give some minimal sanity-checking, and some we ignore * completely (like the next twenty bytes): */ if (unlikely (p +20 > end || p +20 < p)) - goto out_err_free_ctx; + goto out_err; p +=20 ; p =simple_get_bytes (p, end, &tmp,sizeof (tmp));if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err;if (tmp !=SGN_ALG_DES_MAC_MD5 ) { p =ERR_PTR (-ENOSYS ); - goto out_err_free_ctx; + goto out_err; } p =simple_get_bytes (p, end, &tmp,sizeof (tmp));if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err;if (tmp !=SEAL_ALG_DES ) { p =ERR_PTR (-ENOSYS ); - goto out_err_free_ctx; + goto out_err; } p =simple_get_bytes (p, end, &ctx->endtime,sizeof (ctx->endtime));if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err; p =simple_get_bytes (p, end, &ctx->seq_send,sizeof (ctx->seq_send));if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err; p =simple_get_netobj (p, end, &ctx->mech_used);if (IS_ERR (p)) - goto out_err_free_ctx; + goto out_err; p =get_key (p, end, &ctx->enc);if (IS_ERR (p)) goto out_err_free_mech;
@@ -181,9 +175,6 @@ gss_import_sec_context_kerberos(const void *p, goto out_err_free_key2; } - ctx_id->internal_ctx_id = ctx; - -dprintk ("RPC: Successfully imported new context.\n" );return 0 ; out_err_free_key2:
@@ -192,12 +183,37 @@ out_err_free_key1:crypto_free_blkcipher (ctx->enc); out_err_free_mech:kfree (ctx->mech_used.data); -out_err_free_ctx: -kfree (ctx); out_err:return PTR_ERR (p); } +static int +gss_import_sec_context_kerberos (const void *p,size_t len, +struct gss_ctx *ctx_id) +{ +const void *end = (const void *)((const char *)p + len); +struct krb5_ctx *ctx; +int ret; + + ctx =kmalloc (sizeof (*ctx),GFP_KERNEL ); +if (ctx ==NULL ) +return -ENOMEM ; +memset (ctx,0 ,sizeof (*ctx)); + +if (len ==85 ) + ret =gss_import_v1_context (p, end, ctx); +else + ret = -EINVAL ; + +if (ret ==0 ) + ctx_id->internal_ctx_id = ctx; +else +kfree (ctx); + +dprintk ("RPC: %s: returning %d\n" , __func__, ret); +return ret; +} +static void gss_delete_sec_context_kerberos (void *internal_ctx) {struct krb5_ctx *kctx = internal_ctx;
Signature · 1 line
1.6.6.1
PATCH 6/23 gss_krb5: introduce encryption type framework
In reply to [email protected]From: Kevin Coffman <[email protected]>
Add enctype framework and change functions to use the generic values from it rather than the values hard-coded for des.
--- include/linux/sunrpc/gss_krb5.h | 25 +++++++++- net/sunrpc/auth_gss/gss_krb5_crypto.c | 18 +++--- net/sunrpc/auth_gss/gss_krb5_mech.c | 90 +++++++++++++++++++++++++++------ net/sunrpc/auth_gss/gss_krb5_seal.c | 49 +++++++++++------- net/sunrpc/auth_gss/gss_krb5_unseal.c | 15 +++-- net/sunrpc/auth_gss/gss_krb5_wrap.c | 79 ++++++++++++++++++++++------- 6 files changed, 206 insertions(+), 70 deletions(-)
include/linux/sunrpc/gss_krb5.h +24 -1
@@ -4,7 +4,7 @@* Adapted from MIT Kerberos 5-1.2.1 lib/include/krb5.h, * lib/gssapi/krb5/gssapiP_krb5.h, and others * -* Copyright (c) 2000 The Regents of the University of Michigan. +* Copyright (c) 2000-2008 The Regents of the University of Michigan. * All rights reserved. * * Andy Adamson <[email protected]>
@@ -36,6 +36,7 @@* */ +#include <linux/crypto.h> #include <linux/sunrpc/auth_gss.h> #include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_asn1.h>
@@ -46,9 +47,31 @@/* Maximum blocksize for the supported crypto algorithms */ #define GSS_KRB5_MAX_BLOCKSIZE (16) +struct gss_krb5_enctype { +const u32 etype;/* encryption (key) type */ +const u32 ctype;/* checksum type */ +const char *name;/* "friendly" name */ +const char *encrypt_name;/* crypto encrypt name */ +const char *cksum_name;/* crypto checksum name */ +const u16 signalg;/* signing algorithm */ +const u16 sealalg;/* sealing algorithm */ +const u32 blocksize;/* encryption blocksize */ +const u32 cksumlength;/* checksum length */ +const u32 keyed_cksum;/* is it a keyed cksum? */ +const u32 keybytes;/* raw key len, in bytes */ +const u32 keylength;/* final key len, in bytes */ +u32 (*encrypt) (struct crypto_blkcipher *tfm, +void *iv,void *in,void *out, +int length);/* encryption function */ +u32 (*decrypt) (struct crypto_blkcipher *tfm, +void *iv,void *in,void *out, +int length);/* decryption function */ +}; +struct krb5_ctx {int initiate;/* 1 = initiating, 0 = accepting */ u32 enctype; +const struct gss_krb5_enctype *gk5e;/* enctype-specific info */ struct crypto_blkcipher *enc;struct crypto_blkcipher *seq;s32 endtime;
net/sunrpc/auth_gss/gss_krb5_crypto.c +9 -9
@@ -1,7 +1,7 @@/* * linux/net/sunrpc/gss_krb5_crypto.c * -* Copyright (c) 2000 The Regents of the University of Michigan. +* Copyright (c) 2000-2008 The Regents of the University of Michigan. * All rights reserved. * * Andy Adamson <[email protected]>
@@ -59,13 +59,13 @@ krb5_encrypt( {u32 ret = -EINVAL ;struct scatterlist sg[1 ]; -u8 local_iv[16 ] = {0 }; +u8 local_iv[GSS_KRB5_MAX_BLOCKSIZE ] = {0 };struct blkcipher_desc desc = { .tfm = tfm, .info = local_iv };if (length %crypto_blkcipher_blocksize (tfm) !=0 ) goto out; -if (crypto_blkcipher_ivsize (tfm) >16 ) { +if (crypto_blkcipher_ivsize (tfm) >GSS_KRB5_MAX_BLOCKSIZE ) {dprintk ("RPC: gss_k5encrypt: tfm iv size too large %d\n" ,crypto_blkcipher_ivsize (tfm)); goto out;
@@ -93,13 +93,13 @@ krb5_decrypt( {u32 ret = -EINVAL ;struct scatterlist sg[1 ]; -u8 local_iv[16 ] = {0 }; +u8 local_iv[GSS_KRB5_MAX_BLOCKSIZE ] = {0 };struct blkcipher_desc desc = { .tfm = tfm, .info = local_iv };if (length %crypto_blkcipher_blocksize (tfm) !=0 ) goto out; -if (crypto_blkcipher_ivsize (tfm) >16 ) { +if (crypto_blkcipher_ivsize (tfm) >GSS_KRB5_MAX_BLOCKSIZE ) {dprintk ("RPC: gss_k5decrypt: tfm iv size too large %d\n" ,crypto_blkcipher_ivsize (tfm)); goto out;
@@ -158,7 +158,7 @@ out: }struct encryptor_desc { -u8 iv[8 ];/* XXX hard-coded blocksize */ +u8 iv[GSS_KRB5_MAX_BLOCKSIZE ];struct blkcipher_desc desc;int pos;struct xdr_buf *outbuf;
@@ -199,7 +199,7 @@ encryptor(struct scatterlist *sg, void *data) desc->fraglen += sg->length; desc->pos += sg->length; - fraglen = thislen &7 ;/* XXX hardcoded blocksize */ + fraglen = thislen & (crypto_blkcipher_blocksize (desc->desc.tfm) -1 ); thislen -= fraglen;if (thislen ==0 )
@@ -257,7 +257,7 @@ gss_encrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *buf, }struct decryptor_desc { -u8 iv[8 ];/* XXX hard-coded blocksize */ +u8 iv[GSS_KRB5_MAX_BLOCKSIZE ];struct blkcipher_desc desc;struct scatterlist frags[4 ];int fragno;
@@ -279,7 +279,7 @@ decryptor(struct scatterlist *sg, void *data) desc->fragno++; desc->fraglen += sg->length; - fraglen = thislen &7 ;/* XXX hardcoded blocksize */ + fraglen = thislen & (crypto_blkcipher_blocksize (desc->desc.tfm) -1 ); thislen -= fraglen;if (thislen ==0 )
net/sunrpc/auth_gss/gss_krb5_mech.c +74 -16
138 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_seal.c +30 -19
73 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_unseal.c +9 -6
@@ -3,7 +3,7 @@* * Adapted from MIT Kerberos 5-1.2.1 lib/gssapi/krb5/k5unseal.c * -* Copyright (c) 2000 The Regents of the University of Michigan. +* Copyright (c) 2000-2008 The Regents of the University of Michigan. * All rights reserved. * * Andy Adamson <[email protected]>
@@ -77,8 +77,9 @@ gss_verify_mic_v1(struct krb5_ctx *ctx, {int signalg;int sealalg; -char cksumdata[16 ]; -struct xdr_netobj md5cksum = {.len =0 , .data = cksumdata}; +char cksumdata[GSS_KRB5_MAX_CKSUM_LEN ]; +struct xdr_netobj md5cksum = {.len =sizeof (cksumdata), + .data = cksumdata};s32 now;int direction;u32 seqnum;
@@ -98,7 +99,7 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,/* XXX sanity-check bodysize?? */ signalg = ptr[2 ] + (ptr[3 ] <<8 ); -if (signalg !=SGN_ALG_DES_MAC_MD5 ) +if (signalg != ctx->gk5e->signalg)return GSS_S_DEFECTIVE_TOKEN ; sealalg = ptr[4 ] + (ptr[5 ] <<8 );
@@ -108,13 +109,15 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,if ((ptr[6 ] !=0xff ) || (ptr[7 ] !=0xff ))return GSS_S_DEFECTIVE_TOKEN ; -if (make_checksum ("md5" , ptr,8 , message_buffer,0 , &md5cksum)) +if (make_checksum ((char *)ctx->gk5e->cksum_name, ptr,8 , + message_buffer,0 , &md5cksum))return GSS_S_FAILURE ;if (krb5_encrypt (ctx->seq,NULL , md5cksum.data, md5cksum.data,16 ))return GSS_S_FAILURE ; -if (memcmp (md5cksum.data +8 , ptr +GSS_KRB5_TOK_HDR_LEN ,8 )) +if (memcmp (md5cksum.data +8 , ptr +GSS_KRB5_TOK_HDR_LEN , + ctx->gk5e->cksumlength))return GSS_S_BAD_SIG ;/* it got through unscathed. Make sure the context is unexpired */
net/sunrpc/auth_gss/gss_krb5_wrap.c +60 -19
154 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH 7/23 gss_krb5: add ability to have a keyed checksum (hmac)
In reply to [email protected]From: Kevin Coffman <[email protected]>
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.
--- include/linux/sunrpc/gss_krb5.h | 11 +++++-- net/sunrpc/auth_gss/gss_krb5_crypto.c | 54 ++++++++++++++++++++++++++++----- net/sunrpc/auth_gss/gss_krb5_mech.c | 1 + net/sunrpc/auth_gss/gss_krb5_seal.c | 13 ++++---- net/sunrpc/auth_gss/gss_krb5_unseal.c | 13 +++++--- net/sunrpc/auth_gss/gss_krb5_wrap.c | 30 +++++++++++------- 6 files changed, 88 insertions(+), 34 deletions(-)
include/linux/sunrpc/gss_krb5.h +8 -3
@@ -41,6 +41,9 @@#include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_asn1.h> +/* Maximum key length (in bytes) for the supported crypto algorithms*/ +#define GSS_KRB5_MAX_KEYLEN (32) +/* Maximum checksum function output for the supported crypto algorithms */ #define GSS_KRB5_MAX_CKSUM_LEN (20)
@@ -74,6 +77,7 @@ struct krb5_ctx {const struct gss_krb5_enctype *gk5e;/* enctype-specific info */ struct crypto_blkcipher *enc;struct crypto_blkcipher *seq; +u8 cksum[GSS_KRB5_MAX_KEYLEN ];s32 endtime;u32 seq_send;struct xdr_netobj mech_used;
@@ -159,9 +163,10 @@ enum seal_alg { +GSS_KRB5_TOK_HDR_LEN \ + GSS_KRB5_MAX_CKSUM_LEN -s32 -make_checksum (char *,char *header,int hdrlen,struct xdr_buf *body, -int body_offset,struct xdr_netobj *cksum); +u32 +make_checksum (struct krb5_ctx *kctx,char *header,int hdrlen, +struct xdr_buf *body,int body_offset,u8 *cksumkey, +struct xdr_netobj *cksumout);u32 gss_get_mic_kerberos (struct gss_ctx *,struct xdr_buf *,struct xdr_netobj *);
net/sunrpc/auth_gss/gss_krb5_crypto.c +46 -8
75 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_mech.c +1 -0
@@ -66,6 +66,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .keylength = 8, .blocksize = 8, .cksumlength = 8, + .keyed_cksum = 0, }, };
net/sunrpc/auth_gss/gss_krb5_seal.c +7 -6
@@ -102,6 +102,7 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,void *ptr;s32 now;u32 seq_send; +u8 *cksumkey;dprintk ("RPC: %s\n" , __func__);BUG_ON (ctx ==NULL );
@@ -110,15 +111,15 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text, ptr =setup_token (ctx, token); -if (make_checksum ((char *)ctx->gk5e->cksum_name, ptr,8 , - text,0 , &md5cksum)) -return GSS_S_FAILURE ; +if (ctx->gk5e->keyed_cksum) + cksumkey = ctx->cksum; +else + cksumkey =NULL ; -if (krb5_encrypt (ctx->seq,NULL , md5cksum.data, - md5cksum.data, md5cksum.len)) +if (make_checksum (ctx, ptr,8 , text,0 , cksumkey, &md5cksum))return GSS_S_FAILURE ; -memcpy (ptr +GSS_KRB5_TOK_HDR_LEN , md5cksum.data + md5cksum.len -8 ,8 ); +memcpy (ptr +GSS_KRB5_TOK_HDR_LEN , md5cksum.data, md5cksum.len);spin_lock (&krb5_seq_lock); seq_send = ctx->seq_send++;
net/sunrpc/auth_gss/gss_krb5_unseal.c +8 -5
@@ -85,6 +85,7 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,u32 seqnum;unsigned char *ptr = (unsigned char *)read_token->data;int bodysize; +u8 *cksumkey;dprintk ("RPC: krb5_read_token\n" );
@@ -109,14 +110,16 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,if ((ptr[6 ] !=0xff ) || (ptr[7 ] !=0xff ))return GSS_S_DEFECTIVE_TOKEN ; -if (make_checksum ((char *)ctx->gk5e->cksum_name, ptr,8 , - message_buffer,0 , &md5cksum)) -return GSS_S_FAILURE ; +if (ctx->gk5e->keyed_cksum) + cksumkey = ctx->cksum; +else + cksumkey =NULL ; -if (krb5_encrypt (ctx->seq,NULL , md5cksum.data, md5cksum.data,16 )) +if (make_checksum (ctx, ptr,8 , message_buffer,0 , + cksumkey, &md5cksum))return GSS_S_FAILURE ; -if (memcmp (md5cksum.data +8 , ptr +GSS_KRB5_TOK_HDR_LEN , +if (memcmp (md5cksum.data, ptr +GSS_KRB5_TOK_HDR_LEN , ctx->gk5e->cksumlength))return GSS_S_BAD_SIG ;
net/sunrpc/auth_gss/gss_krb5_wrap.c +18 -12
@@ -168,6 +168,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,int headlen;struct page **tmp_pages;u32 seq_send; +u8 *cksumkey;dprintk ("RPC: %s\n" , __func__);
@@ -206,18 +207,20 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,make_confounder (msg_start, blocksize); +if (kctx->gk5e->keyed_cksum) + cksumkey = kctx->cksum; +else + cksumkey =NULL ; +/* XXXJBF: UGH!: */ tmp_pages = buf->pages; buf->pages = pages; -if (make_checksum ((char *)kctx->gk5e->cksum_name, ptr,8 , buf, - offset + headlen - blocksize, &md5cksum)) +if (make_checksum (kctx, ptr,8 , buf, offset + headlen - blocksize, + cksumkey, &md5cksum))return GSS_S_FAILURE ; buf->pages = tmp_pages; -if (krb5_encrypt (kctx->seq,NULL , md5cksum.data, - md5cksum.data, md5cksum.len)) -return GSS_S_FAILURE ; -memcpy (ptr +GSS_KRB5_TOK_HDR_LEN , md5cksum.data + md5cksum.len -8 ,8 ); +memcpy (ptr +GSS_KRB5_TOK_HDR_LEN , md5cksum.data, md5cksum.len);spin_lock (&krb5_seq_lock); seq_send = kctx->seq_send++;
@@ -253,6 +256,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)int data_len;int blocksize;int crypt_offset; +u8 *cksumkey;dprintk ("RPC: gss_unwrap_kerberos\n" );
@@ -289,15 +293,17 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)if (gss_decrypt_xdr_buf (kctx->enc, buf, crypt_offset))return GSS_S_DEFECTIVE_TOKEN ; -if (make_checksum ((char *)kctx->gk5e->cksum_name, ptr,8 , buf, - crypt_offset, &md5cksum)) -return GSS_S_FAILURE ; +if (kctx->gk5e->keyed_cksum) + cksumkey = kctx->cksum; +else + cksumkey =NULL ; -if (krb5_encrypt (kctx->seq,NULL , md5cksum.data, - md5cksum.data, md5cksum.len)) +if (make_checksum (kctx, ptr,8 , buf, crypt_offset, + cksumkey, &md5cksum))return GSS_S_FAILURE ; -if (memcmp (md5cksum.data +8 , ptr +GSS_KRB5_TOK_HDR_LEN ,8 )) +if (memcmp (md5cksum.data, ptr +GSS_KRB5_TOK_HDR_LEN , + kctx->gk5e->cksumlength))return GSS_S_BAD_SIG ;/* it got through unscathed. Make sure the context is unexpired */
Signature · 1 line
1.6.6.1
PATCH 8/23 gss_krb5: import functionality to derive keys into the kernel
In reply to [email protected]From: Kevin Coffman <[email protected]>
Import the code to derive Kerberos keys from a base key into the kernel. This will allow us to change the format of the context information sent down from gssd to include only a single key.
--- include/linux/sunrpc/gss_krb5.h | 31 +++++ net/sunrpc/auth_gss/Makefile | 2 +- net/sunrpc/auth_gss/gss_krb5_keys.c | 252 +++++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 1 + 4 files changed, 285 insertions(+), 1 deletions(-) create mode 100644 net/sunrpc/auth_gss/gss_krb5_keys.c
include/linux/sunrpc/gss_krb5.h +31 -0
@@ -41,6 +41,9 @@#include <linux/sunrpc/gss_err.h> #include <linux/sunrpc/gss_asn1.h> +/* Length of constant used in key derivation */ +#define GSS_KRB5_K5CLENGTH (5) +/* Maximum key length (in bytes) for the supported crypto algorithms*/ #define GSS_KRB5_MAX_KEYLEN (32)
@@ -69,6 +72,9 @@ struct gss_krb5_enctype {u32 (*decrypt) (struct crypto_blkcipher *tfm,void *iv,void *in,void *out,int length);/* decryption function */ +u32 (*mk_key) (struct gss_krb5_enctype *gk5e, +struct xdr_netobj *in, +struct xdr_netobj *out);/* complete key generation */ };struct krb5_ctx {
@@ -148,6 +154,25 @@ enum seal_alg {#define ENCTYPE_UNKNOWN 0x01ff/* +* Constants used for key derivation +*/ +/* for 3DES */ +#define KG_USAGE_SEAL (22) +#define KG_USAGE_SIGN (23) +#define KG_USAGE_SEQ (24) + +/* from rfc3961 */ +#define KEY_USAGE_SEED_CHECKSUM (0x99) +#define KEY_USAGE_SEED_ENCRYPTION (0xAA) +#define KEY_USAGE_SEED_INTEGRITY (0x55) + +/* from rfc4121 */ +#define KG_USAGE_ACCEPTOR_SEAL (22) +#define KG_USAGE_ACCEPTOR_SIGN (23) +#define KG_USAGE_INITIATOR_SEAL (24) +#define KG_USAGE_INITIATOR_SIGN (25) + +/* * This compile-time check verifies that we will not exceed the * slack space allotted by the client and server auth_gss code * before they call gss_wrap().
@@ -211,3 +236,9 @@ krb5_get_seq_num(struct crypto_blkcipher *key,int xdr_extend_head (struct xdr_buf *buf,unsigned int base,unsigned int shiftlen); + +u32 +krb5_derive_key (struct gss_krb5_enctype *gk5e, +const struct xdr_netobj *inkey, +struct xdr_netobj *outkey, +const struct xdr_netobj *in_constant);
net/sunrpc/auth_gss/Makefile +1 -1
@@ -10,7 +10,7 @@ auth_rpcgss-objs := auth_gss.o gss_generic_token.o \ obj-$(CONFIG_RPCSEC_GSS_KRB5) += rpcsec_gss_krb5.o rpcsec_gss_krb5-objs := gss_krb5_mech.o gss_krb5_seal.o gss_krb5_unseal.o \ - gss_krb5_seqnum.o gss_krb5_wrap.o gss_krb5_crypto.o + gss_krb5_seqnum.o gss_krb5_wrap.o gss_krb5_crypto.o gss_krb5_keys.o obj-$(CONFIG_RPCSEC_GSS_SPKM3) += rpcsec_gss_spkm3.o
net/sunrpc/auth_gss/gss_krb5_keys.c new file +252 -0
252 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_mech.c +1 -0
@@ -60,6 +60,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .cksum_name = "md5", .encrypt = krb5_encrypt, .decrypt = krb5_decrypt, + .mk_key = NULL, .signalg = SGN_ALG_DES_MAC_MD5, .sealalg = SEAL_ALG_DES, .keybytes = 7,
Signature · 1 line
1.6.6.1
PATCH 9/23 gss_krb5: handle new context format from gssd
In reply to [email protected]From: Kevin Coffman <[email protected]>
For encryption types other than DES, gssd sends down context information in a new format. This new format includes the information needed to support the new Kerberos GSS-API tokens defined in rfc4121.
--- include/linux/sunrpc/gss_krb5.h | 23 +++- net/sunrpc/auth_gss/gss_krb5_keys.c | 2 +- net/sunrpc/auth_gss/gss_krb5_mech.c | 237 ++++++++++++++++++++++++++++++++++- 3 files changed, 258 insertions(+), 4 deletions(-)
include/linux/sunrpc/gss_krb5.h +21 -2
@@ -72,21 +72,36 @@ struct gss_krb5_enctype {u32 (*decrypt) (struct crypto_blkcipher *tfm,void *iv,void *in,void *out,int length);/* decryption function */ -u32 (*mk_key) (struct gss_krb5_enctype *gk5e, +u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,struct xdr_netobj *in,struct xdr_netobj *out);/* complete key generation */ }; +/* krb5_ctx flags definitions */ +#define KRB5_CTX_FLAG_INITIATOR 0x00000001 +#define KRB5_CTX_FLAG_CFX 0x00000002 +#define KRB5_CTX_FLAG_ACCEPTOR_SUBKEY 0x00000004 +struct krb5_ctx {int initiate;/* 1 = initiating, 0 = accepting */ u32 enctype; +u32 flags;const struct gss_krb5_enctype *gk5e;/* enctype-specific info */ struct crypto_blkcipher *enc;struct crypto_blkcipher *seq; +struct crypto_blkcipher *acceptor_enc; +struct crypto_blkcipher *initiator_enc;u8 cksum[GSS_KRB5_MAX_KEYLEN ];s32 endtime;u32 seq_send; +u64 seq_send64;struct xdr_netobj mech_used; +u8 initiator_sign[GSS_KRB5_MAX_KEYLEN ]; +u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN ]; +u8 initiator_seal[GSS_KRB5_MAX_KEYLEN ]; +u8 acceptor_seal[GSS_KRB5_MAX_KEYLEN ]; +u8 initiator_integ[GSS_KRB5_MAX_KEYLEN ]; +u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN ]; };extern spinlock_t krb5_seq_lock;
@@ -151,6 +166,10 @@ enum seal_alg {#define ENCTYPE_DES3_CBC_RAW 0x0006/* DES-3 cbc mode raw */ #define ENCTYPE_DES_HMAC_SHA1 0x0008#define ENCTYPE_DES3_CBC_SHA1 0x0010 +#define ENCTYPE_AES128_CTS_HMAC_SHA1_96 0x0011 +#define ENCTYPE_AES256_CTS_HMAC_SHA1_96 0x0012 +#define ENCTYPE_ARCFOUR_HMAC 0x0017 +#define ENCTYPE_ARCFOUR_HMAC_EXP 0x0018#define ENCTYPE_UNKNOWN 0x01ff/*
@@ -238,7 +257,7 @@ int xdr_extend_head(struct xdr_buf *buf, unsigned int base, unsigned int shiftlen);u32 -krb5_derive_key (struct gss_krb5_enctype *gk5e, +krb5_derive_key (const struct gss_krb5_enctype *gk5e,const struct xdr_netobj *inkey,struct xdr_netobj *outkey,const struct xdr_netobj *in_constant);
net/sunrpc/auth_gss/gss_krb5_keys.c +1 -1
@@ -147,7 +147,7 @@ static void krb5_nfold(u32 inbits, const u8 *in,* Taken from MIT Kerberos and modified. */ -u32 krb5_derive_key (struct gss_krb5_enctype *gk5e, +u32 krb5_derive_key (const struct gss_krb5_enctype *gk5e,const struct xdr_netobj *inkey,struct xdr_netobj *outkey,const struct xdr_netobj *in_constant)
net/sunrpc/auth_gss/gss_krb5_mech.c +236 -1
261 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH 10/23 gss_krb5: add support for triple-des encryption
In reply to [email protected]From: Kevin Coffman <[email protected]>
Add the final pieces to support the triple-des encryption type.
--- include/linux/sunrpc/gss_krb5.h | 5 +++ net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 ++ net/sunrpc/auth_gss/gss_krb5_keys.c | 53 +++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 23 ++++++++++++++ net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + net/sunrpc/auth_gss/gss_krb5_unseal.c | 1 + net/sunrpc/auth_gss/gss_krb5_wrap.c | 2 + 7 files changed, 88 insertions(+), 0 deletions(-)
include/linux/sunrpc/gss_krb5.h +5 -0
@@ -261,3 +261,8 @@ krb5_derive_key(const struct gss_krb5_enctype *gk5e,const struct xdr_netobj *inkey, struct xdr_netobj *outkey, const struct xdr_netobj *in_constant); + +u32 +gss_krb5_des3_make_key (const struct gss_krb5_enctype *gk5e, +struct xdr_netobj *randombits, +struct xdr_netobj *key);
net/sunrpc/auth_gss/gss_krb5_crypto.c +3 -0
@@ -185,6 +185,9 @@ make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen, checksumdata + checksumlen - kctx->gk5e->cksumlength, kctx->gk5e->cksumlength);break ; +case CKSUMTYPE_HMAC_SHA1_DES3 : +memcpy (cksumout->data, checksumdata, kctx->gk5e->cksumlength); +break ;default :BUG ();break ;
net/sunrpc/auth_gss/gss_krb5_keys.c +53 -0
56 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_mech.c +23 -0
@@ -71,6 +71,26 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .cksumlength = 8, .keyed_cksum = 0, }, +/* +* 3DES +*/ + { + .etype = ENCTYPE_DES3_CBC_RAW, + .ctype = CKSUMTYPE_HMAC_SHA1_DES3, + .name = "des3-hmac-sha1", + .encrypt_name = "cbc(des3_ede)", + .cksum_name = "hmac(sha1)", + .encrypt = krb5_encrypt, + .decrypt = krb5_decrypt, + .mk_key = gss_krb5_des3_make_key, + .signalg = SGN_ALG_HMAC_SHA1_DES3_KD, + .sealalg = SEAL_ALG_DES3KD, + .keybytes = 21, + .keylength = 24, + .blocksize = 8, + .cksumlength = 20, + .keyed_cksum = 1, + }, }; static const int num_supported_enctypes =
@@ -440,6 +460,9 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx) p =simple_get_bytes (p, end, &ctx->enctype,sizeof (ctx->enctype));if (IS_ERR (p)) goto out_err; +/* Map ENCTYPE_DES3_CBC_SHA1 to ENCTYPE_DES3_CBC_RAW */ +if (ctx->enctype ==ENCTYPE_DES3_CBC_SHA1 ) + ctx->enctype =ENCTYPE_DES3_CBC_RAW ; ctx->gk5e =get_gss_krb5_enctype (ctx->enctype);if (ctx->gk5e ==NULL ) { printk("gss_kerberos_mech: unsupported krb5 enctype %u\n",
net/sunrpc/auth_gss/gss_krb5_seal.c +1 -0
@@ -143,6 +143,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,default :BUG ();case ENCTYPE_DES_CBC_RAW : +case ENCTYPE_DES3_CBC_RAW :return gss_get_mic_v1 (ctx, text, token); } }
net/sunrpc/auth_gss/gss_krb5_unseal.c +1 -0
@@ -153,6 +153,7 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,default :BUG ();case ENCTYPE_DES_CBC_RAW : +case ENCTYPE_DES3_CBC_RAW :return gss_verify_mic_v1 (ctx, message_buffer, read_token); } }
net/sunrpc/auth_gss/gss_krb5_wrap.c +2 -0
@@ -351,6 +351,7 @@ gss_wrap_kerberos(struct gss_ctx *gctx, int offset,default :BUG ();case ENCTYPE_DES_CBC_RAW : +case ENCTYPE_DES3_CBC_RAW :return gss_wrap_kerberos_v1 (kctx, offset, buf, pages); } }
@@ -364,6 +365,7 @@ gss_unwrap_kerberos(struct gss_ctx *gctx, int offset, struct xdr_buf *buf)default :BUG ();case ENCTYPE_DES_CBC_RAW : +case ENCTYPE_DES3_CBC_RAW :return gss_unwrap_kerberos_v1 (kctx, offset, buf); } }
Signature · 1 line
1.6.6.1
PATCH 11/23 Add new pipefs file indicating which Kerberos enctypes the kernel supports
In reply to [email protected]From: Kevin Coffman <[email protected]>
New file, krb5_info, indicates which Kerberos encryption types are supported by the kernel rpcsecgss code. This is used by gssd to determine which encryption types it should attempt to negotiate when creating a context with a server.
The server principal's database and keytab encryption types are what limits what it should negotiate. Therefore, its keytab should be created with only the enctypes listed by this file.
From: J. Bruce Fields <[email protected]>
--- net/sunrpc/rpc_pipe.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
net/sunrpc/rpc_pipe.c +27 -0
@@ -397,6 +397,27 @@ static const struct file_operations rpc_info_operations = { .release = rpc_info_release, }; +static int +rpc_show_krb5_info (struct seq_file *m,void *v) +{ +seq_printf (m,"enctypes: 3,1,2\n" ); +return 0 ; +} + +static int +rpc_krb5_info_open (struct inode *inode,struct file *file) +{ +return single_open (file, rpc_show_krb5_info,NULL ); +} + +static struct file_operations krb5_info_operations = { + .owner =THIS_MODULE , + .open = rpc_krb5_info_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; +/* * Description of fs contents.
@@ -949,6 +970,7 @@ enum { RPCAUTH_portmap, RPCAUTH_statd, RPCAUTH_nfsd4_cb, + RPCAUTH_krb5_info, RPCAUTH_cache, RPCAUTH_RootEOF };
@@ -982,6 +1004,11 @@ static const struct rpc_filelist files[] = { .name = "cache", .mode = S_IFDIR | S_IRUGO | S_IXUGO, }, + [RPCAUTH_krb5_info] = { + .name = "krb5_info", + .i_fop = &krb5_info_operations, + .mode = S_IFREG | S_IRUSR, + }, }; static int
Signature · 1 line
1.6.6.1
PATCH 12/23 Update pipefs file indicating which Kerberos enctypes the kernel supports
In reply to [email protected]From: Kevin Coffman <[email protected]>
--- net/sunrpc/rpc_pipe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/rpc_pipe.c +1 -1
@@ -400,7 +400,7 @@ static const struct file_operations rpc_info_operations = {static int rpc_show_krb5_info (struct seq_file *m,void *v) { -seq_printf (m,"enctypes: 3,1,2\n" ); +seq_printf (m,"enctypes: 16,3,1,2\n" );return 0 ; }
Signature · 1 line
1.6.6.1
PATCH 13/23 xdr: Add an export for the helper function write_bytes_to_xdr_buf()
In reply to [email protected]From: Kevin Coffman <[email protected]>
--- net/sunrpc/xdr.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
net/sunrpc/xdr.c +1 -0
@@ -761,6 +761,7 @@ int write_bytes_to_xdr_buf(struct xdr_buf *buf, unsigned int base, void *obj, un__write_bytes_to_xdr_buf (&subbuf, obj, len);return 0 ; } +EXPORT_SYMBOL_GPL (write_bytes_to_xdr_buf);int xdr_decode_word (struct xdr_buf *buf,unsigned int base,u32 *obj)
Signature · 1 line
1.6.6.1
PATCH 14/23 gss_krb5: add support for new token formats in rfc4121
In reply to [email protected]From: Kevin Coffman <[email protected]>
This is a step toward support for AES encryption types which are required to use the new token formats defined in rfc4121.
--- include/linux/sunrpc/gss_krb5.h | 28 ++++ net/sunrpc/auth_gss/gss_krb5_crypto.c | 74 ++++++++++ net/sunrpc/auth_gss/gss_krb5_seal.c | 69 +++++++++ net/sunrpc/auth_gss/gss_krb5_unseal.c | 61 ++++++++ net/sunrpc/auth_gss/gss_krb5_wrap.c | 245 +++++++++++++++++++++++++++++++++ 5 files changed, 477 insertions(+), 0 deletions(-)
include/linux/sunrpc/gss_krb5.h +28 -0
@@ -53,6 +53,8 @@/* Maximum blocksize for the supported crypto algorithms */ #define GSS_KRB5_MAX_BLOCKSIZE (16) +struct krb5_ctx ; +struct gss_krb5_enctype {const u32 etype;/* encryption (key) type */ const u32 ctype;/* checksum type */
@@ -75,6 +77,12 @@ struct gss_krb5_enctype {u32 (*mk_key) (const struct gss_krb5_enctype *gk5e,struct xdr_netobj *in,struct xdr_netobj *out);/* complete key generation */ +u32 (*encrypt_v2) (struct krb5_ctx *kctx,u32 offset, +struct xdr_buf *buf,int ec, +struct page **pages);/* v2 encryption function */ +u32 (*decrypt_v2) (struct krb5_ctx *kctx,u32 offset, +struct xdr_buf *buf,u32 *headskip, +u32 *tailskip);/* v2 decryption function */ };/* krb5_ctx flags definitions */
@@ -112,6 +120,18 @@ extern spinlock_t krb5_seq_lock;#define KG_TOK_MIC_MSG 0x0101#define KG_TOK_WRAP_MSG 0x0201 +#define KG2_TOK_INITIAL 0x0101 +#define KG2_TOK_RESPONSE 0x0202 +#define KG2_TOK_MIC 0x0404 +#define KG2_TOK_WRAP 0x0504 + +#define KG2_TOKEN_FLAG_SENTBYACCEPTOR 0x01 +#define KG2_TOKEN_FLAG_SEALED 0x02 +#define KG2_TOKEN_FLAG_ACCEPTORSUBKEY 0x04 + +#define KG2_RESP_FLAG_ERROR 0x0001 +#define KG2_RESP_FLAG_DELEG_OK 0x0002 +enum sgn_alg {SGN_ALG_DES_MAC_MD5 =0x0000 ,SGN_ALG_MD2_5 =0x0001 ,
@@ -136,6 +156,9 @@ enum seal_alg {#define CKSUMTYPE_RSA_MD5_DES 0x0008#define CKSUMTYPE_NIST_SHA 0x0009#define CKSUMTYPE_HMAC_SHA1_DES3 0x000c +#define CKSUMTYPE_HMAC_SHA1_96_AES128 0x000f +#define CKSUMTYPE_HMAC_SHA1_96_AES256 0x0010 +#define CKSUMTYPE_HMAC_MD5_ARCFOUR -138/* Microsoft md5 hmac cksumtype */ /* from gssapi_err_krb5.h */ #define KG_CCACHE_NOMATCH (39756032L)
@@ -212,6 +235,11 @@ make_checksum(struct krb5_ctx *kctx, char *header, int hdrlen, struct xdr_buf *body, int body_offset, u8 *cksumkey, struct xdr_netobj *cksumout); +u32 +make_checksum_v2 (struct krb5_ctx *,char *header,int hdrlen, +struct xdr_buf *body,int body_offset,u8 *key, +struct xdr_netobj *cksum); +u32 gss_get_mic_kerberos (struct gss_ctx *,struct xdr_buf *,struct xdr_netobj *);
net/sunrpc/auth_gss/gss_krb5_crypto.c +74 -0
80 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_seal.c +69 -0
87 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_unseal.c +61 -0
73 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_wrap.c +245 -0
263 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH 15/23 gss_krb5: add remaining pieces to enable AES encryption support
In reply to [email protected]From: Kevin Coffman <[email protected]>
Add the remaining pieces to enable support for Kerberos AES encryption types.
--- include/linux/sunrpc/gss_krb5.h | 20 +++ net/sunrpc/auth_gss/gss_krb5_crypto.c | 248 +++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_keys.c | 30 ++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 86 ++++++++++-- net/sunrpc/auth_gss/gss_krb5_wrap.c | 2 +- 5 files changed, 376 insertions(+), 10 deletions(-)
include/linux/sunrpc/gss_krb5.h +20 -0
@@ -99,6 +99,8 @@ struct krb5_ctx {struct crypto_blkcipher *seq;struct crypto_blkcipher *acceptor_enc;struct crypto_blkcipher *initiator_enc; +struct crypto_blkcipher *acceptor_enc_aux; +struct crypto_blkcipher *initiator_enc_aux;u8 cksum[GSS_KRB5_MAX_KEYLEN ];s32 endtime;u32 seq_send;
@@ -294,3 +296,21 @@ u32 gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e, struct xdr_netobj *randombits, struct xdr_netobj *key); + +u32 +gss_krb5_aes_make_key (const struct gss_krb5_enctype *gk5e, +struct xdr_netobj *randombits, +struct xdr_netobj *key); + +u32 +gss_krb5_aes_encrypt (struct krb5_ctx *kctx,u32 offset, +struct xdr_buf *buf,int ec, +struct page **pages); + +u32 +gss_krb5_aes_decrypt (struct krb5_ctx *kctx,u32 offset, +struct xdr_buf *buf,u32 *plainoffset, +u32 *plainlen); + +void +make_confounder (char *p,u32 conflen);
net/sunrpc/auth_gss/gss_krb5_crypto.c +248 -0
257 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_keys.c +30 -0
@@ -303,3 +303,33 @@ u32 gss_krb5_des3_make_key(const struct gss_krb5_enctype *gk5e, err_out:return (ret); } + +/* +* This is the aes key derivation postprocess function +*/ +u32 gss_krb5_aes_make_key (const struct gss_krb5_enctype *gk5e, +struct xdr_netobj *randombits, +struct xdr_netobj *key) +{ +u32 ret =EINVAL ; + +if (key->len !=16 && key->len !=32 ) { +dprintk ("%s: key->len is %d\n" , __func__, key->len); + goto err_out; + } +if (randombits->len !=16 && randombits->len !=32 ) { +dprintk ("%s: randombits->len is %d\n" , + __func__, randombits->len); + goto err_out; + } +if (randombits->len != key->len) { +dprintk ("%s: randombits->len is %d, key->len is %d\n" , + __func__, randombits->len, key->len); + goto err_out; + } +memcpy (key->data, randombits->data, key->len); + ret =0 ; +err_out: +return (ret); +} +
net/sunrpc/auth_gss/gss_krb5_mech.c +77 -9
140 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_wrap.c +1 -1
@@ -114,7 +114,7 @@ out:return 0 ; } -static void +void make_confounder (char *p,u32 conflen) {static u64 i =0 ;
Signature · 1 line
1.6.6.1
PATCH 16/23 gss_krb5: Update pipefs file
In reply to [email protected]From: Kevin Coffman <[email protected]>
Update pipefs file indicating which Kerberos enctypes the kernel supports
--- net/sunrpc/rpc_pipe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/rpc_pipe.c +1 -1
@@ -400,7 +400,7 @@ static const struct file_operations rpc_info_operations = {static int rpc_show_krb5_info (struct seq_file *m,void *v) { -seq_printf (m,"enctypes: 16,3,1,2\n" ); +seq_printf (m,"enctypes: 18,17,16,3,1,2\n" );return 0 ; }
Signature · 1 line
1.6.6.1
PATCH 17/23 gssd_krb5: arcfour-hmac support
In reply to [email protected]From: Kevin Coffman <[email protected]>
For arcfour-hmac support, the make_checksum function needs a usage field to correctly calculate the checksum differently for MIC and WRAP tokens.
--- include/linux/sunrpc/gss_krb5.h | 4 ++-- net/sunrpc/auth_gss/gss_krb5_crypto.c | 15 +++++++++++---- net/sunrpc/auth_gss/gss_krb5_seal.c | 13 +++++++++---- net/sunrpc/auth_gss/gss_krb5_unseal.c | 12 ++++++++---- net/sunrpc/auth_gss/gss_krb5_wrap.c | 4 ++-- 5 files changed, 32 insertions(+), 16 deletions(-)
include/linux/sunrpc/gss_krb5.h +2 -2
@@ -235,12 +235,12 @@ enum seal_alg {u32 make_checksum (struct krb5_ctx *kctx,char *header,int hdrlen,struct xdr_buf *body,int body_offset,u8 *cksumkey, -struct xdr_netobj *cksumout); +unsigned int usage,struct xdr_netobj *cksumout);u32 make_checksum_v2 (struct krb5_ctx *,char *header,int hdrlen,struct xdr_buf *body,int body_offset,u8 *key, -struct xdr_netobj *cksum); +unsigned int usage,struct xdr_netobj *cksum);u32 gss_get_mic_kerberos (struct gss_ctx *,struct xdr_buf *,struct xdr_netobj *);
net/sunrpc/auth_gss/gss_krb5_crypto.c +11 -4
@@ -133,7 +133,7 @@ checksummer(struct scatterlist *sg, void *data)u32 make_checksum (struct krb5_ctx *kctx,char *header,int hdrlen,struct xdr_buf *body,int body_offset,u8 *cksumkey, -struct xdr_netobj *cksumout) +unsigned int usage,struct xdr_netobj *cksumout) {struct hash_desc desc;struct scatterlist sg[1 ];
@@ -209,7 +209,7 @@ out:u32 make_checksum_v2 (struct krb5_ctx *kctx,char *header,int hdrlen,struct xdr_buf *body,int body_offset,u8 *cksumkey, -struct xdr_netobj *cksumout) +unsigned int usage,struct xdr_netobj *cksumout) {struct hash_desc desc;struct scatterlist sg[1 ];
@@ -538,15 +538,18 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,int nblocks, nbytes;struct encryptor_desc desc;u32 cbcbytes; +unsigned int usage;if (kctx->initiate) { cipher = kctx->initiator_enc; aux_cipher = kctx->initiator_enc_aux; cksumkey = kctx->initiator_integ; + usage =KG_USAGE_INITIATOR_SEAL ; }else { cipher = kctx->acceptor_enc; aux_cipher = kctx->acceptor_enc_aux; cksumkey = kctx->acceptor_integ; + usage =KG_USAGE_ACCEPTOR_SEAL ; } blocksize =crypto_blkcipher_blocksize (cipher);
@@ -591,7 +594,8 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset, buf->pages = pages; err =make_checksum_v2 (kctx,NULL ,0 , buf, - offset +GSS_KRB5_TOK_HDR_LEN , cksumkey, &hmac); + offset +GSS_KRB5_TOK_HDR_LEN , + cksumkey, usage, &hmac); buf->pages = save_pages;if (err)return GSS_S_FAILURE ;
@@ -655,15 +659,18 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf,u8 pkt_hmac[GSS_KRB5_MAX_CKSUM_LEN ];int nblocks, blocksize, cbcbytes;struct decryptor_desc desc; +unsigned int usage;if (kctx->initiate) { cipher = kctx->acceptor_enc; aux_cipher = kctx->acceptor_enc_aux; cksum_key = kctx->acceptor_integ; + usage =KG_USAGE_ACCEPTOR_SEAL ; }else { cipher = kctx->initiator_enc; aux_cipher = kctx->initiator_enc_aux; cksum_key = kctx->initiator_integ; + usage =KG_USAGE_INITIATOR_SEAL ; } blocksize =crypto_blkcipher_blocksize (cipher);
@@ -706,7 +713,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, our_hmac_obj.data = our_hmac; ret =make_checksum_v2 (kctx,NULL ,0 , &subbuf,0 , - cksum_key, &our_hmac_obj); + cksum_key, usage, &our_hmac_obj);if (ret) goto out_err;
net/sunrpc/auth_gss/gss_krb5_seal.c +9 -4
@@ -143,7 +143,8 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text,else cksumkey =NULL ; -if (make_checksum (ctx, ptr,8 , text,0 , cksumkey, &md5cksum)) +if (make_checksum (ctx, ptr,8 , text,0 , cksumkey, +KG_USAGE_SIGN , &md5cksum))return GSS_S_FAILURE ;memcpy (ptr +GSS_KRB5_TOK_HDR_LEN , md5cksum.data, md5cksum.len);
@@ -171,6 +172,7 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,s32 now;u64 seq_send;u8 *cksumkey; +unsigned int cksum_usage;dprintk ("RPC: %s\n" , __func__);
@@ -183,13 +185,16 @@ gss_get_mic_v2(struct krb5_ctx *ctx, struct xdr_buf *text,spin_unlock (&krb5_seq_lock); *((u64 *)(krb5_hdr +8 )) =cpu_to_be64 (seq_send); -if (ctx->initiate) +if (ctx->initiate) { cksumkey = ctx->initiator_sign; -else + cksum_usage =KG_USAGE_INITIATOR_SIGN ; + }else { cksumkey = ctx->acceptor_sign; + cksum_usage =KG_USAGE_ACCEPTOR_SIGN ; + }if (make_checksum_v2 (ctx, krb5_hdr,GSS_KRB5_TOK_HDR_LEN , - text,0 , cksumkey, &cksumobj)) + text,0 , cksumkey, cksum_usage, &cksumobj))return GSS_S_FAILURE ;memcpy (krb5_hdr +GSS_KRB5_TOK_HDR_LEN , cksumobj.data, cksumobj.len);
net/sunrpc/auth_gss/gss_krb5_unseal.c +8 -4
@@ -116,7 +116,7 @@ gss_verify_mic_v1(struct krb5_ctx *ctx, cksumkey =NULL ;if (make_checksum (ctx, ptr,8 , message_buffer,0 , - cksumkey, &md5cksum)) + cksumkey,KG_USAGE_SIGN , &md5cksum))return GSS_S_FAILURE ; if (memcmp(md5cksum.data, ptr + GSS_KRB5_TOK_HDR_LEN,
@@ -155,6 +155,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,u8 *cksumkey;u8 flags;int i; +unsigned int cksum_usage;dprintk ("RPC: %s\n" , __func__);
@@ -175,13 +176,16 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,if (ptr[i] !=0xff )return GSS_S_DEFECTIVE_TOKEN ; -if (ctx->initiate) +if (ctx->initiate) { cksumkey = ctx->acceptor_sign; -else + cksum_usage =KG_USAGE_ACCEPTOR_SIGN ; + }else { cksumkey = ctx->initiator_sign; + cksum_usage =KG_USAGE_INITIATOR_SIGN ; + }if (make_checksum_v2 (ctx, ptr,GSS_KRB5_TOK_HDR_LEN , message_buffer,0 , - cksumkey, &cksumobj)) + cksumkey, cksum_usage, &cksumobj))return GSS_S_FAILURE ; if (memcmp(cksumobj.data, ptr + GSS_KRB5_TOK_HDR_LEN,
net/sunrpc/auth_gss/gss_krb5_wrap.c +2 -2
@@ -216,7 +216,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, tmp_pages = buf->pages; buf->pages = pages;if (make_checksum (kctx, ptr,8 , buf, offset + headlen - blocksize, - cksumkey, &md5cksum)) + cksumkey,KG_USAGE_SEAL , &md5cksum))return GSS_S_FAILURE ; buf->pages = tmp_pages;
@@ -299,7 +299,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) cksumkey =NULL ;if (make_checksum (kctx, ptr,8 , buf, crypt_offset, - cksumkey, &md5cksum)) + cksumkey,KG_USAGE_SEAL , &md5cksum))return GSS_S_FAILURE ; if (memcmp(md5cksum.data, ptr + GSS_KRB5_TOK_HDR_LEN,
Signature · 1 line
1.6.6.1
PATCH 18/23 gss_krb5: Save the raw session key in the context
In reply to [email protected]From: Kevin Coffman <[email protected]>
This is needed for deriving arcfour-hmac keys "on the fly" using the sequence number or checksu
--- include/linux/sunrpc/gss_krb5.h | 1 + net/sunrpc/auth_gss/gss_krb5_mech.c | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 14 deletions(-)
include/linux/sunrpc/gss_krb5.h +1 -0
@@ -101,6 +101,7 @@ struct krb5_ctx {struct crypto_blkcipher *initiator_enc;struct crypto_blkcipher *acceptor_enc_aux;struct crypto_blkcipher *initiator_enc_aux; +u8 Ksess[GSS_KRB5_MAX_KEYLEN ];/* session key */ u8 cksum[GSS_KRB5_MAX_KEYLEN ];s32 endtime;u32 seq_send;
net/sunrpc/auth_gss/gss_krb5_mech.c +13 -14
@@ -344,7 +344,7 @@ set_cdata(u8 cdata[GSS_KRB5_K5CLENGTH], u32 usage, u8 seed) }static int -context_derive_keys_des3 (struct krb5_ctx *ctx,u8 *rawkey,u32 keylen) +context_derive_keys_des3 (struct krb5_ctx *ctx) {struct xdr_netobj c, keyin, keyout;u8 cdata[GSS_KRB5_K5CLENGTH ];
@@ -353,18 +353,18 @@ context_derive_keys_des3(struct krb5_ctx *ctx, u8 *rawkey, u32 keylen) c.len =GSS_KRB5_K5CLENGTH ; c.data = cdata; - keyin.data = rawkey; - keyin.len = keylen; - keyout.len = keylen; + keyin.data = ctx->Ksess; + keyin.len = ctx->gk5e->keylength; + keyout.len = ctx->gk5e->keylength;/* seq uses the raw key */ ctx->seq =context_v2_alloc_cipher (ctx, ctx->gk5e->encrypt_name, - rawkey); + ctx->Ksess);if (ctx->seq ==NULL ) goto out_err; ctx->enc =context_v2_alloc_cipher (ctx, ctx->gk5e->encrypt_name, - rawkey); + ctx->Ksess);if (ctx->enc ==NULL ) goto out_free_seq;
@@ -389,7 +389,7 @@ out_err: }static int -context_derive_keys_new (struct krb5_ctx *ctx,u8 *rawkey,u32 keylen) +context_derive_keys_new (struct krb5_ctx *ctx) {struct xdr_netobj c, keyin, keyout;u8 cdata[GSS_KRB5_K5CLENGTH ];
@@ -398,9 +398,9 @@ context_derive_keys_new(struct krb5_ctx *ctx, u8 *rawkey, u32 keylen) c.len =GSS_KRB5_K5CLENGTH ; c.data = cdata; - keyin.data = rawkey; - keyin.len = keylen; - keyout.len = keylen; + keyin.data = ctx->Ksess; + keyin.len = ctx->gk5e->keylength; + keyout.len = ctx->gk5e->keylength;/* initiator seal encryption */ set_cdata (cdata,KG_USAGE_INITIATOR_SEAL ,KEY_USAGE_SEED_ENCRYPTION );
@@ -502,7 +502,6 @@ out_err:static int gss_import_v2_context (const void *p,const void *end,struct krb5_ctx *ctx) { -u8 rawkey[GSS_KRB5_MAX_KEYLEN ];int keylen; p =simple_get_bytes (p, end, &ctx->flags,sizeof (ctx->flags));
@@ -538,7 +537,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx) } keylen = ctx->gk5e->keylength; - p =simple_get_bytes (p, end, rawkey, keylen); + p =simple_get_bytes (p, end, ctx->Ksess, keylen);if (IS_ERR (p)) goto out_err;
@@ -557,10 +556,10 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx)switch (ctx->enctype) {case ENCTYPE_DES3_CBC_RAW : -return context_derive_keys_des3 (ctx, rawkey, keylen); +return context_derive_keys_des3 (ctx);case ENCTYPE_AES128_CTS_HMAC_SHA1_96 :case ENCTYPE_AES256_CTS_HMAC_SHA1_96 : -return context_derive_keys_new (ctx, rawkey, keylen); +return context_derive_keys_new (ctx);default :return -EINVAL ; }
Signature · 1 line
1.6.6.1
PATCH 19/23 gssd_krb5: More arcfour-hmac support
In reply to [email protected]From: Kevin Coffman <[email protected]>
For the arcfour-hmac support, the make_seq_num and get_seq_num functions need access to the kerberos context structure. This will be used in a later patch.
--- include/linux/sunrpc/gss_krb5.h | 5 +++-- net/sunrpc/auth_gss/gss_krb5_seal.c | 5 ++--- net/sunrpc/auth_gss/gss_krb5_seqnum.c | 6 ++++-- net/sunrpc/auth_gss/gss_krb5_unseal.c | 3 ++- net/sunrpc/auth_gss/gss_krb5_wrap.c | 6 +++--- 5 files changed, 14 insertions(+), 11 deletions(-)
include/linux/sunrpc/gss_krb5.h +3 -2
@@ -275,12 +275,13 @@ gss_decrypt_xdr_buf(struct crypto_blkcipher *tfm, struct xdr_buf *inbuf, int offset);s32 -krb5_make_seq_num (struct crypto_blkcipher *key, +krb5_make_seq_num (struct krb5_ctx *kctx, +struct crypto_blkcipher *key,int direction,u32 seqnum,unsigned char *cksum,unsigned char *buf);s32 -krb5_get_seq_num (struct crypto_blkcipher *key, +krb5_get_seq_num (struct krb5_ctx *kctx,unsigned char *cksum,unsigned char *buf,int *direction,u32 *seqnum);
net/sunrpc/auth_gss/gss_krb5_seal.c +2 -3
@@ -153,9 +153,8 @@ gss_get_mic_v1(struct krb5_ctx *ctx, struct xdr_buf *text, seq_send = ctx->seq_send++;spin_unlock (&krb5_seq_lock); -if (krb5_make_seq_num (ctx->seq, ctx->initiate ?0 :0xff , - seq_send, ptr +GSS_KRB5_TOK_HDR_LEN , - ptr +8 )) +if (krb5_make_seq_num (ctx, ctx->seq, ctx->initiate ?0 :0xff , + seq_send, ptr +GSS_KRB5_TOK_HDR_LEN , ptr +8 ))return GSS_S_FAILURE ;return (ctx->endtime < now) ?GSS_S_CONTEXT_EXPIRED :GSS_S_COMPLETE ;
net/sunrpc/auth_gss/gss_krb5_seqnum.c +4 -2
@@ -41,7 +41,8 @@#endif s32 -krb5_make_seq_num (struct crypto_blkcipher *key, +krb5_make_seq_num (struct krb5_ctx *kctx, +struct crypto_blkcipher *key,int direction,u32 seqnum,unsigned char *cksum,unsigned char *buf)
@@ -62,13 +63,14 @@ krb5_make_seq_num(struct crypto_blkcipher *key, }s32 -krb5_get_seq_num (struct crypto_blkcipher *key, +krb5_get_seq_num (struct krb5_ctx *kctx,unsigned char *cksum,unsigned char *buf,int *direction,u32 *seqnum) {s32 code;unsigned char plain[8 ]; +struct crypto_blkcipher *key = kctx->seq;dprintk ("RPC: krb5_get_seq_num:\n" );
net/sunrpc/auth_gss/gss_krb5_unseal.c +2 -1
@@ -132,7 +132,8 @@ gss_verify_mic_v1(struct krb5_ctx *ctx,/* do sequencing checks */ -if (krb5_get_seq_num (ctx->seq, ptr +GSS_KRB5_TOK_HDR_LEN , ptr +8 , &direction, &seqnum)) +if (krb5_get_seq_num (ctx, ptr +GSS_KRB5_TOK_HDR_LEN , ptr +8 , + &direction, &seqnum))return GSS_S_FAILURE ; if ((ctx->initiate && direction != 0xff) ||
net/sunrpc/auth_gss/gss_krb5_wrap.c +3 -3
@@ -228,7 +228,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,/* XXX would probably be more efficient to compute checksum * and encrypt at the same time: */ -if ((krb5_make_seq_num (kctx->seq, kctx->initiate ?0 :0xff , +if ((krb5_make_seq_num (kctx, kctx->seq, kctx->initiate ?0 :0xff , seq_send, ptr +GSS_KRB5_TOK_HDR_LEN , ptr +8 )))return GSS_S_FAILURE ;
@@ -315,8 +315,8 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)/* do sequencing checks */ -if (krb5_get_seq_num (kctx->seq, ptr +GSS_KRB5_TOK_HDR_LEN , ptr +8 , - &direction, &seqnum)) +if (krb5_get_seq_num (kctx, ptr +GSS_KRB5_TOK_HDR_LEN , + ptr +8 , &direction, &seqnum))return GSS_S_BAD_SIG ; if ((kctx->initiate && direction != 0xff) ||
Signature · 1 line
1.6.6.1
PATCH 20/23 gss_krb5: Use confounder length in wrap code
In reply to [email protected]From: Kevin Coffman <[email protected]>
All encryption types use a confounder at the beginning of the wrap token. In all encryption types except arcfour-hmac, the confounder is the same as the blocksize. arcfour-hmac has a blocksize of one, but uses an eight byte confounder.
Add an entry to the crypto framework definitions for the confounder length and change the wrap/unwrap code to use the confounder length rather than assuming it is always the blocksize.
--- include/linux/sunrpc/gss_krb5.h | 3 +++ net/sunrpc/auth_gss/gss_krb5_crypto.c | 6 +++--- net/sunrpc/auth_gss/gss_krb5_mech.c | 4 ++++ net/sunrpc/auth_gss/gss_krb5_wrap.c | 12 +++++++----- 4 files changed, 17 insertions(+), 8 deletions(-)
include/linux/sunrpc/gss_krb5.h +3 -0
@@ -64,6 +64,9 @@ struct gss_krb5_enctype {const u16 signalg;/* signing algorithm */ const u16 sealalg;/* sealing algorithm */ const u32 blocksize;/* encryption blocksize */ +const u32 conflen;/* confounder length +(normally the same as +the blocksize) */ const u32 cksumlength;/* checksum length */ const u32 keyed_cksum;/* is it a keyed cksum? */ const u32 keybytes;/* raw key len, in bytes */
net/sunrpc/auth_gss/gss_krb5_crypto.c +3 -3
@@ -555,9 +555,9 @@ gss_krb5_aes_encrypt(struct krb5_ctx *kctx, u32 offset,/* hide the gss token header and insert the confounder */ offset +=GSS_KRB5_TOK_HDR_LEN ; -if (xdr_extend_head (buf, offset, blocksize)) +if (xdr_extend_head (buf, offset, kctx->gk5e->conflen))return GSS_S_FAILURE ; -make_confounder (buf->head[0 ].iov_base + offset, blocksize); +make_confounder (buf->head[0 ].iov_base + offset, kctx->gk5e->conflen); offset -=GSS_KRB5_TOK_HDR_LEN ;if (buf->tail[0 ].iov_base !=NULL ) {
@@ -727,7 +727,7 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, ret =GSS_S_BAD_SIG ; goto out_err; } - *headskip =crypto_blkcipher_blocksize (cipher); + *headskip = kctx->gk5e->conflen; *tailskip = kctx->gk5e->cksumlength; out_err:if (ret && ret !=GSS_S_BAD_SIG )
net/sunrpc/auth_gss/gss_krb5_mech.c +4 -0
@@ -68,6 +68,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .keybytes = 7, .keylength = 8, .blocksize = 8, + .conflen = 8, .cksumlength = 8, .keyed_cksum = 0, },
@@ -88,6 +89,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .keybytes = 21, .keylength = 24, .blocksize = 8, + .conflen = 8, .cksumlength = 20, .keyed_cksum = 1, },
@@ -110,6 +112,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .keybytes = 16, .keylength = 16, .blocksize = 16, + .conflen = 16, .cksumlength = 12, .keyed_cksum = 1, },
@@ -132,6 +135,7 @@ static const struct gss_krb5_enctype supported_gss_krb5_enctypes[] = { .keybytes = 32, .keylength = 32, .blocksize = 16, + .conflen = 16, .cksumlength = 12, .keyed_cksum = 1, },
net/sunrpc/auth_gss/gss_krb5_wrap.c +7 -5
@@ -169,6 +169,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,struct page **tmp_pages;u32 seq_send;u8 *cksumkey; +u32 conflen = kctx->gk5e->conflen;dprintk ("RPC: %s\n" , __func__);
@@ -177,7 +178,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, blocksize =crypto_blkcipher_blocksize (kctx->enc);gss_krb5_add_padding (buf, offset, blocksize);BUG_ON ((buf->len - offset) % blocksize); - plainlen = blocksize + buf->len - offset; + plainlen = conflen + buf->len - offset; headlen =g_token_size (&kctx->mech_used, GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength + plainlen) -
@@ -205,7 +206,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,memset (ptr +4 ,0xff ,4 ); *(__be16 *)(ptr +4 ) =cpu_to_le16 (kctx->gk5e->sealalg); -make_confounder (msg_start, blocksize); +make_confounder (msg_start, conflen);if (kctx->gk5e->keyed_cksum) cksumkey = kctx->cksum;
@@ -215,7 +216,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset,/* XXXJBF: UGH!: */ tmp_pages = buf->pages; buf->pages = pages; -if (make_checksum (kctx, ptr,8 , buf, offset + headlen - blocksize, +if (make_checksum (kctx, ptr,8 , buf, offset + headlen - conflen, cksumkey,KG_USAGE_SEAL , &md5cksum))return GSS_S_FAILURE ; buf->pages = tmp_pages;
@@ -232,7 +233,7 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, seq_send, ptr + GSS_KRB5_TOK_HDR_LEN, ptr + 8)))return GSS_S_FAILURE ; -if (gss_encrypt_xdr_buf (kctx->enc, buf, offset + headlen - blocksize, +if (gss_encrypt_xdr_buf (kctx->enc, buf, offset + headlen - conflen, pages))return GSS_S_FAILURE ;
@@ -255,6 +256,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf)void *data_start, *orig_start;int data_len;int blocksize; +u32 conflen = kctx->gk5e->conflen;int crypt_offset;u8 *cksumkey;
@@ -328,7 +330,7 @@ gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, struct xdr_buf *buf) blocksize =crypto_blkcipher_blocksize (kctx->enc); data_start = ptr + (GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength) + - blocksize; + conflen; orig_start = buf->head[0 ].iov_base + offset; data_len = (buf->head[0 ].iov_base + buf->head[0 ].iov_len) - data_start;memmove (orig_start, data_start, data_len);
Signature · 1 line
1.6.6.1
PATCH 21/23 gss_krb5: Add support for rc4-hmac encryption
In reply to [email protected]From: Kevin Coffman <[email protected]>
Add necessary changes to add kernel support for the rc4-hmac Kerberos encryption type used by Microsoft and described in rfc4757.
--- include/linux/sunrpc/gss_krb5.h | 9 ++ net/sunrpc/auth_gss/gss_krb5_crypto.c | 255 +++++++++++++++++++++++++++++++++ net/sunrpc/auth_gss/gss_krb5_mech.c | 96 ++++++++++++ net/sunrpc/auth_gss/gss_krb5_seal.c | 1 + net/sunrpc/auth_gss/gss_krb5_seqnum.c | 77 ++++++++++ net/sunrpc/auth_gss/gss_krb5_unseal.c | 1 + net/sunrpc/auth_gss/gss_krb5_wrap.c | 66 +++++++-- 7 files changed, 492 insertions(+), 13 deletions(-)
include/linux/sunrpc/gss_krb5.h +9 -0
@@ -317,5 +317,14 @@ gss_krb5_aes_decrypt(struct krb5_ctx *kctx, u32 offset, struct xdr_buf *buf, u32 *plainoffset, u32 *plainlen); +int +krb5_rc4_setup_seq_key (struct krb5_ctx *kctx, +struct crypto_blkcipher *cipher, +unsigned char *cksum); + +int +krb5_rc4_setup_enc_key (struct krb5_ctx *kctx, +struct crypto_blkcipher *cipher, +s32 seqnum);void make_confounder (char *p,u32 conflen);
net/sunrpc/auth_gss/gss_krb5_crypto.c +255 -0
270 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_mech.c +96 -0
114 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_seal.c +1 -0
@@ -214,6 +214,7 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,BUG ();case ENCTYPE_DES_CBC_RAW :case ENCTYPE_DES3_CBC_RAW : +case ENCTYPE_ARCFOUR_HMAC :return gss_get_mic_v1 (ctx, text, token);case ENCTYPE_AES128_CTS_HMAC_SHA1_96 :case ENCTYPE_AES256_CTS_HMAC_SHA1_96 :
net/sunrpc/auth_gss/gss_krb5_seqnum.c +77 -0
101 lines not on this page · raw message
net/sunrpc/auth_gss/gss_krb5_unseal.c +1 -0
@@ -217,6 +217,7 @@ gss_verify_mic_kerberos(struct gss_ctx *gss_ctx,BUG ();case ENCTYPE_DES_CBC_RAW :case ENCTYPE_DES3_CBC_RAW : +case ENCTYPE_ARCFOUR_HMAC :return gss_verify_mic_v1 (ctx, message_buffer, read_token);case ENCTYPE_AES128_CTS_HMAC_SHA1_96 :case ENCTYPE_AES256_CTS_HMAC_SHA1_96 :
net/sunrpc/auth_gss/gss_krb5_wrap.c +53 -13
96 lines not on this page · raw message
Signature · 1 line
1.6.6.1
PATCH 22/23 Update the pipefs file
In reply to [email protected]From: Kevin Coffman <[email protected]>
Update the pipefs file indicating which Kerberos enctypes the kernel supports
--- net/sunrpc/rpc_pipe.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/rpc_pipe.c +1 -1
@@ -400,7 +400,7 @@ static const struct file_operations rpc_info_operations = {static int rpc_show_krb5_info (struct seq_file *m,void *v) { -seq_printf (m,"enctypes: 18,17,16,3,1,2\n" ); +seq_printf (m,"enctypes: 18,17,16,23,3,1,2\n" );return 0 ; }
Signature · 1 line
1.6.6.1
PATCH 23/23 Fixed a typo in gss_verify_mic_v2()
In reply to [email protected]From: Peter Staubach <[email protected]>
--- net/sunrpc/auth_gss/gss_krb5_unseal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/auth_gss/gss_krb5_unseal.c +1 -1
@@ -200,7 +200,7 @@ gss_verify_mic_v2(struct krb5_ctx *ctx,/* do sequencing checks */ - seqnum =be64_to_cpu ((__be64 *)ptr +8 ); + seqnum =be64_to_cpup ((__be64 *)ptr +8 );return GSS_S_COMPLETE ; }
Signature · 1 line
1.6.6.1