1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * * Copyright (C) 2007 Ubiquiti Networks, Inc.
10 #include <sys/types.h>
12 #define MAGIC_HEADER "OPEN"
13 #define MAGIC_PART "PART"
14 #define MAGIC_END "END."
15 #define MAGIC_ENDS "ENDS"
17 #define MAGIC_LENGTH 4
18 #define PART_NAME_LENGTH 16
20 typedef struct header
{
21 char magic
[MAGIC_LENGTH
];
25 } __attribute__ ((packed
)) header_t
;
28 char magic
[MAGIC_LENGTH
];
29 char name
[PART_NAME_LENGTH
];
37 } __attribute__ ((packed
)) part_t
;
39 typedef struct part_crc
{
42 } __attribute__ ((packed
)) part_crc_t
;
44 typedef struct signature
{
45 uint8_t magic
[MAGIC_LENGTH
];
48 } __attribute__ ((packed
)) signature_t
;
50 typedef struct signature_rsa
{
51 uint8_t magic
[MAGIC_LENGTH
];
53 unsigned char rsa_signature
[256];
55 } __attribute__ ((packed
)) signature_rsa_t
;
59 #define INFO(...) fprintf(stdout, __VA_ARGS__)
60 #define ERROR(...) fprintf(stderr, "ERROR: "__VA_ARGS__)
61 #define WARN(...) fprintf(stderr, "WARN: "__VA_ARGS__)
62 #define DEBUG(...) do {\
64 fprintf(stdout, "DEBUG: "__VA_ARGS__); \