Daisuke Nojiri | e1741c5 | 2015-02-09 18:15:17 -0800 | [diff] [blame] | 1 | /* |
| 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 Nojiri | e1741c5 | 2015-02-09 18:15:17 -0800 | [diff] [blame] | 14 | #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 | |
| 30 | typedef struct Header_t { |
| 31 | uint32_t Tag; |
| 32 | uint32_t Length; |
| 33 | uint32_t Reserved; |
| 34 | uint32_t crc; |
| 35 | } HEADER; |
| 36 | |
| 37 | int DataWrite(char *filename, char *buf, int length); |
| 38 | int DataRead(char *filename, uint8_t *buf, int *length); |
| 39 | int AppendHMACSignature(uint8_t *data, uint32_t length, char *filename, |
| 40 | uint32_t offset); |
| 41 | int ReadBinaryFile(char *fname, uint8_t *buf, int maxlen); |
Daisuke Nojiri | e1741c5 | 2015-02-09 18:15:17 -0800 | [diff] [blame] | 42 | void FillHeaderFromConfigFile(char *h, char *ConfigFileName); |
| 43 | |
| 44 | #endif /* _SECIMAGE_H_ */ |