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 struct crypto_aes_ctx;
12 
13 /*
14  * These hooks exist only for the benefit of the FIPS140 crypto module, which
15  * uses them to swap out the underlying implementation with one that is integrity
16  * checked as per FIPS 140 requirements. No other uses are allowed or
17  * supported.
18  */
19 
20 DECLARE_HOOK(android_vh_sha256,
21 	     TP_PROTO(const u8 *data,
22 		      unsigned int len,
23 		      u8 *out,
24 		      int *hook_inuse),
25 	     TP_ARGS(data, len, out, hook_inuse));
26 
27 DECLARE_HOOK(android_vh_aes_expandkey,
28 	     TP_PROTO(struct crypto_aes_ctx *ctx,
29 		      const u8 *in_key,
30 		      unsigned int key_len,
31 		      int *err),
32 	     TP_ARGS(ctx, in_key, key_len, err));
33 
34 DECLARE_HOOK(android_vh_aes_encrypt,
35 	     TP_PROTO(const struct crypto_aes_ctx *ctx,
36 		      u8 *out,
37 		      const u8 *in,
38 		      int *hook_inuse),
39 	     TP_ARGS(ctx, out, in, hook_inuse));
40 
41 DECLARE_HOOK(android_vh_aes_decrypt,
42 	     TP_PROTO(const struct crypto_aes_ctx *ctx,
43 		      u8 *out,
44 		      const u8 *in,
45 		      int *hook_inuse),
46 	     TP_ARGS(ctx, out, in, hook_inuse));
47 
48 #endif /* _TRACE_HOOK_FIPS140_H */
49 
50 /* This part must be outside protection */
51 #include <trace/define_trace.h>
52