encrypted_defined.h 1.4 KB

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