|
| 1 | +Cryptoauthlib Test Application |
| 2 | +=============================================================================== |
| 3 | + |
| 4 | +The test application for cryptoauthlib provides tests and utilities for the |
| 5 | +library and connected devices. It can be built and used both as an interactive |
| 6 | +application or by individual command lines. |
| 7 | + |
| 8 | +Platforms supported by CMake |
| 9 | +------------------------------------------------------------------------------- |
| 10 | +The test application can be configured for the following platforms by invoking |
| 11 | +CMake: |
| 12 | + |
| 13 | +* Windows |
| 14 | +* Linux |
| 15 | +* MacOs |
| 16 | +* Zephyr |
| 17 | + |
| 18 | +Enable the BUILD_TESTS option either in your CMakeLists.txt file that includes |
| 19 | +cryptoauthlib or otherwise on the command line when you invoke CMake |
| 20 | + |
| 21 | +Embedded Platforms |
| 22 | +------------------------------------------------------------------------------- |
| 23 | +The test application can also be added and configured if you use the following |
| 24 | +software platforms: |
| 25 | + |
| 26 | +### Harmony 3 |
| 27 | + |
| 28 | +Add the cryptoauthlib test application component to the component graph. The |
| 29 | +test application depends on stdio being available so you also need to include |
| 30 | +the stdio component which you will connect to an available uart. |
| 31 | + |
| 32 | + |
| 33 | +Invoking the test application |
| 34 | +------------------------------------------------------------------------------- |
| 35 | + |
| 36 | +The test application can be run both as a command line application as well as |
| 37 | +interactively. The default mode is interactive. |
| 38 | + |
| 39 | +### Embedded |
| 40 | + |
| 41 | +#### Interactive |
| 42 | +The function `atca_test_task` is a non returning function that waits for |
| 43 | +characters from a stdin implementation. If the system supports scanf this can |
| 44 | +be used to create a test application rtos task - if there are no parallel tasks |
| 45 | +to be executed in the system then one can forgo an RTOS and simply call this |
| 46 | +function from the main function after board initialization is complete |
| 47 | + |
| 48 | +#### Either interactive or "command line" using a custom runner |
| 49 | +Alternatively the function `processCmd` will accept a buffer for parsing and |
| 50 | +execution. The buffer has to be a complete command however so ensure that the |
| 51 | +calling code properly accumulates all need characters into the buffer first |
| 52 | + |
| 53 | +### Platforms with a shell |
| 54 | + |
| 55 | +#### Interactive |
| 56 | + |
| 57 | +Launch the `cryptoauth_test` application from the build directory |
| 58 | + |
| 59 | +#### Command line |
| 60 | + |
| 61 | +Launch the `cryptoauth_test` application with command line arguments |
| 62 | + |
| 63 | +``` |
| 64 | +build> ./cryptoauth_test <command> -d <device> -i <interface> [<interface options>] |
| 65 | +``` |
| 66 | + |
| 67 | +For example to retrieve the device serial number from a [Cryptoauth Trust Platform Development Kit](https://www.microchip.com/en-us/development-tool/DM320118) |
| 68 | + |
| 69 | +``` |
| 70 | +./cryptoauth_test sernum -d ecc608 -i hid i2c -a 0x6C |
| 71 | +``` |
| 72 | + |
| 73 | +Commands |
| 74 | +------------------------------------------------------------------------------- |
| 75 | + |
| 76 | +### Device Selection |
| 77 | +* sha204 - Select ATSHA204/A |
| 78 | +* sha206 - Select ATSHA206A |
| 79 | +* ecc108 - Select ATECC108A |
| 80 | +* ecc204 - Select ECC204 |
| 81 | +* ecc508 - Select ATECC508A |
| 82 | +* ecc608 - Select ATECC608A/B |
| 83 | +* ta100 - Select TA100 |
| 84 | + |
| 85 | +### Utilities |
| 86 | +* info - Read the device revision data |
| 87 | +* sernum - Read the device serial number |
| 88 | +* readcfg - Read the configuration memory |
| 89 | +* lockstat - Read the lock status for each memory region |
| 90 | +* rand - Generate 32 bytes of random data from the device's RNG by executing |
| 91 | + atcab_random (many devices return a constant value if the configuration is |
| 92 | + not 'locked') |
| 93 | +* lockcfg - Sets the device configuration lock by executing atcab_lock_config_zone |
| 94 | +* lockdata - Sets the device data/setup lock by executing atcab_lock_data_zone |
| 95 | + |
| 96 | +### Software API Testing |
| 97 | +* cd - Run the compressed certificate library (atcacert_) unit tests |
| 98 | +* util - Run utility unit tests |
| 99 | + |
| 100 | +### Device API Testing |
| 101 | +* basic - Run (atcab_) API validation tests |
| 102 | +* cio - Run compressed certificate library (atcacert_) device integration tests |
| 103 | + |
| 104 | +### Cryptographic Library |
| 105 | +* crypto - Run software library API tests (validate host cryptographic functions) |
| 106 | +* crypto_int - Run device integration tests for supported libraries |
| 107 | +* pbkdf2 - Run pbkdf2 algorithm tests (host and device) |
| 108 | + |
| 109 | +### ECC608 Specific Commands |
| 110 | +* clkdivm0 - Sets the ECC608 clock divider to 0x00 |
| 111 | +* clkdivm1 - Sets the ECC608 clock divider to 0x05 |
| 112 | +* clkdivm2 - Sets the ECC608 clock divider to 0x0D |
| 113 | + |
| 114 | +### TA100 Specific Commands |
| 115 | +* handles - Prints the ta100 handle information for all created handles |
| 116 | +* talib - Run (talib_) API validation tests |
| 117 | + |
| 118 | + |
| 119 | +Options |
| 120 | +------------------------------------------------------------------------------- |
| 121 | + |
| 122 | +### -i (Device) |
| 123 | + |
| 124 | +Usage: `-i <device_type>` |
| 125 | + |
| 126 | +Selects the device type - per the device list that you would otherwise see when |
| 127 | +invoking `help` from the menu. Possible options if the corresponding `ATCA_<device>_SUPPORT` |
| 128 | +macro is enabled: |
| 129 | + |
| 130 | +* sha204 |
| 131 | +* sha206 |
| 132 | +* ecc108 |
| 133 | +* ecc204 |
| 134 | +* ecc508 |
| 135 | +* ecc608 |
| 136 | +* ta100 |
| 137 | + |
| 138 | + |
| 139 | +### -i (Interface) |
| 140 | + |
| 141 | +Usage: `-i <interface_type> <interface parameters>` |
| 142 | + |
| 143 | +Selects the interface type that will be used to communicate with the device. |
| 144 | +Additional parameters can be used to alter the defaults for the interface |
| 145 | + |
| 146 | +* hid <i2c/swi/spi> <i2c_bus_id> |
| 147 | +* i2c <i2c_bus_id> |
| 148 | +* spi <spi_bus_id> <select_pin> <baud_rate> |
| 149 | +* uart <uart_port> <uart_baud> <uart_wordsize> <uart_stopbits> <uart_parity> |
| 150 | + |
| 151 | +Notes: |
| 152 | +* Uart port is an integer on windows platforms (specify 11 for COM11) and a |
| 153 | + string on linux/macos platforms (e.g. "/dev/ttyACM0") |
| 154 | + |
| 155 | +### -a (Address) |
| 156 | + |
| 157 | +Usage: `-a <device_address>` |
| 158 | + |
| 159 | +### -y (Quiet) |
| 160 | + |
| 161 | +Usage: `-y` |
| 162 | + |
| 163 | +Silence prompts with an implicit agreement |
0 commit comments