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