mls.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Multi-level security (MLS) policy operations.
  3. *
  4. * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
  5. */
  6. /*
  7. * Updated: Trusted Computer Solutions, Inc. <dgoeddel@trustedcs.com>
  8. *
  9. * Support for enhanced MLS infrastructure.
  10. *
  11. * Copyright (C) 2004-2006 Trusted Computer Solutions, Inc.
  12. */
  13. /*
  14. * Updated: Hewlett-Packard <paul.moore@hp.com>
  15. *
  16. * Added support to import/export the MLS label from NetLabel
  17. *
  18. * (c) Copyright Hewlett-Packard Development Company, L.P., 2006
  19. */
  20. #ifndef _SS_MLS_H_
  21. #define _SS_MLS_H_
  22. #include "context.h"
  23. #include "policydb.h"
  24. int mls_compute_context_len(struct context *context);
  25. void mls_sid_to_context(struct context *context, char **scontext);
  26. int mls_context_isvalid(struct policydb *p, struct context *c);
  27. int mls_range_isvalid(struct policydb *p, struct mls_range *r);
  28. int mls_level_isvalid(struct policydb *p, struct mls_level *l);
  29. int mls_context_to_sid(struct policydb *p,
  30. char oldc,
  31. char **scontext,
  32. struct context *context,
  33. struct sidtab *s,
  34. u32 def_sid);
  35. int mls_from_string(char *str, struct context *context, gfp_t gfp_mask);
  36. int mls_range_set(struct context *context, struct mls_range *range);
  37. int mls_convert_context(struct policydb *oldp,
  38. struct policydb *newp,
  39. struct context *context);
  40. int mls_compute_sid(struct context *scontext,
  41. struct context *tcontext,
  42. u16 tclass,
  43. u32 specified,
  44. struct context *newcontext);
  45. int mls_setup_user_range(struct context *fromcon, struct user_datum *user,
  46. struct context *usercon);
  47. #ifdef CONFIG_NETLABEL
  48. void mls_export_netlbl_lvl(struct context *context,
  49. struct netlbl_lsm_secattr *secattr);
  50. void mls_import_netlbl_lvl(struct context *context,
  51. struct netlbl_lsm_secattr *secattr);
  52. int mls_export_netlbl_cat(struct context *context,
  53. struct netlbl_lsm_secattr *secattr);
  54. int mls_import_netlbl_cat(struct context *context,
  55. struct netlbl_lsm_secattr *secattr);
  56. #else
  57. static inline void mls_export_netlbl_lvl(struct context *context,
  58. struct netlbl_lsm_secattr *secattr)
  59. {
  60. return;
  61. }
  62. static inline void mls_import_netlbl_lvl(struct context *context,
  63. struct netlbl_lsm_secattr *secattr)
  64. {
  65. return;
  66. }
  67. static inline int mls_export_netlbl_cat(struct context *context,
  68. struct netlbl_lsm_secattr *secattr)
  69. {
  70. return -ENOMEM;
  71. }
  72. static inline int mls_import_netlbl_cat(struct context *context,
  73. struct netlbl_lsm_secattr *secattr)
  74. {
  75. return -ENOMEM;
  76. }
  77. #endif
  78. #endif /* _SS_MLS_H */