Lines Matching refs:kctx
158 gss_wrap_kerberos_v1(struct krb5_ctx *kctx, int offset, in gss_wrap_kerberos_v1() argument
171 u32 conflen = kctx->gk5e->conflen; in gss_wrap_kerberos_v1()
177 blocksize = crypto_sync_skcipher_blocksize(kctx->enc); in gss_wrap_kerberos_v1()
182 headlen = g_token_size(&kctx->mech_used, in gss_wrap_kerberos_v1()
183 GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength + plainlen) - in gss_wrap_kerberos_v1()
193 g_make_token_header(&kctx->mech_used, in gss_wrap_kerberos_v1()
195 kctx->gk5e->cksumlength + plainlen, &ptr); in gss_wrap_kerberos_v1()
202 msg_start = ptr + GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength; in gss_wrap_kerberos_v1()
209 *(__le16 *)(ptr + 2) = cpu_to_le16(kctx->gk5e->signalg); in gss_wrap_kerberos_v1()
210 *(__le16 *)(ptr + 4) = cpu_to_le16(kctx->gk5e->sealalg); in gss_wrap_kerberos_v1()
216 if (kctx->gk5e->keyed_cksum) in gss_wrap_kerberos_v1()
217 cksumkey = kctx->cksum; in gss_wrap_kerberos_v1()
224 if (make_checksum(kctx, ptr, 8, buf, offset + headlen - conflen, in gss_wrap_kerberos_v1()
231 seq_send = atomic_fetch_inc(&kctx->seq_send); in gss_wrap_kerberos_v1()
235 if ((krb5_make_seq_num(kctx, kctx->seq, kctx->initiate ? 0 : 0xff, in gss_wrap_kerberos_v1()
239 if (gss_encrypt_xdr_buf(kctx->enc, buf, in gss_wrap_kerberos_v1()
243 return (kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE; in gss_wrap_kerberos_v1()
247 gss_unwrap_kerberos_v1(struct krb5_ctx *kctx, int offset, int len, in gss_unwrap_kerberos_v1() argument
264 u32 conflen = kctx->gk5e->conflen; in gss_unwrap_kerberos_v1()
272 if (g_verify_token_header(&kctx->mech_used, &bodysize, &ptr, in gss_unwrap_kerberos_v1()
285 if (signalg != kctx->gk5e->signalg) in gss_unwrap_kerberos_v1()
289 if (sealalg != kctx->gk5e->sealalg) in gss_unwrap_kerberos_v1()
299 crypt_offset = ptr + (GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength) - in gss_unwrap_kerberos_v1()
303 if (gss_decrypt_xdr_buf(kctx->enc, buf, crypt_offset)) in gss_unwrap_kerberos_v1()
306 if (kctx->gk5e->keyed_cksum) in gss_unwrap_kerberos_v1()
307 cksumkey = kctx->cksum; in gss_unwrap_kerberos_v1()
311 if (make_checksum(kctx, ptr, 8, buf, crypt_offset, in gss_unwrap_kerberos_v1()
316 kctx->gk5e->cksumlength)) in gss_unwrap_kerberos_v1()
323 if (now > kctx->endtime) in gss_unwrap_kerberos_v1()
328 if (krb5_get_seq_num(kctx, ptr + GSS_KRB5_TOK_HDR_LEN, in gss_unwrap_kerberos_v1()
332 if ((kctx->initiate && direction != 0xff) || in gss_unwrap_kerberos_v1()
333 (!kctx->initiate && direction != 0)) in gss_unwrap_kerberos_v1()
339 blocksize = crypto_sync_skcipher_blocksize(kctx->enc); in gss_unwrap_kerberos_v1()
340 data_start = ptr + (GSS_KRB5_TOK_HDR_LEN + kctx->gk5e->cksumlength) + in gss_unwrap_kerberos_v1()
409 gss_wrap_kerberos_v2(struct krb5_ctx *kctx, u32 offset, in gss_wrap_kerberos_v2() argument
421 if (kctx->gk5e->encrypt_v2 == NULL) in gss_wrap_kerberos_v2()
433 if ((kctx->flags & KRB5_CTX_FLAG_INITIATOR) == 0) in gss_wrap_kerberos_v2()
435 if ((kctx->flags & KRB5_CTX_FLAG_ACCEPTOR_SUBKEY) != 0) in gss_wrap_kerberos_v2()
449 *be64ptr = cpu_to_be64(atomic64_fetch_inc(&kctx->seq_send64)); in gss_wrap_kerberos_v2()
451 err = (*kctx->gk5e->encrypt_v2)(kctx, offset, buf, pages); in gss_wrap_kerberos_v2()
456 return (kctx->endtime < now) ? GSS_S_CONTEXT_EXPIRED : GSS_S_COMPLETE; in gss_wrap_kerberos_v2()
460 gss_unwrap_kerberos_v2(struct krb5_ctx *kctx, int offset, int len, in gss_unwrap_kerberos_v2() argument
476 if (kctx->gk5e->decrypt_v2 == NULL) in gss_unwrap_kerberos_v2()
485 if ((!kctx->initiate && (flags & KG2_TOKEN_FLAG_SENTBYACCEPTOR)) || in gss_unwrap_kerberos_v2()
486 (kctx->initiate && !(flags & KG2_TOKEN_FLAG_SENTBYACCEPTOR))) in gss_unwrap_kerberos_v2()
508 err = (*kctx->gk5e->decrypt_v2)(kctx, offset, len, buf, in gss_unwrap_kerberos_v2()
534 if (now > kctx->endtime) in gss_unwrap_kerberos_v2()
564 struct krb5_ctx *kctx = gctx->internal_ctx_id; in gss_wrap_kerberos() local
566 switch (kctx->enctype) { in gss_wrap_kerberos()
571 return gss_wrap_kerberos_v1(kctx, offset, buf, pages); in gss_wrap_kerberos()
574 return gss_wrap_kerberos_v2(kctx, offset, buf, pages); in gss_wrap_kerberos()
582 struct krb5_ctx *kctx = gctx->internal_ctx_id; in gss_unwrap_kerberos() local
584 switch (kctx->enctype) { in gss_unwrap_kerberos()
589 return gss_unwrap_kerberos_v1(kctx, offset, len, buf, in gss_unwrap_kerberos()
593 return gss_unwrap_kerberos_v2(kctx, offset, len, buf, in gss_unwrap_kerberos()