blob: 395e66ae83f9a9ba3fa811ace020b60a5b633f3c [file] [log] [blame]
Daisuke Nojirie1741c52015-02-09 18:15:17 -08001/*
2 * Copyright (C) 2015 Broadcom Corporation
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
Daisuke Nojirie1741c52015-02-09 18:15:17 -080014#ifndef _SECIMAGE_H_
15#define _SECIMAGE_H_
16
17#include <stdint.h>
18#include <sys/types.h>
19
20#define FIELD1_OFFSET 16
21#define FIELD2_OFFSET 18
22#define FIELD3_OFFSET 20
23#define FIELD4_OFFSET 36
24#define FIELD5_OFFSET 40
25#define FIELD6_OFFSET 44
26#define FIELD7_OFFSET 48
27#define FIELD8_OFFSET 50
28#define FIELD9_OFFSET 60
29
30typedef struct Header_t {
31 uint32_t Tag;
32 uint32_t Length;
33 uint32_t Reserved;
34 uint32_t crc;
35} HEADER;
36
37int DataWrite(char *filename, char *buf, int length);
38int DataRead(char *filename, uint8_t *buf, int *length);
39int AppendHMACSignature(uint8_t *data, uint32_t length, char *filename,
40 uint32_t offset);
41int ReadBinaryFile(char *fname, uint8_t *buf, int maxlen);
Daisuke Nojirie1741c52015-02-09 18:15:17 -080042void FillHeaderFromConfigFile(char *h, char *ConfigFileName);
43
44#endif /* _SECIMAGE_H_ */