Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
186acdd9
Commit
186acdd9
authored
5 years ago
by
Soby Mathew
Committed by
TrustedFirmware Code Review
5 years ago
Browse files
Options
Download
Plain Diff
Merge "cryptocell: add cryptocell 712 RSA 3K support" into integration
parents
255b380a
b8622922
master
v2.5
v2.5-rc1
v2.5-rc0
v2.4
v2.4-rc2
v2.4-rc1
v2.4-rc0
v2.3
v2.3-rc2
v2.3-rc1
v2.3-rc0
arm_cca_v0.2
arm_cca_v0.1
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
docs/getting_started/build-options.rst
+15
-0
docs/getting_started/build-options.rst
drivers/auth/cryptocell/712/cryptocell_crypto.c
+1
-1
drivers/auth/cryptocell/712/cryptocell_crypto.c
drivers/auth/cryptocell/cryptocell_crypto.mk
+3
-1
drivers/auth/cryptocell/cryptocell_crypto.mk
include/drivers/arm/cryptocell/712/rsa.h
+9
-7
include/drivers/arm/cryptocell/712/rsa.h
include/drivers/arm/cryptocell/712/secureboot_gen_defs.h
+13
-3
include/drivers/arm/cryptocell/712/secureboot_gen_defs.h
with
41 additions
and
12 deletions
+41
-12
docs/getting_started/build-options.rst
View file @
186acdd9
...
...
@@ -354,6 +354,21 @@ Common build options
compliant and is retained only for compatibility. The default value of this
flag is ``rsa`` which is the TBBR compliant PKCS#1 RSA 2.1 scheme.
- ``KEY_SIZE``: This build flag enables the user to select the key size for
the algorithm specified by ``KEY_ALG``. The valid values for ``KEY_SIZE``
depend on the chosen algorithm and the cryptographic module.
+-----------+------------------------------------+
| KEY_ALG | Possible key sizes |
+===========+====================================+
| rsa | 1024 , 2048 (default), 3072, 4096* |
+-----------+------------------------------------+
| ecdsa | unavailable |
+-----------+------------------------------------+
* Only 2048 bits size is available with CryptoCell 712 SBROM release 1.
Only 3072 bits size is available with CryptoCell 712 SBROM release 2.
- ``HASH_ALG``: This build flag enables the user to select the secure hash
algorithm. It accepts 3 values: ``sha256``, ``sha384`` and ``sha512``.
The default value of this flag is ``sha256``.
...
...
This diff is collapsed.
Click to expand it.
drivers/auth/cryptocell/712/cryptocell_crypto.c
View file @
186acdd9
...
...
@@ -225,7 +225,7 @@ static int verify_signature(void *data_ptr, unsigned int data_len,
/* Verify the signature */
error
=
CCSbVerifySignature
((
uintptr_t
)
PLAT_CRYPTOCELL_BASE
,
(
uint32_t
*
)
data_ptr
,
&
pk
,
&
signature
,
data_len
,
RSA_PSS
_2048
);
data_len
,
RSA_PSS
);
if
(
error
!=
CC_OK
)
return
CRYPTO_ERR_SIGNATURE
;
...
...
This diff is collapsed.
Click to expand it.
drivers/auth/cryptocell/cryptocell_crypto.mk
View file @
186acdd9
#
# 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
#
...
...
@@ -12,6 +12,8 @@ TF_MBEDTLS_KEY_ALG_ID := TF_MBEDTLS_RSA
# Needs to be set to drive mbed TLS configuration correctly
$(eval
$(call
add_define,TF_MBEDTLS_KEY_ALG_ID))
$(eval
$(call
add_define,KEY_SIZE))
# CCSBROM_LIB_PATH must be set to the Cryptocell SBROM library path
ifeq
(${CCSBROM_LIB_PATH},)
$(error Error
:
CCSBROM_LIB_PATH not set)
...
...
This diff is collapsed.
Click to expand it.
include/drivers/arm/cryptocell/712/rsa.h
View file @
186acdd9
/*
* 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:
*
...
...
This diff is collapsed.
Click to expand it.
include/drivers/arm/cryptocell/712/secureboot_gen_defs.h
View file @
186acdd9
/*
* 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
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help