diff options
Diffstat (limited to 'net/sunrpc/auth_gss/gss_krb5_wrap.c')
-rw-r--r-- | net/sunrpc/auth_gss/gss_krb5_wrap.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c index 42560e55d978..4b614c604fe0 100644 --- a/net/sunrpc/auth_gss/gss_krb5_wrap.c +++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c | |||
@@ -201,9 +201,15 @@ gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, | |||
201 | 201 | ||
202 | msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength; | 202 | msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength; |
203 | 203 | ||
204 | *(__be16 *)(ptr + 2) = cpu_to_le16(kctx->gk5e->signalg); | 204 | /* |
205 | memset(ptr + 4, 0xff, 4); | 205 | * signalg and sealalg are stored as if they were converted from LE |
206 | *(__be16 *)(ptr + 4) = cpu_to_le16(kctx->gk5e->sealalg); | 206 | * to host endian, even though they're opaque pairs of bytes according |
207 | * to the RFC. | ||
208 | */ | ||
209 | *(__le16 *)(ptr + 2) = cpu_to_le16(kctx->gk5e->signalg); | ||
210 | *(__le16 *)(ptr + 4) = cpu_to_le16(kctx->gk5e->sealalg); | ||
211 | ptr[6] = 0xff; | ||
212 | ptr[7] = 0xff; | ||
207 | 213 | ||
208 | gss_krb5_make_confounder(msg_start, conflen); | 214 | gss_krb5_make_confounder(msg_start, conflen); |
209 | 215 | ||
@@ -438,7 +444,7 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, | |||
438 | u8 *ptr, *plainhdr; | 444 | u8 *ptr, *plainhdr; |
439 | s32 now; | 445 | s32 now; |
440 | u8 flags = 0x00; | 446 | u8 flags = 0x00; |
441 | __be16 *be16ptr, ec = 0; | 447 | __be16 *be16ptr; |
442 | __be64 *be64ptr; | 448 | __be64 *be64ptr; |
443 | u32 err; | 449 | u32 err; |
444 | 450 | ||
@@ -468,16 +474,16 @@ gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, | |||
468 | be16ptr = (__be16 *)ptr; | 474 | be16ptr = (__be16 *)ptr; |
469 | 475 | ||
470 | blocksize = crypto_blkcipher_blocksize(kctx->acceptor_enc); | 476 | blocksize = crypto_blkcipher_blocksize(kctx->acceptor_enc); |
471 | *be16ptr++ = cpu_to_be16(ec); | 477 | *be16ptr++ = 0; |
472 | /* "inner" token header always uses 0 for RRC */ | 478 | /* "inner" token header always uses 0 for RRC */ |
473 | *be16ptr++ = cpu_to_be16(0); | 479 | *be16ptr++ = 0; |
474 | 480 | ||
475 | be64ptr = (__be64 *)be16ptr; | 481 | be64ptr = (__be64 *)be16ptr; |
476 | spin_lock(&krb5_seq_lock); | 482 | spin_lock(&krb5_seq_lock); |
477 | *be64ptr = cpu_to_be64(kctx->seq_send64++); | 483 | *be64ptr = cpu_to_be64(kctx->seq_send64++); |
478 | spin_unlock(&krb5_seq_lock); | 484 | spin_unlock(&krb5_seq_lock); |
479 | 485 | ||
480 | err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, ec, pages); | 486 | err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, pages); |
481 | if (err) | 487 | if (err) |
482 | return err; | 488 | return err; |
483 | 489 | ||