1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _SECUREBOOT_PARSER_GEN_DEFS_H_
8 #define _SECUREBOOT_PARSER_GEN_DEFS_H_
9 
10 
11 #include "cc_pal_sb_plat.h"
12 #include "cc_pka_hw_plat_defs.h"
13 #include "rsa_bsv.h"
14 #include "secureboot_defs.h"
15 
16 
17 /*! Public key data structure. */
18 typedef struct {
19     uint32_t N[SB_CERT_RSA_KEY_SIZE_IN_WORDS];              /*!< N public key, big endian representation. */
20     uint32_t Np[RSA_PKA_BARRETT_MOD_TAG_BUFF_SIZE_IN_WORDS];    /*!< Np (Barrett n' value). */
21 }CCSbNParams_t;
22 
23 
24 /*! SW image data structure. */
25 typedef struct {
26     uint32_t SwHashResult[HASH_RESULT_SIZE_IN_WORDS];       /*!< Hash calculated on the record.*/
27     CCAddr_t    memLoadAddr;                    /*!< Memory load address. */
28 }CCSbHashRecordInfo_t;
29 
30 
31 /*! Signature structure. */
32 typedef struct {
33     uint32_t sig[SB_CERT_RSA_KEY_SIZE_IN_WORDS];                /*!< RSA PSS signature. */
34 }CCSbSignature_t;
35 
36 /*! SW component additional parameters. */
37 typedef struct {
38     CCAddr_t  StoreAddr;                        /*!< Storage address. */
39     uint32_t    Len;                        /*!< Size of the SW component in words. */
40 }CCSbSwImgAddData_t;
41 
42 
43 /********* Supported algorithms definitions ***********/
44 
45 /*! hash supported algorithms. */
46 typedef enum {
47     HASH_SHA256_Alg_Output      = 0x01,     /*!< hash SHA 256 output. */
48     HASH_SHA256_Alg_128_Output  = 0x02,     /*!< hash SHA 256 output truncated to 128 bits. */
49     HASH_Last                   = 0x7FFFFFFF
50 
51 }CCSbHashAlg_t;
52 
53 
54 /*! RSA supported algorithms */
55 typedef enum {
56     RSA_ALG_MIN,
57     RSA_PSS_2048           = 0x01,          /*!< RSA PSS 2048 after hash SHA 256 */
58     RSA_PSS_3072           = 0x02,          /*!< RSA PSS 3072 after hash SHA 256 */
59     RSA_ALG_MAX,
60     RSA_Last               = 0x7FFFFFFF
61 }CCSbSignAlg_t;
62 
63 #endif /* _GEN_SECUREBOOT_PARSER_GEN_DEFS_H_ */
64