Skip to content

Commit 51f2ba2

Browse files
author
Andrzej Kurek
committed
Make utility functions visible
1 parent b731c9f commit 51f2ba2

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

atecc608a_se.c

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020
* limitations under the License.
2121
*/
2222
#include "atecc608a_se.h"
23-
24-
#include "psa/crypto.h"
25-
26-
#include "atca_basic.h"
2723
#include "atca_helpers.h"
2824

2925
#ifdef DEBUG_PRINT
@@ -36,26 +32,6 @@
3632
/* Uncomment to print results on success */
3733
//#define DEBUG_PRINT
3834

39-
#define ATCAB_INIT() \
40-
do \
41-
{ \
42-
if (atcab_init(&atca_iface_config) != ATCA_SUCCESS) \
43-
{ \
44-
status = PSA_ERROR_HARDWARE_FAILURE; \
45-
goto exit; \
46-
} \
47-
} while(0)
48-
49-
/** `atcab_release()` might return `ATCA_BAD_PARAM` if there is no global device
50-
* initialized via `atcab_init()`. HAL might return an error if an i2c device
51-
* cannot be released, but in current implementations it always returns
52-
* `ATCA_SUCCESS` - therefore we are ignoring the return code. */
53-
#define ATCAB_DEINIT() \
54-
do \
55-
{ \
56-
atcab_release(); \
57-
} while(0)
58-
5935
/** This macro checks if the result of an `expression` is equal to an
6036
* `expected` value and sets a `status` variable of type `psa_status_t` to
6137
* `PSA_SUCCESS`. If they are not equal, the `status` is set to
@@ -77,7 +53,7 @@
7753
#define ASSERT_SUCCESS(expression) ASSERT_STATUS(expression, ATCA_SUCCESS, \
7854
atecc608a_to_psa_error(ASSERT_result))
7955

80-
static ATCAIfaceCfg atca_iface_config = {
56+
ATCAIfaceCfg atca_iface_config = {
8157
.iface_type = ATCA_I2C_IFACE,
8258
.devtype = ATECC608A,
8359
.atcai2c.slave_address = 0xC0,
@@ -87,7 +63,7 @@ static ATCAIfaceCfg atca_iface_config = {
8763
.rx_retries = 20,
8864
};
8965

90-
static psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret)
66+
psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret)
9167
{
9268
switch (ret)
9369
{

atecc608a_se.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,32 @@
2424
#define ATECC608A_SE_H
2525

2626
#include "psa/crypto_se_driver.h"
27+
#include "atca_basic.h"
2728

2829
extern psa_drv_se_info_t atecc608a_drv_info;
30+
extern ATCAIfaceCfg atca_iface_config;
2931

32+
psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret);
33+
34+
#define ATCAB_INIT() \
35+
do \
36+
{ \
37+
if (atcab_init(&atca_iface_config) != ATCA_SUCCESS) \
38+
{ \
39+
status = PSA_ERROR_HARDWARE_FAILURE; \
40+
goto exit; \
41+
} \
42+
} while(0)
43+
44+
/** `atcab_release()` might return `ATCA_BAD_PARAM` if there is no global device
45+
* initialized via `atcab_init()`. HAL might return an error if an i2c device
46+
* cannot be released, but in current implementations it always returns
47+
* `ATCA_SUCCESS` - therefore we are ignoring the return code. */
48+
#define ATCAB_DEINIT() \
49+
do \
50+
{ \
51+
atcab_release(); \
52+
} while(0)
53+
54+
3055
#endif /* ATECC608A_SE_H */

0 commit comments

Comments
 (0)