-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentry_test.go
321 lines (281 loc) · 17.5 KB
/
entry_test.go
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
package amdfw
import (
"bytes"
"encoding/binary"
"github.com/stretchr/testify/assert"
"testing"
)
var (
/**
002fdc00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
002fdc10 30 42 41 52 a8 04 00 00 00 00 00 00 00 00 00 00 |0BAR............|
002fdc20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
002fdc30 01 00 00 00 00 00 00 00 27 93 94 ca c2 c2 4e fb |........'.....N.|
002fdc40 97 ae da 24 1d 31 c8 de 01 00 00 00 00 00 00 00 |...$.1..........|
002fdc50 a8 04 00 00 cf 02 00 00 00 00 00 00 00 00 00 00 |................|
002fdc60 01 15 05 17 50 5a 4c 42 00 01 00 00 d0 04 00 00 |....PZLB........|
002fdc70 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
002fdca0 25 00 00 00 0d 00 00 00 01 00 00 00 00 00 00 00 |%...............|
002fdcb0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
002fdd00 78 da a5 d2 4f 48 db 50 18 00 f0 ef 25 fd 67 36 |x...OH.P....%.g6|
002fdd10 86 63 3b b8 d1 c1 13 eb ec 60 32 ad f5 ef a9 ad |.c;......`2.....|
002fdd20 34 ad 9d b5 5d 95 39 87 68 b3 ae ce ba da 96 da |4...].9.h.......|
002fdd30 b2 81 30 1c 08 63 3b 95 fd a3 bb ac 82 97 1e d5 |..0..c;.........|
002fdd40 e1 c1 83 b0 83 3b 0a e9 6d b7 d4 83 68 3d f5 b0 |.....;..m...h=..|
002fdd50 6a c0 6a f6 92 cd 52 c1 c2 60 81 24 5f de f7 fb |j.j...R..`.$_...|
002fdd60 be 47 78 5f 03 9f d9 6d c0 99 5d 93 74 6f 07 f8 |.Gx_...m..].to..|
002fdd70 a5 9d fa 7c 66 b7 fe ef f7 a9 24 1d 80 99 06 b5 |...|f.....$.....|
002fdd80 0f 81 fe 01 82 3b e4 5d 5c 7f b3 82 b2 60 d8 2e |.....;.]\....`..|
002fdd90 d0 16 15 56 a7 6e 38 35 cd 54 8a ca 6a 3e dd 16 |...V.n85.T..j>..|
002fdda0 50 da 52 44 80 c8 57 8b 70 7d c8 73 78 12 a3 53 |P.RD..W.p}.sx..S|
002fddb0 08 6f 17 d4 6a 2a bb 5d 40 0f 5b 84 17 7a 25 72 |.o..j*.]@.[..z%r|
002fddc0 c8 f6 c7 9a 96 e4 90 46 d6 f2 1a 95 95 57 bf af |.......F.....W..|
002fddd0 d9 0f 00 2f 95 9a ad 8f 7b 29 1e 61 ed 4a 71 13 |.../....{).a.Jq.|
002fdde0 f0 f1 1e d0 3f 4f e3 00 e5 9e 75 28 59 bc d6 43 |....?O....u(Y..C|
002fddf0 b0 5d 62 d5 03 f0 7e 86 e5 45 91 6e 15 54 2c bd |.]b...~..E.n.T,.|
002fde00 a4 11 30 db b3 09 00 1f 69 a8 b3 3a ec c3 56 ec |..0.....i..:..V.|
002fde10 b6 bb 71 2b 1e 88 84 12 21 2e 8c ad de 7e 1b 1e |..q+....!....~..|
002fde20 4e c6 62 d1 78 82 21 0e c7 1c f2 ad 5b d7 38 67 |N.b.x.!.....[.8g|
002fde30 58 cd 00 12 74 1b 90 ae df f0 14 a5 36 10 20 ad |X...t.......6. .|
002fde40 93 7b ad d0 00 3c 0d ad 85 f2 a4 aa 89 fc d3 3c |.{...<.........<|
002fde50 e7 19 63 05 71 f1 35 e7 e2 9c 8c c0 91 5d 75 25 |..c.q.5......]u%|
002fde60 cb c8 94 53 5b 5a 48 6e 89 fb 74 d0 b9 55 38 d6 |...S[ZHn..t..U8.|
002fde70 a2 ac 5e 08 dc f7 14 81 59 14 7f 2d f7 b1 28 ed |..^.....Y..-..(.|
002fde80 6f fc 7a 93 32 5e e1 91 f1 32 ff 96 dd 12 c5 6b |o.z.2^...2.....k|
002fde90 d2 d1 23 09 be 4d 63 12 d3 08 2f 8a 65 fa 56 de |..#..Mc.../.e.V.|
002fdea0 a2 64 a0 51 3a 7a 27 a9 60 3e d7 89 67 d8 5e 16 |.d.Q:z'.`>..g.^.|
002fdeb0 3e 53 82 0a a6 73 90 06 e3 2b 7e 88 ec 69 61 b3 |>S...s...+~..ia.|
002fdec0 0e 15 fb 80 44 a1 3c a9 f8 40 aa 97 a1 d1 c2 4a |....D.<..@.....J|
002fded0 47 11 52 37 99 93 33 ed 55 b5 2e a5 d6 cf 8f 54 |G.R7..3.U......T|
002fdee0 6a 47 49 04 77 5d b9 ae 2a d5 ad 28 37 3f 5a 51 |jGI.w]..*..(7?ZQ|
002fdef0 63 8a ea ce 99 aa 94 41 51 7d fc 58 45 8d 2b ca |c......AQ}.XE.+.|
002fdf00 90 eb a8 52 57 15 d5 c2 8f 57 d4 04 89 cc 1b e6 |...RW....W......|
002fdf10 2a 43 f1 90 ce ae ea f2 90 4e ad 4e 54 9c 9f 44 |*C.......N.NT..D|
002fdf20 75 2e 55 53 9d 73 8c f5 e9 19 21 a0 9c 2c 08 9b |u.US.s....!..,..|
002fdf30 fb e5 8c b4 87 0c c5 3d 72 2e 7e 44 1e 34 94 f3 |.......=r.~D.4..|
002fdf40 70 b0 40 e6 82 b1 da 06 db c8 51 bb b9 50 04 93 |p.@.......Q..P..|
002fdf50 18 db 5f 06 03 c9 44 28 1a 61 e0 84 cc 2e f2 fd |.._...D(.a......|
002fdf60 f1 4c 3f 17 0e 87 22 cf 14 d3 89 6d 83 64 0e 18 |.L?..."....m.d..|
002fdf70 5f 30 91 8c 47 82 4f f1 54 3c 3a 5b 9d 81 7f 9a |_0..G.O.T<:[....|
002fdf80 a3 73 3d db 6b f6 6c 3f eb 79 ce 77 d5 f4 5d 17 |.s=.k.l?.y.w..].|
002fdf90 7a 53 4d 6f ba d0 77 d4 f4 1d 17 7a 73 4d 6f ae |zSMo..w....zsMo.|
002fdfa0 78 6b 38 2c af cc e1 fe e8 6c 2c 1c 4c 04 b1 31 |xk8,.....l,.L..1|
002fdfb0 c6 cd cd e1 40 34 92 88 47 c3 f8 09 17 78 8e 13 |....@4..G....x..|
002fdfc0 51 ec 1d f6 9e d5 7c f9 cf eb 37 10 13 a1 d9 00 |Q.....|...7.....|
002fdfd0 0b df 7b 33 d7 24 d1 37 bd bb 4f a3 8d fa c4 bb |..{3.$.7..O.....|
002fdfe0 91 09 66 68 bc 4f ae 62 a8 c2 b4 a3 c6 43 b2 3b |..fh.O.b.....C.;|
002fdff0 e2 8a da 21 2f 66 1b 82 6e 59 b3 cb 67 61 6d 03 |...!/f..nY..gam.|
002fe000 50 13 25 f0 06 e9 41 45 8a 25 19 6f 73 71 46 be |P.%...AE.%.osqF.|
002fe010 b4 cb d7 54 60 23 78 5f 0c 7c e7 11 8e 53 23 7c |...T`#x_.|...S#||
002fe020 be 09 90 2b 76 d7 bc cc 54 db 16 2f de 3c 4a 76 |...+v...T../.<Jv|
002fe030 4b ed 22 c7 46 7d 4c 33 7c f5 47 e4 c8 bc 1a d3 |K.".F}L3|.G.....|
002fe040 12 f9 81 99 49 cb 7e c0 1b 97 fb 8e 73 a2 36 ce |....I.~.....s.6.|
002fe050 6a cf 71 21 5e 6a 8a 1f 4f 5d 4f 00 65 08 15 9a |j.q!^j..O]O.e...|
002fe060 b8 ab ef 33 85 16 4a f8 88 ee 98 62 be 15 9d 9e |...3..J....b....|
002fe070 3a ef a2 c7 06 f7 4d 31 de 66 dc 4f a2 18 d8 f4 |:.....M1.f.O....|
002fe080 fd 1b cd eb b5 68 d2 80 5a 66 cb 76 b9 67 7a a5 |.....h..Zf.v.gz.|
002fe090 08 80 25 ea 87 91 ec b9 6c 4a 6d 35 d7 d1 00 1a |..%.....lJm5....|
002fe0a0 a5 6f 81 bd 5c af 2b c6 e2 45 cc e8 28 d0 de cf |.o..\.+..E..(...|
002fe0b0 c5 da 51 40 b1 af 23 22 b7 a4 dd b9 cf 1b 73 1c |..Q@..#"......s.|
002fe0c0 27 bc 99 a9 72 a8 fd 1f 10 03 d2 38 91 09 3c 83 |'...r......8..<.|
002fe0d0 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
*/
entryBytes = []byte{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x30, 0x42, 0x41, 0x52, 0xa8, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x93, 0x94, 0xca, 0xc2, 0xc2, 0x4e, 0xfb,
0x97, 0xae, 0xda, 0x24, 0x1d, 0x31, 0xc8, 0xde, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xa8, 0x04, 0x00, 0x00, 0xcf, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x15, 0x05, 0x17, 0x50, 0x5a, 0x4c, 0x42, 0x00, 0x01, 0x00, 0x00, 0xd0, 0x04, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x25, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x78, 0xda, 0xa5, 0xd2, 0x4f, 0x48, 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 0x81, 0xbd, 0x5c, 0xaf, 0x2b, 0xc6, 0xe2, 0x45, 0xcc, 0xe8, 0x28, 0xd0, 0xde, 0xcf,
0xc5, 0xda, 0x51, 0x40, 0xb1, 0xaf, 0x23, 0x22, 0xb7, 0xa4, 0xdd, 0xb9, 0xcf, 0x1b, 0x73, 0x1c,
0x27, 0xbc, 0x99, 0xa9, 0x72, 0xa8, 0xfd, 0x1f, 0x10, 0x03, 0xd2, 0x38, 0x91, 0x09, 0x3c, 0x83,
}
testEntryHeader = EntryHeader{
ID: 0x52414230,
SizeSigned: 0x4a8,
IsCompressed: 0x1,
FullSize: 0x4a8,
SizePacked: 0x4d0,
IsSigned: 1,
SigFingerprint: [16]byte{0x27, 0x93, 0x94, 0xca, 0xc2, 0xc2, 0x4e, 0xfb, 0x97, 0xae, 0xda, 0x24, 0x1d, 0x31, 0xc8, 0xde},
Version: [4]byte{0x1, 0x15, 0x5, 0x17},
Unknown54: 0x2cf,
Unknown64: 0x424C5A50,
Unknown68: 0x100,
UnknownA0: 0x25,
UnknownA4: 0x0D,
UnknownA8: 0x01,
}
testDirectoryEntry = DirectoryEntry{Type: 0x30, Size: 0x4d0, Location: 0x2fdc00 + DefaultFlashMapping, Reserved: 0x0}
testEntry = Entry{
DirectoryEntry: testDirectoryEntry,
Header: &testEntryHeader,
Raw: entryBytes,
Signature: expectedSignature,
Comment: nil,
}
expectedSignature = entryBytes[0x3d0:]
expectedBody = entryBytes
)
func TestHeaderSizeStatic(t *testing.T) {
assert.Equal(t, 0x100, binary.Size(EntryHeader{}))
}
func TestParseEntryFailToSmall(t *testing.T) {
imageToSmall := make([]byte, 0xc0000)
entry, err := ParseEntry(imageToSmall, testDirectoryEntry, DefaultFlashMapping)
expectedError := "Not a parsable Entry: Location out of bounds (0x002FDC00)"
expectedEntry := Entry{
DirectoryEntry: testDirectoryEntry,
Comment: []string{expectedError},
TypeInfo: &TypeInfo{},
}
assert.EqualError(t, err, expectedError)
assert.Equal(t, expectedEntry, *entry)
}
func TestParseEntryFailSizeToBig(t *testing.T) {
imageToSmall := make([]byte, 0xc0000)
directoryEntry := DirectoryEntry{
Type: 0xFFFFFFFF,
Size: 0xFFFF0000,
Location: 0x0,
Reserved: 0,
}
entry, err := ParseEntry(imageToSmall, directoryEntry, DefaultFlashMapping)
expectedError := "Not a parsable Entry: Size to big (0xFFFF0000)"
expectedEntry := Entry{
DirectoryEntry: directoryEntry,
Comment: []string{"Unknown Type: 0xFFFFFFFF", expectedError},
}
assert.EqualError(t, err, expectedError)
assert.Equal(t, expectedEntry, *entry)
}
func TestParseEntryAll0xFF(t *testing.T) {
imageToSmall := make([]byte, testImage16MB)
directoryEntry := DirectoryEntry{
Type: 0xFFFFFFFF,
Size: 0x00001000,
Location: 0xFF000000,
Reserved: 0,
}
expectedError := "Not a parsable Entry: All Fields are 0xFF"
expectedEntry := Entry{
DirectoryEntry: directoryEntry,
Comment: []string{"Unknown Type: 0xFFFFFFFF", expectedError},
TypeInfo: nil,
Raw: bytes.Repeat([]byte{0xFF}, int(directoryEntry.Size)),
}
copy(imageToSmall[directoryEntry.Location-DefaultFlashMapping:], expectedEntry.Raw)
entry, err := ParseEntry(imageToSmall, directoryEntry, DefaultFlashMapping)
assert.EqualError(t, err, expectedError)
assert.Equal(t, expectedEntry, *entry)
}
func TestParseEntryAll0x00(t *testing.T) {
imageToSmall := make([]byte, testImage16MB)
directoryEntry := DirectoryEntry{
Type: 0xFFFFFFFF,
Size: 0x00001000,
Location: 0xFF000000,
Reserved: 0,
}
expectedError := "Not a parsable Entry: All Fields are 0x00"
expectedEntry := Entry{
DirectoryEntry: directoryEntry,
Comment: []string{"Unknown Type: 0xFFFFFFFF", expectedError},
TypeInfo: nil,
Raw: bytes.Repeat([]byte{0x00}, int(directoryEntry.Size)),
}
copy(imageToSmall[directoryEntry.Location-DefaultFlashMapping:], expectedEntry.Raw)
entry, err := ParseEntry(imageToSmall, directoryEntry, DefaultFlashMapping)
assert.EqualError(t, err, expectedError)
assert.Equal(t, expectedEntry, *entry)
}
func TestParseEntry(t *testing.T) {
imageToSmall := make([]byte, testImage16MB)
copy(imageToSmall[testDirectoryEntry.Location-DefaultFlashMapping:], entryBytes)
assert.Equal(t, testDirectoryEntry.Size, uint32(len(entryBytes)))
entry, err := ParseEntry(imageToSmall, testDirectoryEntry, DefaultFlashMapping)
assert.Nil(t, err)
assert.Equal(t, testDirectoryEntry, entry.DirectoryEntry)
assert.Equal(t, testEntryHeader, *entry.Header)
assert.Equal(t, expectedSignature, entry.Signature)
assert.Equal(t, expectedBody, entry.Raw)
}
func TestEntry_Write(t *testing.T) {
expectedImage := make([]byte, testImage16MB)
copy(expectedImage[testDirectoryEntry.Location-DefaultFlashMapping:], entryBytes)
baseImage := make([]byte, testImage16MB)
testEntry.Write(baseImage, testDirectoryEntry.Location-DefaultFlashMapping)
assert.Equal(t, expectedImage, baseImage)
}