auth_gss.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * linux/include/linux/sunrpc/auth_gss.h
  4. *
  5. * Declarations for RPCSEC_GSS
  6. *
  7. * Dug Song <[email protected]>
  8. * Andy Adamson <[email protected]>
  9. * Bruce Fields <[email protected]>
  10. * Copyright (c) 2000 The Regents of the University of Michigan
  11. */
  12. #ifndef _LINUX_SUNRPC_AUTH_GSS_H
  13. #define _LINUX_SUNRPC_AUTH_GSS_H
  14. #include <linux/refcount.h>
  15. #include <linux/sunrpc/auth.h>
  16. #include <linux/sunrpc/svc.h>
  17. #include <linux/sunrpc/gss_api.h>
  18. #define RPC_GSS_VERSION 1
  19. #define MAXSEQ 0x80000000 /* maximum legal sequence number, from rfc 2203 */
  20. enum rpc_gss_proc {
  21. RPC_GSS_PROC_DATA = 0,
  22. RPC_GSS_PROC_INIT = 1,
  23. RPC_GSS_PROC_CONTINUE_INIT = 2,
  24. RPC_GSS_PROC_DESTROY = 3
  25. };
  26. enum rpc_gss_svc {
  27. RPC_GSS_SVC_NONE = 1,
  28. RPC_GSS_SVC_INTEGRITY = 2,
  29. RPC_GSS_SVC_PRIVACY = 3
  30. };
  31. /* on-the-wire gss cred: */
  32. struct rpc_gss_wire_cred {
  33. u32 gc_v; /* version */
  34. u32 gc_proc; /* control procedure */
  35. u32 gc_seq; /* sequence number */
  36. u32 gc_svc; /* service */
  37. struct xdr_netobj gc_ctx; /* context handle */
  38. };
  39. /* on-the-wire gss verifier: */
  40. struct rpc_gss_wire_verf {
  41. u32 gv_flavor;
  42. struct xdr_netobj gv_verf;
  43. };
  44. /* return from gss NULL PROC init sec context */
  45. struct rpc_gss_init_res {
  46. struct xdr_netobj gr_ctx; /* context handle */
  47. u32 gr_major; /* major status */
  48. u32 gr_minor; /* minor status */
  49. u32 gr_win; /* sequence window */
  50. struct xdr_netobj gr_token; /* token */
  51. };
  52. /* The gss_cl_ctx struct holds all the information the rpcsec_gss client
  53. * code needs to know about a single security context. In particular,
  54. * gc_gss_ctx is the context handle that is used to do gss-api calls, while
  55. * gc_wire_ctx is the context handle that is used to identify the context on
  56. * the wire when communicating with a server. */
  57. struct gss_cl_ctx {
  58. refcount_t count;
  59. enum rpc_gss_proc gc_proc;
  60. u32 gc_seq;
  61. u32 gc_seq_xmit;
  62. spinlock_t gc_seq_lock;
  63. struct gss_ctx *gc_gss_ctx;
  64. struct xdr_netobj gc_wire_ctx;
  65. struct xdr_netobj gc_acceptor;
  66. u32 gc_win;
  67. unsigned long gc_expiry;
  68. struct rcu_head gc_rcu;
  69. };
  70. struct gss_upcall_msg;
  71. struct gss_cred {
  72. struct rpc_cred gc_base;
  73. enum rpc_gss_svc gc_service;
  74. struct gss_cl_ctx __rcu *gc_ctx;
  75. struct gss_upcall_msg *gc_upcall;
  76. const char *gc_principal;
  77. unsigned long gc_upcall_timestamp;
  78. };
  79. #endif /* _LINUX_SUNRPC_AUTH_GSS_H */