firmware_encrypted.h 874 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef FIRMWARE_ENCRYPTED_H
  8. #define FIRMWARE_ENCRYPTED_H
  9. #include <stdint.h>
  10. /* This is used as a signature to validate the encryption header */
  11. #define ENC_HEADER_MAGIC 0xAA640001U
  12. /* Firmware encryption status flag mask */
  13. #define FW_ENC_STATUS_FLAG_MASK 0x1
  14. /*
  15. * SSK: Secret Symmetric Key
  16. * BSSK: Binding Secret Symmetric Key
  17. */
  18. enum fw_enc_status_t {
  19. FW_ENC_WITH_SSK = 0,
  20. FW_ENC_WITH_BSSK = 1,
  21. };
  22. #define ENC_MAX_IV_SIZE 16U
  23. #define ENC_MAX_TAG_SIZE 16U
  24. #define ENC_MAX_KEY_SIZE 32U
  25. struct fw_enc_hdr {
  26. uint32_t magic;
  27. uint16_t dec_algo;
  28. uint16_t flags;
  29. uint16_t iv_len;
  30. uint16_t tag_len;
  31. uint8_t iv[ENC_MAX_IV_SIZE];
  32. uint8_t tag[ENC_MAX_TAG_SIZE];
  33. };
  34. #endif /* FIRMWARE_ENCRYPTED_H */