usb: add support for STA2X11 host driver
[zen-stable.git] / security / keys / encrypted-keys / encrypted.h
blob8136a2d44c63ddb3a76f30f35b6780ff19b74ae9
1 #ifndef __ENCRYPTED_KEY_H
2 #define __ENCRYPTED_KEY_H
4 #define ENCRYPTED_DEBUG 0
5 #if defined(CONFIG_TRUSTED_KEYS) || \
6 (defined(CONFIG_TRUSTED_KEYS_MODULE) && defined(CONFIG_ENCRYPTED_KEYS_MODULE))
7 extern struct key *request_trusted_key(const char *trusted_desc,
8 u8 **master_key, size_t *master_keylen);
9 #else
10 static inline struct key *request_trusted_key(const char *trusted_desc,
11 u8 **master_key,
12 size_t *master_keylen)
14 return ERR_PTR(-EOPNOTSUPP);
16 #endif
18 #if ENCRYPTED_DEBUG
19 static inline void dump_master_key(const u8 *master_key, size_t master_keylen)
21 print_hex_dump(KERN_ERR, "master key: ", DUMP_PREFIX_NONE, 32, 1,
22 master_key, master_keylen, 0);
25 static inline void dump_decrypted_data(struct encrypted_key_payload *epayload)
27 print_hex_dump(KERN_ERR, "decrypted data: ", DUMP_PREFIX_NONE, 32, 1,
28 epayload->decrypted_data,
29 epayload->decrypted_datalen, 0);
32 static inline void dump_encrypted_data(struct encrypted_key_payload *epayload,
33 unsigned int encrypted_datalen)
35 print_hex_dump(KERN_ERR, "encrypted data: ", DUMP_PREFIX_NONE, 32, 1,
36 epayload->encrypted_data, encrypted_datalen, 0);
39 static inline void dump_hmac(const char *str, const u8 *digest,
40 unsigned int hmac_size)
42 if (str)
43 pr_info("encrypted_key: %s", str);
44 print_hex_dump(KERN_ERR, "hmac: ", DUMP_PREFIX_NONE, 32, 1, digest,
45 hmac_size, 0);
47 #else
48 static inline void dump_master_key(const u8 *master_key, size_t master_keylen)
52 static inline void dump_decrypted_data(struct encrypted_key_payload *epayload)
56 static inline void dump_encrypted_data(struct encrypted_key_payload *epayload,
57 unsigned int encrypted_datalen)
61 static inline void dump_hmac(const char *str, const u8 *digest,
62 unsigned int hmac_size)
65 #endif
66 #endif