blob: ed1f2835c89e17fe2ea15a15b4fc276182d484e4 [file] [log] [blame]
Soby Mathew1ae83bc2017-05-10 11:48:40 +01001/*
Gilad Ben-Yossefa6e53422019-09-15 13:29:29 +03002 * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved.
Soby Mathew1ae83bc2017-05-10 11:48:40 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _SECURE_BOOT_GEN_DEFS_H
8#define _SECURE_BOOT_GEN_DEFS_H
9
10#ifdef __cplusplus
11extern "C"
12{
13#endif
14
15/*! @file
16@brief This file contains all of the definitions and structures that are used for the secure boot.
17*/
18
19#include "cc_pal_sb_plat.h"
20#include "cc_sec_defs.h"
21
22
23/* General definitions */
24/***********************/
25
26/*RSA definitions*/
Gilad Ben-Yossefa6e53422019-09-15 13:29:29 +030027#if (KEY_SIZE == 2048)
Soby Mathew1ae83bc2017-05-10 11:48:40 +010028#define SB_RSA_MOD_SIZE_IN_WORDS 64
Gilad Ben-Yossefa6e53422019-09-15 13:29:29 +030029#elif (KEY_SIZE == 3072)
30#define SB_RSA_MOD_SIZE_IN_WORDS 96
31#else
32#error Unsupported CryptoCell key size requested
33#endif
34
Soby Mathew1ae83bc2017-05-10 11:48:40 +010035#define SB_RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_WORDS 5
36
37
38/*! Public key data structure. */
39typedef struct {
40 uint32_t N[SB_RSA_MOD_SIZE_IN_WORDS]; /*!< N public key, big endian representation. */
41 uint32_t Np[SB_RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_WORDS]; /*!< Np (Barrett n' value). */
42} CCSbNParams_t;
43
44/*! Signature structure. */
45typedef struct {
46 uint32_t sig[SB_RSA_MOD_SIZE_IN_WORDS]; /*!< RSA PSS signature. */
47} CCSbSignature_t;
48
49
50/********* Supported algorithms definitions ***********/
51
52/*! RSA supported algorithms */
Gilad Ben-Yossefa6e53422019-09-15 13:29:29 +030053/* Note: this applies to either 2k or 3k based on CryptoCell SBROM library
54 * version - it means 2k in version 1 and 3k in version 2 (yes, really).
55 */
Soby Mathew1ae83bc2017-05-10 11:48:40 +010056typedef enum {
Gilad Ben-Yossefa6e53422019-09-15 13:29:29 +030057 RSA_PSS = 0x01, /*!< RSA PSS after hash SHA 256 */
58 RSA_PKCS15 = 0x02, /*!< RSA PKX15 */
Soby Mathew1ae83bc2017-05-10 11:48:40 +010059 RSA_Last = 0x7FFFFFFF
60} CCSbRsaAlg_t;
61
62#ifdef __cplusplus
63}
64#endif
65
66#endif