fwtool: add utility for appending and extracting firmware metadata/signatures
[openwrt/.git] / package / system / fwtool / src / fwimage.h
1 /*
2  * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2
6  * as published by the Free Software Foundation
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 #ifndef __FWIMAGE_H
14 #define __FWIMAGE_H
15
16 #include <stdint.h>
17
18 #define FWIMAGE_MAGIC           0x46577830 /* FWx0 */
19
20 struct fwimage_header {
21         uint32_t version;
22         uint32_t flags;
23         char data[];
24 };
25
26 struct fwimage_trailer {
27         uint32_t magic;
28         uint32_t crc32;
29         uint8_t type;
30         uint8_t __pad[3];
31         uint32_t size;
32 };
33
34 enum fwimage_type {
35         FWIMAGE_SIGNATURE,
36         FWIMAGE_INFO,
37 };
38
39 #endif