fips140-module.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright 2021 Google LLC
  4. */
  5. #ifndef _CRYPTO_FIPS140_MODULE_H
  6. #define _CRYPTO_FIPS140_MODULE_H
  7. #include <linux/completion.h>
  8. #include <linux/module.h>
  9. #include <generated/utsrelease.h>
  10. #undef pr_fmt
  11. #define pr_fmt(fmt) "fips140: " fmt
  12. /*
  13. * This is the name and version number of the module that are shown on the FIPS
  14. * certificate.
  15. */
  16. #define FIPS140_MODULE_NAME "Android Kernel Cryptographic Module"
  17. #define FIPS140_MODULE_VERSION UTS_RELEASE
  18. /* fips140-eval-testing.c */
  19. #ifdef CONFIG_CRYPTO_FIPS140_MOD_EVAL_TESTING
  20. void fips140_inject_selftest_failure(const char *impl, u8 *result);
  21. void fips140_inject_integrity_failure(u8 *textcopy);
  22. bool fips140_eval_testing_init(void);
  23. #else
  24. static inline void fips140_inject_selftest_failure(const char *impl, u8 *result)
  25. {
  26. }
  27. static inline void fips140_inject_integrity_failure(u8 *textcopy)
  28. {
  29. }
  30. static inline bool fips140_eval_testing_init(void)
  31. {
  32. return true;
  33. }
  34. #endif /* !CONFIG_CRYPTO_FIPS140_MOD_EVAL_TESTING */
  35. /* fips140-module.c */
  36. extern struct completion fips140_tests_done;
  37. extern struct task_struct *fips140_init_thread;
  38. bool fips140_is_approved_service(const char *name);
  39. const char *fips140_module_version(void);
  40. /* fips140-selftests.c */
  41. bool __init __must_check fips140_run_selftests(void);
  42. #endif /* _CRYPTO_FIPS140_MODULE_H */