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