diff options
author | Soby Mathew <soby.mathew@arm.com> | 2019-12-16 12:17:34 +0000 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2019-12-16 12:17:34 +0000 |
commit | 186acdd979b5e734641eaa75e17c926c12a79e00 (patch) | |
tree | e5366da85e4661518c67b2c6a1f52ea257a2e98f /include | |
parent | 255b380afa17f1c38255d19a064fe4d26ea5025f (diff) | |
parent | b8622922c8ab7a450a3184b7a5f4929bd95ffaad (diff) | |
download | platform_external_arm-trusted-firmware-186acdd979b5e734641eaa75e17c926c12a79e00.tar.gz platform_external_arm-trusted-firmware-186acdd979b5e734641eaa75e17c926c12a79e00.tar.bz2 platform_external_arm-trusted-firmware-186acdd979b5e734641eaa75e17c926c12a79e00.zip |
Merge "cryptocell: add cryptocell 712 RSA 3K support" into integration
Diffstat (limited to 'include')
-rw-r--r-- | include/drivers/arm/cryptocell/712/rsa.h | 16 | ||||
-rw-r--r-- | include/drivers/arm/cryptocell/712/secureboot_gen_defs.h | 16 |
2 files changed, 22 insertions, 10 deletions
diff --git a/include/drivers/arm/cryptocell/712/rsa.h b/include/drivers/arm/cryptocell/712/rsa.h index cd9925b32..825214d20 100644 --- a/include/drivers/arm/cryptocell/712/rsa.h +++ b/include/drivers/arm/cryptocell/712/rsa.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -21,19 +21,21 @@ extern "C" /************************ Defines ******************************/ -/* the modulus size ion bits */ +/* the modulus size in bits */ +#if (KEY_SIZE == 2048) #define RSA_MOD_SIZE_IN_BITS 2048UL +#elif (KEY_SIZE == 3072) +#define RSA_MOD_SIZE_IN_BITS 3072UL +#else +#error Unsupported CryptoCell key size requested +#endif + #define RSA_MOD_SIZE_IN_BYTES (CALC_FULL_BYTES(RSA_MOD_SIZE_IN_BITS)) #define RSA_MOD_SIZE_IN_WORDS (CALC_FULL_32BIT_WORDS(RSA_MOD_SIZE_IN_BITS)) #define RSA_MOD_SIZE_IN_256BITS (RSA_MOD_SIZE_IN_WORDS/8) #define RSA_EXP_SIZE_IN_BITS 17UL #define RSA_EXP_SIZE_IN_BYTES (CALC_FULL_BYTES(RSA_EXP_SIZE_IN_BITS)) -/* size of buffer for Barrett modulus tag NP, used in PKA algorithms */ -#define RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_BITS 132 -#define RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_BYTES (CALC_FULL_BYTES(RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_BITS)) -#define RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_WORDS (CALC_FULL_32BIT_WORDS(RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_BITS)) - /* * @brief The RSA_CalcNp calculates Np value and saves it into Np_ptr: * diff --git a/include/drivers/arm/cryptocell/712/secureboot_gen_defs.h b/include/drivers/arm/cryptocell/712/secureboot_gen_defs.h index 68b9ef8ae..ed1f2835c 100644 --- a/include/drivers/arm/cryptocell/712/secureboot_gen_defs.h +++ b/include/drivers/arm/cryptocell/712/secureboot_gen_defs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2017-2019, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -24,7 +24,14 @@ extern "C" /***********************/ /*RSA definitions*/ +#if (KEY_SIZE == 2048) #define SB_RSA_MOD_SIZE_IN_WORDS 64 +#elif (KEY_SIZE == 3072) +#define SB_RSA_MOD_SIZE_IN_WORDS 96 +#else +#error Unsupported CryptoCell key size requested +#endif + #define SB_RSA_HW_PKI_PKA_BARRETT_MOD_TAG_SIZE_IN_WORDS 5 @@ -43,9 +50,12 @@ typedef struct { /********* Supported algorithms definitions ***********/ /*! RSA supported algorithms */ +/* Note: this applies to either 2k or 3k based on CryptoCell SBROM library + * version - it means 2k in version 1 and 3k in version 2 (yes, really). + */ typedef enum { - RSA_PSS_2048 = 0x01, /*!< RSA PSS 2048 after hash SHA 256 */ - RSA_PKCS15_2048 = 0x02, /*!< RSA PKX15 */ + RSA_PSS = 0x01, /*!< RSA PSS after hash SHA 256 */ + RSA_PKCS15 = 0x02, /*!< RSA PKX15 */ RSA_Last = 0x7FFFFFFF } CCSbRsaAlg_t; |