-
Notifications
You must be signed in to change notification settings - Fork 8
/
ecdt.c
49 lines (44 loc) · 1.38 KB
/
ecdt.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#define _GNU_SOURCE
#include <stdio.h>
#include <asm/types.h>
#include <string.h>
static char ecdt_c[] = {
0x45, 0x43, 0x44, 0x54, 0x54, 0x00, 0x00, 0x00, 0x01, 0x8a, 0x41, 0x20, 0x4d,
0x20, 0x49, 0x20, 0x4f, 0x45, 0x4d, 0x45, 0x43, 0x44, 0x54, 0x20, 0x17, 0x04,
0x00, 0x11, 0x4d, 0x53, 0x46, 0x54, 0x97, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00,
0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00,
0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x5c, 0x5f, 0x53, 0x42, 0x2e, 0x50, 0x43, 0x49, 0x30, 0x2e, 0x53, 0x42, 0x52,
0x47, 0x2e, 0x45, 0x43, 0x30, 0x00
};
struct ecdt_t {
__u32 sign;
__u32 len;
__u8 rev;
__u8 sum;
char oemid[6];
char oem_t_id[8];
__u32 oem_rev;
char creat_id[4];
__u32 creat_rev;
__u32 ec_control[3];
__u32 ec_data[3];
__u32 uid;
__u8 gpe_bit;
char ec_id[0];
};
int main()
{
struct ecdt_t *e = (struct ecdt_t *)ecdt_c;
printf("Sign: %x\nLen: %x\nRev: %x\nSum: %x\nOEMID: '%s'\n"
"OEM table ID: '%s'\nOem rev: %x\nCreat Id: '%s'\n"
"Creat rev: %x\nEC control: %x%x%x\nEC data: %x%x%x\n"
"UID: %x\nGB: %x\nEC_id: '%s'\n",
e->sign, e->len, e->rev, e->sum, strndup(e->oemid, 6),
strndup(e->oem_t_id, 8), e->oem_rev, strndup(e->creat_id, 4),
e->creat_rev,
e->ec_control[0], e->ec_control[1], e->ec_control[2],
e->ec_data[0], e->ec_data[1], e->ec_data[2], e->uid,
e->gpe_bit, e->ec_id);
return 0;
}