Merge tag 'selinux-pr-20200601' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / security / selinux / ss / mls.h
index 7954b1e60b6461ac793dfa2858d067b87c00a25a..15cacde0ff612e76778170624044be557a31f189 100644 (file)
 #ifndef _SS_MLS_H_
 #define _SS_MLS_H_
 
 #ifndef _SS_MLS_H_
 #define _SS_MLS_H_
 
+#include <linux/jhash.h>
+
 #include "context.h"
 #include "context.h"
+#include "ebitmap.h"
 #include "policydb.h"
 
 int mls_compute_context_len(struct policydb *p, struct context *context);
 #include "policydb.h"
 
 int mls_compute_context_len(struct policydb *p, struct context *context);
@@ -101,5 +104,13 @@ static inline int mls_import_netlbl_cat(struct policydb *p,
 }
 #endif
 
 }
 #endif
 
+static inline u32 mls_range_hash(const struct mls_range *r, u32 hash)
+{
+       hash = jhash_2words(r->level[0].sens, r->level[1].sens, hash);
+       hash = ebitmap_hash(&r->level[0].cat, hash);
+       hash = ebitmap_hash(&r->level[1].cat, hash);
+       return hash;
+}
+
 #endif /* _SS_MLS_H */
 
 #endif /* _SS_MLS_H */