• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM fips140
4 #define TRACE_INCLUDE_PATH trace/hooks
5 
6 #if !defined(_TRACE_HOOK_FIPS140_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_HOOK_FIPS140_H
8 #include <linux/tracepoint.h>
9 #include <trace/hooks/vendor_hooks.h>
10 
11 #ifdef __GENKSYMS__
12 struct crypto_aes_ctx;
13 #else
14 /* struct crypto_aes_ctx */
15 #include <crypto/aes.h>
16 #endif /* __GENKSYMS__ */
17 
18 /*
19  * These hooks exist only for the benefit of the FIPS140 crypto module, which
20  * uses them to swap out the underlying implementation with one that is integrity
21  * checked as per FIPS 140 requirements. No other uses are allowed or
22  * supported.
23  */
24 
25 DECLARE_HOOK(android_vh_sha256,
26 	     TP_PROTO(const u8 *data,
27 		      unsigned int len,
28 		      u8 *out,
29 		      int *hook_inuse),
30 	     TP_ARGS(data, len, out, hook_inuse));
31 
32 DECLARE_HOOK(android_vh_aes_expandkey,
33 	     TP_PROTO(struct crypto_aes_ctx *ctx,
34 		      const u8 *in_key,
35 		      unsigned int key_len,
36 		      int *err),
37 	     TP_ARGS(ctx, in_key, key_len, err));
38 
39 DECLARE_HOOK(android_vh_aes_encrypt,
40 	     TP_PROTO(const struct crypto_aes_ctx *ctx,
41 		      u8 *out,
42 		      const u8 *in,
43 		      int *hook_inuse),
44 	     TP_ARGS(ctx, out, in, hook_inuse));
45 
46 DECLARE_HOOK(android_vh_aes_decrypt,
47 	     TP_PROTO(const struct crypto_aes_ctx *ctx,
48 		      u8 *out,
49 		      const u8 *in,
50 		      int *hook_inuse),
51 	     TP_ARGS(ctx, out, in, hook_inuse));
52 
53 #endif /* _TRACE_HOOK_FIPS140_H */
54 
55 /* This part must be outside protection */
56 #include <trace/define_trace.h>
57