File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840 Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ int crypto_platform_setup( crypto_platform_ctx *ctx )
34
34
NRF_CRYPTOCELL -> ENABLE = 1 ;
35
35
36
36
if ( SaSi_LibInit ( & rndState , & rndWorkBuff ) != 0 )
37
- return ( -1 );
37
+ return ( MBEDTLS_PLATFORM_HW_FAILED );
38
38
39
39
return ( 0 );
40
40
}
Original file line number Diff line number Diff line change 24
24
#if defined(MBEDTLS_CONFIG_HW_SUPPORT )
25
25
#include "mbedtls_device.h"
26
26
#endif
27
+
28
+ #define MBEDTLS_PLATFORM_INVALID_DATA -0x0080
29
+ #define MBEDTLS_PLATFORM_HW_FAILED -0x0082
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ int mbedtls_platform_setup( mbedtls_platform_context *ctx )
27
27
{
28
28
int ret = 0 ;
29
29
if ( ctx == NULL )
30
- return ( -1 );
30
+ return ( MBEDTLS_PLATFORM_INVALID_DATA );
31
31
32
32
reference_count ++ ;
33
33
@@ -44,15 +44,13 @@ void mbedtls_platform_teardown( mbedtls_platform_context *ctx )
44
44
if ( ctx == NULL )
45
45
return ;
46
46
47
- if ( reference_count == 0 )
48
- return ;
49
-
50
47
reference_count -- ;
51
48
52
- if ( reference_count = = 0 )
49
+ if ( reference_count < = 0 )
53
50
{
54
51
/* call platform specific code to terminate crypto driver*/
55
52
crypto_platform_terminate ( & ctx -> platform_impl_ctx );
53
+ reference_count = 0 ;
56
54
}
57
55
}
58
56
You can’t perform that action at this time.
0 commit comments