mls.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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(char oldc,
  30. char **scontext,
  31. struct context *context,
  32. struct sidtab *s,
  33. u32 def_sid);
  34. int mls_from_string(char *str, struct context *context, gfp_t gfp_mask);
  35. int mls_convert_context(struct policydb *oldp,
  36. struct policydb *newp,
  37. struct context *context);
  38. int mls_compute_sid(struct context *scontext,
  39. struct context *tcontext,
  40. u16 tclass,
  41. u32 specified,
  42. struct context *newcontext);
  43. int mls_setup_user_range(struct context *fromcon, struct user_datum *user,
  44. struct context *usercon);
  45. #ifdef CONFIG_NETLABEL
  46. void mls_export_netlbl_lvl(struct context *context,
  47. struct netlbl_lsm_secattr *secattr);
  48. void mls_import_netlbl_lvl(struct context *context,
  49. struct netlbl_lsm_secattr *secattr);
  50. int mls_export_netlbl_cat(struct context *context,
  51. struct netlbl_lsm_secattr *secattr);
  52. int mls_import_netlbl_cat(struct context *context,
  53. struct netlbl_lsm_secattr *secattr);
  54. #else
  55. static inline void mls_export_netlbl_lvl(struct context *context,
  56. struct netlbl_lsm_secattr *secattr)
  57. {
  58. return;
  59. }
  60. static inline void mls_import_netlbl_lvl(struct context *context,
  61. struct netlbl_lsm_secattr *secattr)
  62. {
  63. return;
  64. }
  65. static inline int mls_export_netlbl_cat(struct context *context,
  66. struct netlbl_lsm_secattr *secattr)
  67. {
  68. return -ENOMEM;
  69. }
  70. static inline int mls_import_netlbl_cat(struct context *context,
  71. struct netlbl_lsm_secattr *secattr)
  72. {
  73. return -ENOMEM;
  74. }
  75. #endif
  76. #endif /* _SS_MLS_H */