Sumit Garg | 617e215 | 2019-11-15 15:34:55 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020, Linaro Limited. All rights reserved. |
| 3 | * Author: Sumit Garg <sumit.garg@linaro.org> |
| 4 | * |
| 5 | * SPDX-License-Identifier: BSD-3-Clause |
| 6 | */ |
| 7 | |
| 8 | #ifndef FIRMWARE_ENCRYPTED_H |
| 9 | #define FIRMWARE_ENCRYPTED_H |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | |
| 13 | /* This is used as a signature to validate the encryption header */ |
| 14 | #define ENC_HEADER_MAGIC 0xAA640001U |
| 15 | |
| 16 | /* Firmware encryption status flag mask */ |
| 17 | #define FW_ENC_STATUS_FLAG_MASK 0x1 |
| 18 | |
| 19 | /* |
| 20 | * SSK: Secret Symmetric Key |
| 21 | * BSSK: Binding Secret Symmetric Key |
| 22 | */ |
| 23 | enum fw_enc_status_t { |
| 24 | FW_ENC_WITH_SSK = 0, |
| 25 | FW_ENC_WITH_BSSK = 1, |
| 26 | }; |
| 27 | |
| 28 | #define ENC_MAX_IV_SIZE 16U |
| 29 | #define ENC_MAX_TAG_SIZE 16U |
| 30 | #define ENC_MAX_KEY_SIZE 32U |
| 31 | |
| 32 | struct fw_enc_hdr { |
| 33 | uint32_t magic; |
| 34 | uint16_t dec_algo; |
| 35 | uint16_t flags; |
| 36 | uint16_t iv_len; |
| 37 | uint16_t tag_len; |
| 38 | uint8_t iv[ENC_MAX_IV_SIZE]; |
| 39 | uint8_t tag[ENC_MAX_TAG_SIZE]; |
| 40 | }; |
| 41 | |
| 42 | #endif /* FIRMWARE_ENCRYPTED_H */ |