Skip to content

Commit 447bff9

Browse files
LavanyaSelvarajumichaelthomasjaniruddhabajaj-renesasAjay NVarun.C
authored
Fspra 3246 mbedtls update 3 6 0 (#25)
* Fspra 2646 mbedtls update 3 5 0 (#21) * Added mbedcrypto changes * More changes * fix warning * added path for RSA wrapped keys * update for new key id argument * Updated export size macro to return value for wrapped keys also fixed missing argument * exposed new ecc static fns * ECP macro updates for wrapped keys * ECP key import/export updates * Fixed CMAC and GCM usage * added macro to exclude vendor path if RSA/ECCis not enabled * removed test code * fixed else condition * remove commented code 2 * Undo persistent check * review comments * removed commented code * Added check for MBEDTLS_CIPHER_ALT * type update * updates for 2.4 * updated RSA wrapped key type check * macro condition fix * retained changes from older release * Added HW acceleration segment * ECP HW acceleration * HW acceleration updates. * made vendor related changes * fix for persistent key support. * updated unpadding of rsa pkcs * changes in slot management src code * AES hardware acceleration enabled. * fix for vendor key import * SWFLEX-4447: Updated dlot management src code * remove unused definitions * Vendor related changes * Temporary change * test change for IAR compiler * reverted test changes * test change to fix ac6 error * Merge pull request Mbed-TLS#6090 from hanno-arm/fix_bnmul_arm_v7a Remove encoding width suffix from Arm bignum assembly * Updated crypto cipher file to support XTS mode * tfm-1-7-0 specific patch * tfm patch on driver wrapper key agreement * Vendor related changes * change in ecp file * Updated psa_util * FSPRA-754 Updated header files * FSPRA-754 Updated aead src file * FSPRA-754 Reverted the changes of constant_time_interval * FSPRA-754 Reverted back the changes of crypto aead * FSPRA-754 Fixed build error * tfm builtin key retrieve * Updated crypto cipher src * Updated vendor related code * Vendor code update * Fixed build err * build err * Vendor code update * Deleting unwanted change * Updated vendor changes * Updated magic numbers * Updated crypto mac * Updated mac * Alignment update * Resolved llvm error on trng and aes engines * Updated ecp file * vendor related change * Vendor related changes * Updated constant-time src file * Updated crypto_sizes header * Build failure fix * Test change * Fixed build error * LLVM error fix --------- Co-authored-by: Michael Thomas <[email protected]> Co-authored-by: michaelthomasj <[email protected]> Co-authored-by: aniruddhabajaj-renesas <[email protected]> Co-authored-by: Ajay N <[email protected]> Co-authored-by: aniruddha.bajaj <[email protected]> Co-authored-by: Varun.C <[email protected]> Co-authored-by: Dave Rodgman <[email protected]> Co-authored-by: lavanya.selvaraju.cj <[email protected]> * Patch for TFM 2.0.0 (#23) Co-authored-by: lavanya.selvaraju.cj <[email protected]> * Add header to include acceleration header file * Fspra 2555 psa ed25519 3.4.0 renesas.7 (#22) * Added mbedcrypto changes * Vendor related changes * Updated ecp file * Fixed err * Updated psa_crypto_slot_management * Fixed errors * Fixed IAR error * Updated src file * RSA file update * Test change * Added comment --------- Co-authored-by: Michael Thomas <[email protected]> Co-authored-by: michaelthomasj <[email protected]> Co-authored-by: aniruddhabajaj-renesas <[email protected]> Co-authored-by: Ajay N <[email protected]> Co-authored-by: aniruddha.bajaj <[email protected]> Co-authored-by: Varun.C <[email protected]> Co-authored-by: Dave Rodgman <[email protected]> Co-authored-by: lavanya.selvaraju.cj <[email protected]> Co-authored-by: hienthehuynh <[email protected]>
1 parent 2ca6c28 commit 447bff9

24 files changed

+1019
-178
lines changed

include/mbedtls/build_info.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103

104104
/* X.509, TLS and non-PSA crypto configuration */
105105
#if !defined(MBEDTLS_CONFIG_FILE)
106-
#include "mbedtls/mbedtls_config.h"
106+
#include "mbedtls/config.h"
107107
#else
108108
#include MBEDTLS_CONFIG_FILE
109109
#endif

include/psa/crypto.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ psa_status_t psa_hash_compare(psa_algorithm_t alg,
896896
const uint8_t *input,
897897
size_t input_length,
898898
const uint8_t *hash,
899-
size_t hash_length);
899+
const size_t hash_length);
900900

901901
/** The type of the state data structure for multipart hash operations.
902902
*
@@ -1254,7 +1254,7 @@ psa_status_t psa_mac_verify(mbedtls_svc_key_id_t key,
12541254
const uint8_t *input,
12551255
size_t input_length,
12561256
const uint8_t *mac,
1257-
size_t mac_length);
1257+
const size_t mac_length);
12581258

12591259
/** The type of the state data structure for multipart MAC operations.
12601260
*

include/psa/crypto_accel_driver.h

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
/**
2+
* \file psa/crypto_accel_driver.h
3+
* \brief PSA cryptography accelerator driver module
4+
*
5+
* This header declares types and function signatures for cryptography
6+
* drivers that access key material directly. This is meant for
7+
* on-chip cryptography accelerators.
8+
*
9+
* This file is part of the PSA Crypto Driver Model, containing functions for
10+
* driver developers to implement to enable hardware to be called in a
11+
* standardized way by a PSA Cryptographic API implementation. The functions
12+
* comprising the driver model, which driver authors implement, are not
13+
* intended to be called by application developers.
14+
*/
15+
16+
/*
17+
* Copyright The Mbed TLS Contributors
18+
* SPDX-License-Identifier: Apache-2.0
19+
*
20+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
21+
* not use this file except in compliance with the License.
22+
* You may obtain a copy of the License at
23+
*
24+
* http://www.apache.org/licenses/LICENSE-2.0
25+
*
26+
* Unless required by applicable law or agreed to in writing, software
27+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
28+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29+
* See the License for the specific language governing permissions and
30+
* limitations under the License.
31+
*/
32+
#ifndef PSA_CRYPTO_ACCEL_DRIVER_H
33+
#define PSA_CRYPTO_ACCEL_DRIVER_H
34+
35+
#include "crypto_driver_common.h"
36+
#include <stdbool.h>
37+
38+
#ifdef __cplusplus
39+
extern "C" {
40+
#endif
41+
42+
/** Import vendor defined key data into a slot.
43+
*
44+
* `slot->type` must have been set previously.
45+
* This function assumes that the slot does not contain any key material yet.
46+
* On failure, the slot content is unchanged.
47+
*
48+
* Persistent storage is not affected.
49+
*
50+
* \param[in,out] slot The key slot to import data into.
51+
* Its `type` field must have previously been set to
52+
* the desired key type.
53+
* It must not contain any key material yet.
54+
* \param[in] data Buffer containing the key material to parse and import.
55+
* \param data_length Size of \p data in bytes.
56+
* \param write_to_persistent_memory Specify if the imported key needs to be written to persistent memory.
57+
*
58+
* \retval PSA_SUCCESS
59+
* \retval PSA_ERROR_INVALID_ARGUMENT
60+
* \retval PSA_ERROR_NOT_SUPPORTED
61+
* \retval PSA_ERROR_INSUFFICIENT_MEMORY
62+
* \retval Implementation dependent
63+
*/
64+
psa_status_t psa_import_key_into_slot_vendor(const psa_key_attributes_t * attributes,
65+
psa_key_slot_t * slot,
66+
const uint8_t * data,
67+
size_t data_length,
68+
mbedtls_svc_key_id_t * key,
69+
bool write_to_persistent_memory);
70+
71+
/**
72+
* \brief Generate a vendor defined key or key pair.
73+
*
74+
* \note This function has to be defined by the vendor if MBEDTLS_PSA_CRYPTO_ACCEL_DRV_C
75+
* is defined. Do not use this function directly;
76+
* to generate a key, use psa_generate_key() instead.
77+
*
78+
* \param[in] slot
79+
* \param[in] bits
80+
* \param[in] params
81+
* \param[in] params_data_length
82+
*
83+
*
84+
* \retval #PSA_SUCCESS
85+
* Success.
86+
* If the key is persistent, the key material and the key's metadata
87+
* have been saved to persistent storage.
88+
*
89+
* \retval #PSA_ERROR_NOT_SUPPORTED
90+
* \retval Implementation dependent.
91+
*/
92+
psa_status_t psa_generate_key_vendor (psa_key_slot_t * slot,
93+
size_t bits,
94+
const psa_key_production_parameters_t *params,
95+
size_t params_data_length);
96+
97+
/**
98+
* \brief Generate symmetric key of vendor defined format.
99+
*
100+
* \warning This function **can** fail! Callers MUST check the return status
101+
* and MUST NOT use the content of the output buffer if the return
102+
* status is not #PSA_SUCCESS.
103+
*
104+
* \note This function has to be defined by the vendor if MBEDTLS_PSA_CRYPTO_ACCEL_DRV_C
105+
* is defined.
106+
* A weakly linked version is provided by default and returns
107+
* PSA_ERROR_NOT_SUPPORTED. Do not use this function directly;
108+
* to generate a key, use psa_generate_key() instead.
109+
*
110+
* \param[in] type Type of symmetric key to be generated.
111+
* \param[out] output Output buffer for the generated data.
112+
* \param[out] output_size Number of bytes to generate and output.
113+
*
114+
* \retval #PSA_SUCCESS
115+
* \retval #PSA_ERROR_NOT_SUPPORTED
116+
* \retval Implementation dependent
117+
*/
118+
psa_status_t psa_generate_symmetric_vendor(psa_key_type_t type, size_t bits, uint8_t * output, size_t output_size);
119+
120+
/** Finalize the creation of a vendor defined key once its key material has been set.
121+
*
122+
* This entails writing the key to persistent storage.
123+
*
124+
* This function is to be called only by psa_finish_key_creation().
125+
*
126+
* \param[in,out] slot Pointer to the slot with key material.
127+
*
128+
* \retval #PSA_SUCCESS
129+
* The key was successfully created. The handle is now valid.
130+
* \return If this function fails, the key slot is an invalid state.
131+
*/
132+
psa_status_t psa_finish_key_creation_vendor(psa_key_slot_t * slot);
133+
134+
/**@}*/
135+
136+
#ifdef __cplusplus
137+
}
138+
#endif
139+
140+
#endif /* PSA_CRYPTO_ACCEL_DRIVER_H */

include/psa/crypto_extra.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ extern "C" {
3232
#define MBEDTLS_PSA_KEY_SLOT_COUNT 32
3333
#endif
3434

35+
/* Functions to support vendor defined format */
36+
psa_status_t vendor_bitlength_to_raw_bitlength(psa_key_type_t type, size_t vendor_bits, size_t * raw_bits);
37+
void psa_aead_setup_vendor (void * ctx);
38+
39+
3540
/** \addtogroup attributes
3641
* @{
3742
*/

0 commit comments

Comments
 (0)