Skip to content

Commit e241b13

Browse files
author
Cruz Monrreal
authored
Merge pull request #9452 from RonEld/crypto_platform_ranaming
Crypto platform renaming
2 parents c767910 + cad40e1 commit e241b13

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

features/cryptocell/FEATURE_CRYPTOCELL310/Readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ To port your CC 310 driver to Mbed OS on your specific target, do the following:
2424
1. In `features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_<target name>`, add your platform-specific libraries for all toolchains in `TOOLCHAIN_ARM`, `TOOLCHAIN_GCC_ARM` and `TOOLCHAIN_IAR` respectively.
2525
1. Add your CC setup code:
2626
* Implement `crypto_platform_setup()` and `crypto_platform_terminate()` to enable CC on your platform, in case you have board-specific setup functionality, required for CC setup. You MUST call 'SaSi_LibInit()` and 'SaSi_LibFini()' respectively in these functions.
27-
* Define `crypto_platform_ctx` in `crypto_platform.h` in a way that suits your implementation.
27+
* Define `crypto_platform_ctx` in `crypto_device_platform.h` in a way that suits your implementation.
2828

features/cryptocell/FEATURE_CRYPTOCELL310/trng.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "trng_api.h"
2525
#include "mbedtls/platform.h"
2626

27-
extern mbedtls_platform_context ctx;
27+
extern mbedtls_platform_context plat_ctx;
2828
static CRYS_RND_WorkBuff_t rndWorkBuff = { { 0 } };
2929

3030
/* Implementation that should never be optimized out by the compiler */
@@ -49,7 +49,7 @@ CRYSError_t LLF_RND_GetTrngSource(
4949

5050
void trng_init(trng_t *obj)
5151
{
52-
RNG_PLAT_SetUserRngParameters(&ctx.platform_impl_ctx.rndState, obj);
52+
RNG_PLAT_SetUserRngParameters(&plat_ctx.platform_impl_ctx.rndState, obj);
5353
}
5454

5555
void trng_free(trng_t *obj)
@@ -67,7 +67,7 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *outputLe
6767
uint32_t actualLength;
6868

6969
ret = LLF_RND_GetTrngSource(
70-
&ctx.platform_impl_ctx.rndState , /*in/out*/
70+
&plat_ctx.platform_impl_ctx.rndState , /*in/out*/
7171
obj, /*in/out*/
7272
0, /*in*/
7373
&entropySizeBits, /*in/out*/

features/mbedtls/platform/inc/platform_alt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define __PLATFORM_ALT__
2323
#include "platform_mbed.h"
2424
#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
25-
#include "crypto_platform.h"
25+
#include "crypto_device_platform.h"
2626
/**
2727
* \brief The platform context structure.
2828
*

features/mbedtls/platform/src/platform_alt.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,30 +22,30 @@
2222
#if defined(MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT)
2323
#include "mbed_critical.h"
2424

25-
mbedtls_platform_context ctx = { { 0 } };
25+
mbedtls_platform_context plat_ctx = { { 0 } };
2626

2727
int mbedtls_platform_setup( mbedtls_platform_context *unused_ctx )
2828
{
2929
int ret = 0;
3030

31-
core_util_atomic_incr_u32( ( volatile uint32_t * )&ctx.reference_count, 1 );
31+
core_util_atomic_incr_u32( ( volatile uint32_t * )&plat_ctx.reference_count, 1 );
3232

33-
if( ctx.reference_count == 1 )
33+
if( plat_ctx.reference_count == 1 )
3434
{
3535
/* call platform specific code to setup crypto driver */
36-
ret = crypto_platform_setup( &ctx.platform_impl_ctx );
36+
ret = crypto_platform_setup( &plat_ctx.platform_impl_ctx );
3737
}
3838
return ( ret );
3939
}
4040

4141
void mbedtls_platform_teardown( mbedtls_platform_context *unused_ctx )
4242
{
43-
core_util_atomic_decr_u32( ( volatile uint32_t * )&ctx.reference_count, 1 );
44-
if( ctx.reference_count < 1 )
43+
core_util_atomic_decr_u32( ( volatile uint32_t * )&plat_ctx.reference_count, 1 );
44+
if( plat_ctx.reference_count < 1 )
4545
{
4646
/* call platform specific code to terminate crypto driver */
47-
crypto_platform_terminate( &ctx.platform_impl_ctx );
48-
ctx.reference_count = 0;
47+
crypto_platform_terminate( &plat_ctx.platform_impl_ctx );
48+
plat_ctx.reference_count = 0;
4949
}
5050
}
5151

0 commit comments

Comments
 (0)