keys: add new key-type encrypted
[pandora-kernel.git] / security / keys / encrypted_defined.h
1 #ifndef __ENCRYPTED_KEY_H
2 #define __ENCRYPTED_KEY_H
3
4 #define ENCRYPTED_DEBUG 0
5
6 #if ENCRYPTED_DEBUG
7 static inline void dump_master_key(const u8 *master_key,
8                                    unsigned int master_keylen)
9 {
10         print_hex_dump(KERN_ERR, "master key: ", DUMP_PREFIX_NONE, 32, 1,
11                        master_key, master_keylen, 0);
12 }
13
14 static inline void dump_decrypted_data(struct encrypted_key_payload *epayload)
15 {
16         print_hex_dump(KERN_ERR, "decrypted data: ", DUMP_PREFIX_NONE, 32, 1,
17                        epayload->decrypted_data,
18                        epayload->decrypted_datalen, 0);
19 }
20
21 static inline void dump_encrypted_data(struct encrypted_key_payload *epayload,
22                                        unsigned int encrypted_datalen)
23 {
24         print_hex_dump(KERN_ERR, "encrypted data: ", DUMP_PREFIX_NONE, 32, 1,
25                        epayload->encrypted_data, encrypted_datalen, 0);
26 }
27
28 static inline void dump_hmac(const char *str, const u8 *digest,
29                              unsigned int hmac_size)
30 {
31         if (str)
32                 pr_info("encrypted_key: %s", str);
33         print_hex_dump(KERN_ERR, "hmac: ", DUMP_PREFIX_NONE, 32, 1, digest,
34                        hmac_size, 0);
35 }
36 #else
37 static inline void dump_master_key(const u8 *master_key,
38                                    unsigned int master_keylen)
39 {
40 }
41
42 static inline void dump_decrypted_data(struct encrypted_key_payload *epayload)
43 {
44 }
45
46 static inline void dump_encrypted_data(struct encrypted_key_payload *epayload,
47                                        unsigned int encrypted_datalen)
48 {
49 }
50
51 static inline void dump_hmac(const char *str, const u8 *digest,
52                              unsigned int hmac_size)
53 {
54 }
55 #endif
56 #endif