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