ima: Introducing a AST for parsing and validation
ima: Introducing a AST for parsing and validation

This introduces a new module for parsing IMA entries in a more generic way.

This allows us to do better input validation on IMA entries and provides an
interface to validate the acutal data provided by an IMA entry with validator.

Seperate validators can be specified per template type and IMA entry.

Validation of the provided template hash by IMA is simplified such that
new templates or types can be added without having to reconstruct the full
byte structure per template.

Since kernel 5.12 IMA has now also the option to log critical functions of
the kernel itself and those features use ima-buf which is different to the
currently supported ima/ima-ng/ima-sig which Keylime currently supports
for files.

We currently ignore all time of measure, time of use (ToMToU) errors to keep
backwards compatibility.

Signed-off-by: Thore Sommer <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@thson.de>

mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime,mit-ll/python-keylime