Lines Matching refs:ctx

114 gss_get_ctx(struct gss_cl_ctx *ctx)  in gss_get_ctx()  argument
116 refcount_inc(&ctx->count); in gss_get_ctx()
117 return ctx; in gss_get_ctx()
121 gss_put_ctx(struct gss_cl_ctx *ctx) in gss_put_ctx() argument
123 if (refcount_dec_and_test(&ctx->count)) in gss_put_ctx()
124 gss_free_ctx(ctx); in gss_put_ctx()
133 gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx) in gss_cred_set_ctx() argument
139 gss_get_ctx(ctx); in gss_cred_set_ctx()
140 rcu_assign_pointer(gss_cred->gc_ctx, ctx); in gss_cred_set_ctx()
150 struct gss_cl_ctx *ctx = NULL; in gss_cred_get_ctx() local
153 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_cred_get_ctx()
154 if (ctx) in gss_cred_get_ctx()
155 gss_get_ctx(ctx); in gss_cred_get_ctx()
157 return ctx; in gss_cred_get_ctx()
163 struct gss_cl_ctx *ctx; in gss_alloc_context() local
165 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); in gss_alloc_context()
166 if (ctx != NULL) { in gss_alloc_context()
167 ctx->gc_proc = RPC_GSS_PROC_DATA; in gss_alloc_context()
168 ctx->gc_seq = 1; /* NetApp 6.4R1 doesn't accept seq. no. 0 */ in gss_alloc_context()
169 spin_lock_init(&ctx->gc_seq_lock); in gss_alloc_context()
170 refcount_set(&ctx->count,1); in gss_alloc_context()
172 return ctx; in gss_alloc_context()
177 gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct gss_api_mech *gm) in gss_fill_context() argument
195 ctx->gc_expiry = now + ((unsigned long)timeout * HZ); in gss_fill_context()
202 ctx->gc_win = window_size; in gss_fill_context()
204 if (ctx->gc_win == 0) { in gss_fill_context()
216 p = simple_get_netobj(p, end, &ctx->gc_wire_ctx); in gss_fill_context()
228 ret = gss_import_sec_context(p, seclen, gm, &ctx->gc_gss_ctx, NULL, GFP_KERNEL); in gss_fill_context()
242 p = simple_get_netobj(q, end, &ctx->gc_acceptor); in gss_fill_context()
246 trace_rpcgss_context(window_size, ctx->gc_expiry, now, timeout, in gss_fill_context()
247 ctx->gc_acceptor.len, ctx->gc_acceptor.data); in gss_fill_context()
269 struct gss_cl_ctx *ctx; member
306 if (gss_msg->ctx != NULL) in gss_release_msg()
307 gss_put_ctx(gss_msg->ctx); in gss_release_msg()
377 if (gss_msg->ctx == NULL) in gss_handle_downcall_result()
380 gss_cred_set_ctx(&gss_cred->gc_base, gss_msg->ctx); in gss_handle_downcall_result()
623 else if (gss_msg->ctx == NULL && gss_msg->msg.errno >= 0) { in gss_refresh_upcall()
679 if (gss_msg->ctx != NULL || gss_msg->msg.errno < 0) { in gss_create_upcall()
689 if (gss_msg->ctx) { in gss_create_upcall()
691 gss_cred_set_ctx(cred, gss_msg->ctx); in gss_create_upcall()
729 struct gss_cl_ctx *ctx; in gss_pipe_downcall() local
759 ctx = gss_alloc_context(); in gss_pipe_downcall()
760 if (ctx == NULL) in gss_pipe_downcall()
774 p = gss_fill_context(p, end, ctx, gss_msg->auth->mech); in gss_pipe_downcall()
796 gss_msg->ctx = gss_get_ctx(ctx); in gss_pipe_downcall()
805 gss_put_ctx(ctx); in gss_pipe_downcall()
1251 struct gss_cl_ctx *ctx = in gss_dup_cred() local
1261 rcu_assign_pointer(new->gc_ctx, ctx); in gss_dup_cred()
1262 gss_get_ctx(ctx); in gss_dup_cred()
1278 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1); in gss_send_destroy_context() local
1284 ctx->gc_proc = RPC_GSS_PROC_DESTROY; in gss_send_destroy_context()
1300 gss_do_free_ctx(struct gss_cl_ctx *ctx) in gss_do_free_ctx() argument
1302 gss_delete_sec_context(&ctx->gc_gss_ctx); in gss_do_free_ctx()
1303 kfree(ctx->gc_wire_ctx.data); in gss_do_free_ctx()
1304 kfree(ctx->gc_acceptor.data); in gss_do_free_ctx()
1305 kfree(ctx); in gss_do_free_ctx()
1311 struct gss_cl_ctx *ctx = container_of(head, struct gss_cl_ctx, gc_rcu); in gss_free_ctx_callback() local
1312 gss_do_free_ctx(ctx); in gss_free_ctx_callback()
1316 gss_free_ctx(struct gss_cl_ctx *ctx) in gss_free_ctx() argument
1318 call_rcu(&ctx->gc_rcu, gss_free_ctx_callback); in gss_free_ctx()
1339 struct gss_cl_ctx *ctx = rcu_dereference_protected(gss_cred->gc_ctx, 1); in gss_destroy_nullcred() local
1344 if (ctx) in gss_destroy_nullcred()
1345 gss_put_ctx(ctx); in gss_destroy_nullcred()
1416 struct gss_cl_ctx *ctx; in gss_stringify_acceptor() local
1421 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_stringify_acceptor()
1422 if (!ctx) in gss_stringify_acceptor()
1425 len = ctx->gc_acceptor.len; in gss_stringify_acceptor()
1437 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_stringify_acceptor()
1440 if (!ctx || !ctx->gc_acceptor.len) { in gss_stringify_acceptor()
1446 acceptor = &ctx->gc_acceptor; in gss_stringify_acceptor()
1474 struct gss_cl_ctx *ctx; in gss_key_timeout() local
1479 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_key_timeout()
1480 if (!ctx || time_after(timeout, ctx->gc_expiry)) in gss_key_timeout()
1491 struct gss_cl_ctx *ctx; in gss_match() local
1498 ctx = rcu_dereference(gss_cred->gc_ctx); in gss_match()
1499 if (!ctx || time_after(jiffies, ctx->gc_expiry)) { in gss_match()
1532 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_marshal() local
1544 ctx->gc_wire_ctx.len); in gss_marshal()
1550 spin_lock(&ctx->gc_seq_lock); in gss_marshal()
1551 seqno = (ctx->gc_seq < MAXSEQ) ? ctx->gc_seq++ : MAXSEQ; in gss_marshal()
1553 spin_unlock(&ctx->gc_seq_lock); in gss_marshal()
1559 *p++ = cpu_to_be32(ctx->gc_proc); in gss_marshal()
1562 p = xdr_encode_netobj(p, &ctx->gc_wire_ctx); in gss_marshal()
1578 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &verf_buf, &mic); in gss_marshal()
1587 gss_put_ctx(ctx); in gss_marshal()
1675 gss_validate_seqno_mic(struct gss_cl_ctx *ctx, u32 seqno, __be32 *seq, __be32 *p, u32 len) in gss_validate_seqno_mic() argument
1687 return gss_verify_mic(ctx->gc_gss_ctx, &verf_buf, &mic); in gss_validate_seqno_mic()
1694 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_validate() local
1715 maj_stat = gss_validate_seqno_mic(ctx, task->tk_rqstp->rq_seqnos[0], seq, p, len); in gss_validate()
1718 maj_stat = gss_validate_seqno_mic(ctx, task->tk_rqstp->rq_seqnos[i++], seq, p, len); in gss_validate()
1730 gss_put_ctx(ctx); in gss_validate()
1744 gss_wrap_req_integ(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_wrap_req_integ() argument
1772 maj_stat = gss_get_mic(ctx->gc_gss_ctx, &integ_buf, &mic); in gss_wrap_req_integ()
1837 gss_wrap_req_priv(struct rpc_cred *cred, struct gss_cl_ctx *ctx, in gss_wrap_req_priv() argument
1880 maj_stat = gss_wrap(ctx->gc_gss_ctx, offset, snd_buf, inpages); in gss_wrap_req_priv()
1918 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_wrap_req() local
1922 if (ctx->gc_proc != RPC_GSS_PROC_DATA) { in gss_wrap_req()
1934 status = gss_wrap_req_integ(cred, ctx, task, xdr); in gss_wrap_req()
1937 status = gss_wrap_req_priv(cred, ctx, task, xdr); in gss_wrap_req()
1943 gss_put_ctx(ctx); in gss_wrap_req()
1989 struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp, in gss_unwrap_resp_integ() argument
2035 maj_stat = gss_verify_mic(ctx->gc_gss_ctx, &gss_data, &mic); in gss_unwrap_resp_integ()
2061 struct gss_cl_ctx *ctx, struct rpc_rqst *rqstp, in gss_unwrap_resp_priv() argument
2077 maj_stat = gss_unwrap(ctx->gc_gss_ctx, offset, in gss_unwrap_resp_priv()
2092 gss_update_rslack(task, cred, 2 + ctx->gc_gss_ctx->align, in gss_unwrap_resp_priv()
2093 2 + ctx->gc_gss_ctx->slack); in gss_unwrap_resp_priv()
2118 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_xmit_need_reencode() local
2122 if (!ctx) in gss_xmit_need_reencode()
2125 if (gss_seq_is_newer(*req->rq_seqnos, READ_ONCE(ctx->gc_seq))) in gss_xmit_need_reencode()
2128 seq_xmit = READ_ONCE(ctx->gc_seq_xmit); in gss_xmit_need_reencode()
2132 seq_xmit = cmpxchg(&ctx->gc_seq_xmit, tmp, *req->rq_seqnos); in gss_xmit_need_reencode()
2139 win = ctx->gc_win; in gss_xmit_need_reencode()
2144 gss_put_ctx(ctx); in gss_xmit_need_reencode()
2157 struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); in gss_unwrap_resp() local
2160 if (ctx->gc_proc != RPC_GSS_PROC_DATA) in gss_unwrap_resp()
2167 status = gss_unwrap_resp_integ(task, cred, ctx, rqstp, xdr); in gss_unwrap_resp()
2170 status = gss_unwrap_resp_priv(task, cred, ctx, rqstp, xdr); in gss_unwrap_resp()
2179 gss_put_ctx(ctx); in gss_unwrap_resp()