aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_mech.c4
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_seal.c6
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_wrap.c25
3 files changed, 5 insertions, 30 deletions
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
index 17587163fcae..bf5435db8785 100644
--- a/net/sunrpc/auth_gss/gss_krb5_mech.c
+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
@@ -148,9 +148,11 @@ gss_import_sec_context_kerberos(const void *p,
148 goto out_err_free_ctx; 148 goto out_err_free_ctx;
149 if (tmp != SGN_ALG_DES_MAC_MD5) 149 if (tmp != SGN_ALG_DES_MAC_MD5)
150 goto out_err_free_ctx; 150 goto out_err_free_ctx;
151 p = simple_get_bytes(p, end, &ctx->sealalg, sizeof(ctx->sealalg)); 151 p = simple_get_bytes(p, end, &tmp, sizeof(tmp));
152 if (IS_ERR(p)) 152 if (IS_ERR(p))
153 goto out_err_free_ctx; 153 goto out_err_free_ctx;
154 if (tmp != SEAL_ALG_DES)
155 goto out_err_free_ctx;
154 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime)); 156 p = simple_get_bytes(p, end, &ctx->endtime, sizeof(ctx->endtime));
155 if (IS_ERR(p)) 157 if (IS_ERR(p))
156 goto out_err_free_ctx; 158 goto out_err_free_ctx;
diff --git a/net/sunrpc/auth_gss/gss_krb5_seal.c b/net/sunrpc/auth_gss/gss_krb5_seal.c
index f3f42a4465cf..f42e453e63ea 100644
--- a/net/sunrpc/auth_gss/gss_krb5_seal.c
+++ b/net/sunrpc/auth_gss/gss_krb5_seal.c
@@ -87,12 +87,6 @@ gss_get_mic_kerberos(struct gss_ctx *gss_ctx, struct xdr_buf *text,
87 87
88 now = get_seconds(); 88 now = get_seconds();
89 89
90 if (ctx->sealalg != SEAL_ALG_NONE && ctx->sealalg != SEAL_ALG_DES) {
91 dprintk("RPC: gss_krb5_seal: ctx->sealalg %d not supported\n",
92 ctx->sealalg);
93 return GSS_S_FAILURE;
94 }
95
96 token->len = g_token_size(&ctx->mech_used, 22); 90 token->len = g_token_size(&ctx->mech_used, 22);
97 91
98 ptr = token->data; 92 ptr = token->data;
diff --git a/net/sunrpc/auth_gss/gss_krb5_wrap.c b/net/sunrpc/auth_gss/gss_krb5_wrap.c
index 63b06ee2d542..bf25f4d9acd1 100644
--- a/net/sunrpc/auth_gss/gss_krb5_wrap.c
+++ b/net/sunrpc/auth_gss/gss_krb5_wrap.c
@@ -133,12 +133,6 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
133 133
134 now = get_seconds(); 134 now = get_seconds();
135 135
136 if (kctx->sealalg != SEAL_ALG_NONE && kctx->sealalg != SEAL_ALG_DES) {
137 dprintk("RPC: gss_krb5_seal: kctx->sealalg %d not supported\n",
138 kctx->sealalg);
139 return GSS_S_FAILURE;
140 }
141
142 blocksize = crypto_blkcipher_blocksize(kctx->enc); 136 blocksize = crypto_blkcipher_blocksize(kctx->enc);
143 gss_krb5_add_padding(buf, offset, blocksize); 137 gss_krb5_add_padding(buf, offset, blocksize);
144 BUG_ON((buf->len - offset) % blocksize); 138 BUG_ON((buf->len - offset) % blocksize);
@@ -169,7 +163,7 @@ gss_wrap_kerberos(struct gss_ctx *ctx, int offset,
169 163
170 *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5); 164 *(__be16 *)(krb5_hdr + 2) = htons(SGN_ALG_DES_MAC_MD5);
171 memset(krb5_hdr + 4, 0xff, 4); 165 memset(krb5_hdr + 4, 0xff, 4);
172 *(__be16 *)(krb5_hdr + 4) = htons(kctx->sealalg); 166 *(__be16 *)(krb5_hdr + 4) = htons(SEAL_ALG_DES);
173 167
174 make_confounder(msg_start, blocksize); 168 make_confounder(msg_start, blocksize);
175 169
@@ -245,26 +239,11 @@ gss_unwrap_kerberos(struct gss_ctx *ctx, int offset, struct xdr_buf *buf)
245 if ((ptr[4] != 0xff) || (ptr[5] != 0xff)) 239 if ((ptr[4] != 0xff) || (ptr[5] != 0xff))
246 return GSS_S_DEFECTIVE_TOKEN; 240 return GSS_S_DEFECTIVE_TOKEN;
247 241
248 if (sealalg == 0xffff) 242 if (sealalg != SEAL_ALG_DES)
249 return GSS_S_DEFECTIVE_TOKEN; 243 return GSS_S_DEFECTIVE_TOKEN;
250 if (signalg != SGN_ALG_DES_MAC_MD5) 244 if (signalg != SGN_ALG_DES_MAC_MD5)
251 return GSS_S_DEFECTIVE_TOKEN; 245 return GSS_S_DEFECTIVE_TOKEN;
252 246
253 /* in the current spec, there is only one valid seal algorithm per
254 key type, so a simple comparison is ok */
255
256 if (sealalg != kctx->sealalg)
257 return GSS_S_DEFECTIVE_TOKEN;
258
259 /* there are several mappings of seal algorithms to sign algorithms,
260 but few enough that we can try them all. */
261
262 if ((kctx->sealalg == SEAL_ALG_NONE && signalg > 1) ||
263 (kctx->sealalg == SEAL_ALG_1 && signalg != SGN_ALG_3) ||
264 (kctx->sealalg == SEAL_ALG_DES3KD &&
265 signalg != SGN_ALG_HMAC_SHA1_DES3_KD))
266 return GSS_S_DEFECTIVE_TOKEN;
267
268 if (gss_decrypt_xdr_buf(kctx->enc, buf, 247 if (gss_decrypt_xdr_buf(kctx->enc, buf,
269 ptr + 22 - (unsigned char *)buf->head[0].iov_base)) 248 ptr + 22 - (unsigned char *)buf->head[0].iov_base))
270 return GSS_S_DEFECTIVE_TOKEN; 249 return GSS_S_DEFECTIVE_TOKEN;