openATV enigma2
openATV is an open source SetTopBox Graphical user interface.
etpm.h
Go to the documentation of this file.
1 #ifndef __lib_base_etpm_h
2 #define __lib_base_etpm_h
3 
4 #ifndef SWIG
5 #define TPMD_SOCKET "/var/run/tpmd_socket"
6 #endif
7 
8 #include <string>
9 
10 class eTPM
11 {
12 #ifndef SWIG
13  int fd;
14  unsigned char level2_cert[210];
15  unsigned char level3_cert[210];
16  bool level2_cert_read;
17  bool level3_cert_read;
18 
19  enum tpmd_cmd {
20  TPMD_CMD_RESERVED = 0x0000,
21  TPMD_CMD_GET_DATA = 0x0001,
22  TPMD_CMD_APDU = 0x0002,
23  TPMD_CMD_COMPUTE_SIGNATURE = 0x0003,
24  TPMD_CMD_APP_CERT = 0x0004,
25  };
26 
27  bool send_cmd(enum tpmd_cmd cmd, const void *data, size_t len);
28  void *recv_cmd(unsigned int *tag, size_t *len);
29  void parse_data(const unsigned char *data, size_t datalen);
30 
31 #endif
32 public:
33  eTPM();
34  ~eTPM();
35 
36  enum cert_type {
40  DT_LEVEL3_CERT = 0x05
41  };
42  std::string getCert(cert_type type);
43  std::string challenge(std::string rnd);
44  std::string getData(cert_type type) { return getCert(type); };
45  std::string computeSignature(const std::string &data) { return challenge(data); };
46 };
47 
48 #endif // __lib_base_etpm_h
Definition: etpm.h:11
std::string challenge(std::string rnd)
Definition: etpm.cpp:173
~eTPM()
Definition: etpm.cpp:62
std::string getCert(cert_type type)
Definition: etpm.cpp:162
eTPM()
Definition: etpm.cpp:17
std::string computeSignature(const std::string &data)
Definition: etpm.h:45
std::string getData(cert_type type)
Definition: etpm.h:44
cert_type
Definition: etpm.h:36
@ TPMD_DT_LEVEL2_CERT
Definition: etpm.h:37
@ DT_LEVEL2_CERT
Definition: etpm.h:39
@ TPMD_DT_LEVEL3_CERT
Definition: etpm.h:38
@ DT_LEVEL3_CERT
Definition: etpm.h:40
unsigned char data[256]
Definition: hdmi_cec.h:2