Skip to content

Commit 19724e9

Browse files
author
Andrzej Kurek
committed
Remove utility functions that are visible in the driver
1 parent 0450289 commit 19724e9

File tree

2 files changed

+2
-88
lines changed

2 files changed

+2
-88
lines changed

atecc608a_utils.c

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -19,73 +19,10 @@
1919
* See the License for the specific language governing permissions and
2020
* limitations under the License.
2121
*/
22-
#include "atecc608a_se.h"
2322
#include "atecc608a_utils.h"
2423

2524
#include "atca_basic.h"
2625

27-
ATCAIfaceCfg atca_iface_config = {
28-
.iface_type = ATCA_I2C_IFACE,
29-
.devtype = ATECC608A,
30-
.atcai2c.slave_address = 0xC0,
31-
.atcai2c.bus = 2,
32-
.atcai2c.baud = 400000,
33-
.wake_delay = 1500,
34-
.rx_retries = 20,
35-
};
36-
37-
psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret)
38-
{
39-
switch (ret)
40-
{
41-
case ATCA_SUCCESS:
42-
case ATCA_RX_NO_RESPONSE:
43-
case ATCA_WAKE_SUCCESS:
44-
return PSA_SUCCESS;
45-
case ATCA_BAD_PARAM:
46-
case ATCA_INVALID_ID:
47-
return PSA_ERROR_INVALID_ARGUMENT;
48-
case ATCA_ASSERT_FAILURE:
49-
return PSA_ERROR_TAMPERING_DETECTED;
50-
case ATCA_SMALL_BUFFER:
51-
return PSA_ERROR_BUFFER_TOO_SMALL;
52-
case ATCA_RX_CRC_ERROR:
53-
case ATCA_RX_FAIL:
54-
case ATCA_STATUS_CRC:
55-
case ATCA_RESYNC_WITH_WAKEUP:
56-
case ATCA_PARITY_ERROR:
57-
case ATCA_TX_TIMEOUT:
58-
case ATCA_RX_TIMEOUT:
59-
case ATCA_TOO_MANY_COMM_RETRIES:
60-
case ATCA_COMM_FAIL:
61-
case ATCA_TIMEOUT:
62-
case ATCA_TX_FAIL:
63-
case ATCA_NO_DEVICES:
64-
return PSA_ERROR_COMMUNICATION_FAILURE;
65-
case ATCA_UNIMPLEMENTED:
66-
return PSA_ERROR_NOT_SUPPORTED;
67-
case ATCA_ALLOC_FAILURE:
68-
return PSA_ERROR_INSUFFICIENT_MEMORY;
69-
case ATCA_BAD_OPCODE:
70-
case ATCA_CONFIG_ZONE_LOCKED:
71-
case ATCA_DATA_ZONE_LOCKED:
72-
case ATCA_NOT_LOCKED:
73-
case ATCA_WAKE_FAILED:
74-
case ATCA_STATUS_UNKNOWN:
75-
case ATCA_STATUS_ECC:
76-
case ATCA_STATUS_SELFTEST_ERROR:
77-
case ATCA_CHECKMAC_VERIFY_FAILED:
78-
case ATCA_PARSE_ERROR:
79-
case ATCA_FUNC_FAIL:
80-
case ATCA_GEN_FAIL:
81-
case ATCA_EXECUTION_ERROR:
82-
case ATCA_HEALTH_TEST_ERROR:
83-
case ATCA_INVALID_SIZE:
84-
default:
85-
return PSA_ERROR_HARDWARE_FAILURE;
86-
}
87-
}
88-
8926
psa_status_t atecc608a_get_serial_number(uint8_t* buffer,
9027
size_t buffer_size,
9128
size_t *buffer_length)

atecc608a_utils.h

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,8 @@
2323
#ifndef ATECC608A_UTILS_H
2424
#define ATECC608A_UTILS_H
2525

26-
#include "atca_iface.h"
2726
#include "psa/crypto.h"
28-
29-
#define ATCAB_INIT() \
30-
do \
31-
{ \
32-
if (atcab_init(&atca_iface_config) != ATCA_SUCCESS) \
33-
{ \
34-
status = PSA_ERROR_HARDWARE_FAILURE; \
35-
goto exit; \
36-
} \
37-
} while(0)
38-
39-
/** `atcab_release()` might return `ATCA_BAD_PARAM` if there is no global device
40-
* initialized via `atcab_init()`. HAL might return an error if an i2c device
41-
* cannot be released, but in current implementations it always returns
42-
* `ATCA_SUCCESS` - therefore we are ignoring the return code. */
43-
#define ATCAB_DEINIT() \
44-
do \
45-
{ \
46-
atcab_release(); \
47-
} while(0)
27+
#include "atecc608a_se.h"
4828

4929
/** This macro checks if the result of an `expression` is equal to an
5030
* `expected` value and sets a `status` variable of type `psa_status_t` to
@@ -75,12 +55,9 @@
7555
* the PSA return code - PSA_SUCCESS.*/
7656
#define ASSERT_SUCCESS_PSA(expression) ASSERT_STATUS(expression, PSA_SUCCESS, \
7757
ASSERT_result)
78-
58+
7959
psa_status_t atecc608a_get_serial_number(uint8_t* buffer, size_t buffer_size,
8060
size_t *buffer_length);
8161
psa_status_t atecc608a_check_config_locked();
82-
psa_status_t atecc608a_to_psa_error(ATCA_STATUS ret);
83-
84-
extern ATCAIfaceCfg atca_iface_config;
8562

8663
#endif /* ATECC608A_SE_H */

0 commit comments

Comments
 (0)