Lines Matching refs:ctx

55 static inline int selinux_authorizable_ctx(struct xfrm_sec_ctx *ctx)
57 return (ctx &&
58 (ctx->ctx_doi == XFRM_SC_DOI_LSM) &&
59 (ctx->ctx_alg == XFRM_SC_ALG_SELINUX));
80 struct xfrm_sec_ctx *ctx = NULL;
92 ctx = kmalloc(sizeof(*ctx) + str_len + 1, gfp);
93 if (!ctx)
96 ctx->ctx_doi = XFRM_SC_DOI_LSM;
97 ctx->ctx_alg = XFRM_SC_ALG_SELINUX;
98 ctx->ctx_len = str_len;
99 memcpy(ctx->ctx_str, &uctx[1], str_len);
100 ctx->ctx_str[str_len] = '\0';
101 rc = security_context_to_sid(&selinux_state, ctx->ctx_str, str_len,
102 &ctx->ctx_sid, gfp);
107 tsec->sid, ctx->ctx_sid,
112 *ctxp = ctx;
117 kfree(ctx);
124 static void selinux_xfrm_free(struct xfrm_sec_ctx *ctx)
126 if (!ctx)
130 kfree(ctx);
136 static int selinux_xfrm_delete(struct xfrm_sec_ctx *ctx)
140 if (!ctx)
144 tsec->sid, ctx->ctx_sid,
153 int selinux_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
159 if (!ctx)
163 if (!selinux_authorizable_ctx(ctx))
167 fl_secid, ctx->ctx_sid,
239 struct xfrm_sec_ctx *ctx = x->security;
242 sid_session = ctx->ctx_sid;
245 } else if (sid_session != ctx->ctx_sid) {
317 void selinux_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
319 selinux_xfrm_free(ctx);
325 int selinux_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
327 return selinux_xfrm_delete(ctx);
348 struct xfrm_sec_ctx *ctx;
363 ctx = kmalloc(sizeof(*ctx) + str_len, GFP_ATOMIC);
364 if (!ctx) {
369 ctx->ctx_doi = XFRM_SC_DOI_LSM;
370 ctx->ctx_alg = XFRM_SC_ALG_SELINUX;
371 ctx->ctx_sid = secid;
372 ctx->ctx_len = str_len;
373 memcpy(ctx->ctx_str, ctx_str, str_len);
375 x->security = ctx;
417 struct xfrm_sec_ctx *ctx = x->security;
418 peer_sid = ctx->ctx_sid;