1 /* SPDX-License-Identifier: GPL-2.0 2 * 3 * Copyright (C) 2020 Intel Corporation <www.intel.com> 4 * 5 */ 6 7 #ifndef _SECURE_VAB_H_ 8 #define _SECURE_VAB_H_ 9 10 #include <linux/sizes.h> 11 #include <linux/stddef.h> 12 #include <u-boot/sha512.h> 13 14 #define VAB_DATA_SZ 64 15 16 #define SDM_CERT_MAGIC_NUM 0x25D04E7F 17 #define FCS_HPS_VAB_MAGIC_NUM 0xD0564142 18 19 #define MAX_CERT_SIZE (SZ_4K) 20 21 /* 22 * struct fcs_hps_vab_certificate_data 23 * @vab_cert_magic_num: VAB Certificate Magic Word (0xD0564142) 24 * @flags: TBD 25 * @fcs_data: Data words being certificate signed. 26 * @cert_sign_keychain: Certificate Signing Keychain 27 */ 28 struct fcs_hps_vab_certificate_data { 29 u32 vab_cert_magic_num; /* offset 0x10 */ 30 u32 flags; 31 u8 rsvd0_1[8]; 32 u8 fcs_sha384[SHA384_SUM_LEN]; /* offset 0x20 */ 33 }; 34 35 /* 36 * struct fcs_hps_vab_certificate_header 37 * @cert_magic_num: Certificate Magic Word (0x25D04E7F) 38 * @cert_data_sz: size of this certificate header (0x80) 39 * Includes magic number all the way to the certificate 40 * signing keychain (excludes cert. signing keychain) 41 * @cert_ver: Certificate Version 42 * @cert_type: Certificate Type 43 * @data: VAB HPS Image Certificate data 44 */ 45 struct fcs_hps_vab_certificate_header { 46 u32 cert_magic_num; /* offset 0 */ 47 u32 cert_data_sz; 48 u32 cert_ver; 49 u32 cert_type; 50 struct fcs_hps_vab_certificate_data d; /* offset 0x10 */ 51 /* keychain starts at offset 0x50 */ 52 }; 53 54 #define VAB_CERT_HEADER_SIZE sizeof(struct fcs_hps_vab_certificate_header) 55 #define VAB_CERT_MAGIC_OFFSET offsetof \ 56 (struct fcs_hps_vab_certificate_header, d) 57 #define VAB_CERT_FIT_SHA384_OFFSET offsetof \ 58 (struct fcs_hps_vab_certificate_data, \ 59 fcs_sha384[0]) 60 61 int socfpga_vendor_authentication(void **p_image, size_t *p_size); 62 63 #endif /* _SECURE_VAB_H_ */ 64