mls.h 2.2 KB

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