@@ -14,11 +14,11 @@ This package provides support for the official library for Microchip CryptoAuth
1414
1515## Usage
1616
17- Add
18- @code
17+ Add the following to your makefile:
18+
19+ ``` makefile
1920USEPKG += cryptoauthlib
20- @endcode
21- to your Makefile.
21+ ```
2222
2323### Shell
2424
@@ -66,7 +66,7 @@ ATECCX08A device parameters are configured in
6666There you can specify your device's address, the I2C bus to use and more by
6767defining ` ATCA_PARAMS ` . Per default one device is defined in RIOT (example shown below).
6868
69- @ code
69+ ``` c
7070#define ATCA_PARAM_I2C (I2C_DEV(0))
7171#define ATCA_PARAM_ADDR (ATCA_I2C_ADDR)
7272#define ATCA_RX_RETRIES (20)
@@ -79,14 +79,15 @@ defining `ATCA_PARAMS`. Per default one device is defined in RIOT (example shown
7979 .atcai2c.baud = -1 , \
8080 .wake_delay = 1500 , \
8181 .rx_retries = ATCA_RX_RETRIES }
82- @ endcode
82+ ```
8383
8484If you want to use more than one device, the best way is to create a file called
8585` custom_atca_params.h ` in your application folder (you can see an example of this in
8686` examples/advanced/psa_crypto ` ).
8787
8888In your custom file you can now add a second device to ` ATCA_PARAMS ` :
89- @code
89+
90+ ``` c
9091#define ATCA_PARAM_I2C_DEV0 (I2C_DEV(0))
9192#define ATCA_PARAM_ADDR_DEV0 (ATCA_I2C_ADDR_DEV0)
9293#define ATCA_RX_RETRIES_DEV0 (20)
@@ -111,13 +112,14 @@ In your custom file you can now add a second device to `ATCA_PARAMS`:
111112 .atcai2c.baud = -1, \
112113 .wake_delay = 1500, \
113114 .rx_retries = ATCA_RX_RETRIES }
114- @ endcode
115+ ```
115116
116117Now you just need to add the following to your Makefile:
117- @code
118+
119+ ```Makefile
118120CFLAGS += -DCUSTOM_ATCA_PARAMS
119121INCLUDES += -I$(APPDIR)
120- @ endcode
122+ ```
121123
122124This way your custom params file is included in the build process and both your
123125devices will be initialized by the ` auto_init ` module.
@@ -127,10 +129,10 @@ allows you to pass a device handle. Pointers to all initialized devices are stor
127129in the ` atca_devs_ptr ` array, which is included in ` atca_params.h ` .
128130Include ` atca_params.h ` in your source file and pass the device handle as shown below.
129131
130- @ code {.c}
132+ ``` c
131133ATCADevice dev = atca_devs_ptr[0 ];
132134calib_sha_start (dev);
133- @ endcode
135+ ```
134136
135137## Using Cryptoauthlib as a backend for PSA Crypto {#psa-cryptoauthlib}
136138
@@ -145,7 +147,8 @@ location value. The primary device can get the value
145147@ref PSA_KEY_LOCATION_SE_MIN and @ref PSA_KEY_LOCATION_SE_MAX.
146148
147149Your structure should now look like this:
148- @code
150+
151+ ```c
149152#define PSA_ATCA_LOCATION (PSA_KEY_LOCATION_PRIMARY_SECURE_ELEMENT)
150153#define ATCA_PARAM_I2C (I2C_DEV(0))
151154#define ATCA_PARAM_ADDR (ATCA_I2C_ADDR)
@@ -162,7 +165,7 @@ Your structure should now look like this:
162165 .wake_delay = 1500, \
163166 .rx_retries = ATCA_RX_RETRIES } \
164167 }
165- @ endcode
168+ ```
166169
167170When using multiple SEs, just add more device parameters as shown in section
168171[ Using Multiple ATECCX08A Devices] ( #multi-ateccx08a ) .
@@ -188,19 +191,20 @@ For this you need to initialize a list of key slot configuration structures, wit
188191for each slot.
189192
190193For these devices the structure looks like this:
191- @code {.c}
194+
195+ ``` c
192196typedef struct {
193197 psa_key_type_t key_type_allowed; // Declare the key type allowed in this slot
194198 uint8_t key_persistent; // Ignore for now, PSA does not yet support persistent keys
195199 uint8_t slot_occupied; // Set to 0, PSA will set this to one after writing a key
196200} psa_atca_slot_config_t ;
197- @ endcode
201+ ```
198202
199203To make your configurations known to PSA, simply add the following to your ` custom_atca_params.h `
200204file (these values are only an example, of course you need to modify them according to
201205your needs).
202206
203- @ code {.c}
207+ ``` c
204208#define ATCA_SLOTS_DEV0 { { PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1), 0, 0 }, \
205209 { PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1), 0, 0 }, \
206210 { PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1), 0, 0 }, \
@@ -219,17 +223,17 @@ your needs).
219223 { 0, 0, 0 }}
220224
221225#define ATCA_CONFIG_LIST { ATCA_SLOTS_DEV0 }
222- @ endcode
226+ ```
223227
224228To use multiple devices, define ` ATCA_SLOTS_DEV0 ` - ` ATCA_SLOTS_DEVX ` and add them to
225229` ATCA_CONFIG_LIST ` like so:
226230
227- @ code {.c}
231+ ``` c
228232#define ATCA_CONFIG_LIST { ATCA_SLOTS_DEV0 }, \
229233 { ATCA_SLOTS_DEV1 }, \
230234 ... \
231235 { ATCA_SLOTS_DEVX }
232- @ endcode
236+ ```
233237
234238A usage example for this can be found in `examples/advanced/psa_crypto`.
235239
0 commit comments