Lines Matching refs:ctx
114 gss_get_ctx(struct gss_cl_ctx *ctx)
116 refcount_inc(&ctx->count);
117 return ctx;
121 gss_put_ctx(struct gss_cl_ctx *ctx)
123 if (refcount_dec_and_test(&ctx->count))
124 gss_free_ctx(ctx);
133 gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
139 gss_get_ctx(ctx);
140 rcu_assign_pointer(gss_cred->gc_ctx, ctx);
150 struct gss_cl_ctx *ctx = NULL;
153 ctx = rcu_dereference(gss_cred->gc_ctx);
154 if (ctx)
155 gss_get_ctx(ctx);
157 return ctx;
163 struct gss_cl_ctx *ctx;
165 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
166 if (ctx != NULL) {
167 ctx->gc_proc = RPC_GSS_PROC_DATA;
168 ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */
169 spin_lock_init(&ctx->gc_seq_lock);
170 refcount_set(&ctx->count,1);
172 return ctx;
177 gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct gss_api_mech *gm)
195 ctx->gc_expiry = now + ((unsigned long)timeout * HZ);
202 ctx->gc_win = window_size;
203 /* gssd signals an error by passing ctx->gc_win = 0: */
204 if (ctx->gc_win == 0) {
216 p = simple_get_netobj(p, end, &ctx->gc_wire_ctx);
228 ret = gss_import_sec_context(p, seclen, gm, &ctx->gc_gss_ctx, NULL, GFP_KERNEL);
242 p = simple_get_netobj(q, end, &ctx->gc_acceptor);
246 trace_rpcgss_context(window_size, ctx->gc_expiry, now, timeout,
247 ctx->gc_acceptor.len, ctx->gc_acceptor.data);
269 struct gss_cl_ctx *ctx;
306 if (gss_msg->ctx != NULL)
307 gss_put_ctx(gss_msg->ctx);
377 if (gss_msg->ctx == NULL)
380 gss_cred_set_ctx(&gss_cred->gc_base, gss_msg->ctx);
623 else if (gss_msg->ctx == NULL && gss_msg->msg.errno >= 0) {
679 if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) {
689 if (gss_msg->ctx) {
691 gss_cred_set_ctx(cred, gss_msg->ctx);
729 struct gss_cl_ctx *ctx;
759 ctx = gss_alloc_context();
760 if (ctx == NULL)
774 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
796 gss_msg->ctx = gss_get_ctx(ctx);
805 gss_put_ctx(ctx);
1260 struct gss_cl_ctx *ctx =
1270 rcu_assign_pointer(new->gc_ctx, ctx);
1271 gss_get_ctx(ctx);
1287 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1);
1293 ctx->gc_proc = RPC_GSS_PROC_DESTROY;
1309 gss_do_free_ctx(struct gss_cl_ctx *ctx)
1311 gss_delete_sec_context(&ctx->gc_gss_ctx);
1312 kfree(ctx->gc_wire_ctx.data);
1313 kfree(ctx->gc_acceptor.data);
1314 kfree(ctx);
1320 struct gss_cl_ctx *ctx = container_of(head, struct gss_cl_ctx, gc_rcu);
1321 gss_do_free_ctx(ctx);
1325 gss_free_ctx(struct gss_cl_ctx *ctx)
1327 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback);
1348 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1);
1353 if (ctx)
1354 gss_put_ctx(ctx);
1425 struct gss_cl_ctx *ctx;
1430 ctx = rcu_dereference(gss_cred->gc_ctx);
1431 if (!ctx)
1434 len = ctx->gc_acceptor.len;
1446 ctx = rcu_dereference(gss_cred->gc_ctx);
1448 /* did the ctx disappear or was it replaced by one with no acceptor? */
1449 if (!ctx || !ctx->gc_acceptor.len) {
1455 acceptor = &ctx->gc_acceptor;
1483 struct gss_cl_ctx *ctx;
1488 ctx = rcu_dereference(gss_cred->gc_ctx);
1489 if (!ctx || time_after(timeout, ctx->gc_expiry))
1500 struct gss_cl_ctx *ctx;
1507 ctx = rcu_dereference(gss_cred->gc_ctx);
1508 if (!ctx || time_after(jiffies, ctx->gc_expiry)) {
1541 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
1552 ctx->gc_wire_ctx.len);
1558 spin_lock(&ctx->gc_seq_lock);
1559 req->rq_seqno = (ctx->gc_seq < MAXSEQ) ? ctx->gc_seq++ : MAXSEQ;
1560 spin_unlock(&ctx->gc_seq_lock);
1566 *p++ = cpu_to_be32(ctx->gc_proc);
1569 p = xdr_encode_netobj(p, &ctx->gc_wire_ctx);
1585 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &verf_buf, &mic);
1594 gss_put_ctx(ctx);
1685 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
1714 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic);
1726 gss_put_ctx(ctx);
1740 gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1768 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &integ_buf, &mic);
1833 gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx,
1876 maj_stat = gss_wrap(ctx->gc_gss_ctx, offset, snd_buf, inpages);
1912 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
1916 if (ctx->gc_proc != RPC_GSS_PROC_DATA) {
1928 status = gss_wrap_req_integ(cred, ctx, task, xdr);
1931 status = gss_wrap_req_priv(cred, ctx, task, xdr);
1937 gss_put_ctx(ctx);
1983 struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp,
2029 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &gss_data, &mic);
2055 struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp,
2071 maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset,
2086 gss_update_rslack(task, cred, 2 + ctx->gc_gss_ctx->align,
2087 2 + ctx->gc_gss_ctx->slack);
2112 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
2116 if (!ctx)
2119 if (gss_seq_is_newer(req->rq_seqno, READ_ONCE(ctx->gc_seq)))
2122 seq_xmit = READ_ONCE(ctx->gc_seq_xmit);
2126 seq_xmit = cmpxchg(&ctx->gc_seq_xmit, tmp, req->rq_seqno);
2133 win = ctx->gc_win;
2138 gss_put_ctx(ctx);
2151 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
2154 if (ctx->gc_proc != RPC_GSS_PROC_DATA)
2161 status = gss_unwrap_resp_integ(task, cred, ctx, rqstp, xdr);
2164 status = gss_unwrap_resp_priv(task, cred, ctx, rqstp, xdr);
2173 gss_put_ctx(ctx);