1 /*
2  * Copyright (c) 2022, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <errno.h>
8 #include <stdint.h>
9 #include <string.h>
10 
11 /* Using hardcoded token values for AEM FVP */
12 static uint8_t platform_token[] = {
13 	0xD2, 0x84, 0x40, 0xA0, 0x59, 0x02, 0x46, 0xA9,
14 	0x19, 0x01, 0x09, 0x78, 0x1C, 0x68, 0x74, 0x74,
15 	0x70, 0x3A, 0x2F, 0x2F, 0x61, 0x72, 0x6D, 0x2E,
16 	0x63, 0x6F, 0x6D, 0x2F, 0x43, 0x43, 0x41, 0x2D,
17 	0x53, 0x53, 0x44, 0x2F, 0x31, 0x2E, 0x30, 0x2E,
18 	0x30, 0x0A, 0x58, 0x20, 0x07, 0x06, 0x05, 0x04,
19 	0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C,
20 	0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15, 0x14,
21 	0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D, 0x1C,
22 	0x1B, 0x1A, 0x19, 0x18, 0x19, 0x09, 0x5C, 0x58,
23 	0x40, 0x7F, 0x45, 0x4C, 0x46, 0x02, 0x01, 0x01,
24 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25 	0x00, 0x03, 0x00, 0x3E, 0x00, 0x01, 0x00, 0x00,
26 	0x00, 0x50, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00,
27 	0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28 	0x00, 0xA0, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00,
29 	0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38,
30 	0x00, 0x09, 0x00, 0x40, 0x00, 0x1C, 0x00, 0x1B,
31 	0x00, 0x19, 0x01, 0x00, 0x58, 0x21, 0x01, 0x07,
32 	0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F,
33 	0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17,
34 	0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x1F,
35 	0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x19,
36 	0x09, 0x61, 0x58, 0x21, 0x01, 0x07, 0x06, 0x05,
37 	0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D,
38 	0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15,
39 	0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D,
40 	0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x19, 0x09, 0x5B,
41 	0x19, 0x30, 0x03, 0x19, 0x09, 0x62, 0x67, 0x73,
42 	0x68, 0x61, 0x2D, 0x32, 0x35, 0x36, 0x19, 0x09,
43 	0x5F, 0x84, 0xA5, 0x01, 0x62, 0x42, 0x4C, 0x05,
44 	0x58, 0x20, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02,
45 	0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A,
46 	0x09, 0x08, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12,
47 	0x11, 0x10, 0x1F, 0x1E, 0x1D, 0x1C, 0x1B, 0x1A,
48 	0x19, 0x18, 0x04, 0x65, 0x33, 0x2E, 0x34, 0x2E,
49 	0x32, 0x02, 0x58, 0x20, 0x07, 0x06, 0x05, 0x04,
50 	0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C,
51 	0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15, 0x14,
52 	0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D, 0x1C,
53 	0x1B, 0x1A, 0x19, 0x18, 0x06, 0x67, 0x73, 0x68,
54 	0x61, 0x2D, 0x32, 0x35, 0x36, 0xA4, 0x01, 0x62,
55 	0x4D, 0x31, 0x05, 0x58, 0x20, 0x07, 0x06, 0x05,
56 	0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D,
57 	0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15,
58 	0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D,
59 	0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x04, 0x63, 0x31,
60 	0x2E, 0x32, 0x02, 0x58, 0x20, 0x07, 0x06, 0x05,
61 	0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D,
62 	0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15,
63 	0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D,
64 	0x1C, 0x1B, 0x1A, 0x19, 0x18, 0xA4, 0x01, 0x62,
65 	0x4D, 0x32, 0x05, 0x58, 0x20, 0x07, 0x06, 0x05,
66 	0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D,
67 	0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15,
68 	0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D,
69 	0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x04, 0x65, 0x31,
70 	0x2E, 0x32, 0x2E, 0x33, 0x02, 0x58, 0x20, 0x07,
71 	0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F,
72 	0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17,
73 	0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x1F,
74 	0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0xA4,
75 	0x01, 0x62, 0x4D, 0x33, 0x05, 0x58, 0x20, 0x07,
76 	0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F,
77 	0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17,
78 	0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x1F,
79 	0x1E, 0x1D, 0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x04,
80 	0x61, 0x31, 0x02, 0x58, 0x20, 0x07, 0x06, 0x05,
81 	0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D,
82 	0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x17, 0x16, 0x15,
83 	0x14, 0x13, 0x12, 0x11, 0x10, 0x1F, 0x1E, 0x1D,
84 	0x1C, 0x1B, 0x1A, 0x19, 0x18, 0x19, 0x09, 0x60,
85 	0x6C, 0x77, 0x68, 0x61, 0x74, 0x65, 0x76, 0x65,
86 	0x72, 0x2E, 0x63, 0x6F, 0x6D, 0x58, 0x40, 0x84,
87 	0x32, 0x12, 0x5B, 0x92, 0x6B, 0x20, 0xD8, 0x14,
88 	0xC1, 0xC1, 0x8C, 0x3C, 0x73, 0xB8, 0x29, 0x0F,
89 	0x42, 0xBC, 0x0B, 0x25, 0x87, 0x5C, 0x4F, 0xA4,
90 	0xFA, 0xD9, 0xDE, 0xC1, 0x2B, 0x20, 0xED, 0xDF,
91 	0x1C, 0xDD, 0x1A, 0x09, 0xBD, 0xA0, 0x25, 0x48,
92 	0xC6, 0xBB, 0x99, 0xA1, 0x30, 0x4F, 0x2C, 0xDC,
93 	0x89, 0xE8, 0xB7, 0xFF, 0x32, 0xE9, 0x3F, 0xBB,
94 	0xC6, 0xBF, 0x9D, 0x38, 0x68, 0xE1, 0xB2,
95 };
96 
plat_rmmd_get_cca_attest_token(uintptr_t buf,size_t * len,uintptr_t hash,size_t hash_size)97 int plat_rmmd_get_cca_attest_token(uintptr_t buf, size_t *len,
98 				   uintptr_t hash, size_t hash_size)
99 {
100 	(void)hash;
101 	(void)hash_size;
102 
103 	if (*len < sizeof(platform_token)) {
104 		return -EINVAL;
105 	}
106 
107 	(void)memcpy((void *)buf, platform_token, sizeof(platform_token));
108 	*len = sizeof(platform_token);
109 
110 	return 0;
111 }
112