# ESP-CRYPTOAUTHLIB This is a port of Microchip's [cryptoauthlib](https://github.com/MicrochipTech/cryptoauthlib) for ESP-IDF. It contains necessary build support to use cryptoauthlib with ESP-IDF as well as `esp_cryptoauthlib_utility` for configuring and provisiong ATECC608A chip connected to an ESP module. Currently the utility is supported for ESP32, ESP32S3 and ESP32C3. The cryptoauthlib folder which is a subset of Microchip's [cryptoauthlib](https://github.com/MicrochipTech/cryptoauthlib) is created with help of script [generate_component.sh](https://github.com/espressif/esp-cryptoauthlib/blob/master/generate_component.sh). ## Requirements * [ESP-IDF](https://github.com/espressif/esp-idf) version should be `release/v4.3` or newer. * Environment variable `IDF_PATH` should be set ## How to use esp-cryptoauthlib with ESP-IDF --- There are two ways to use `esp-cryptoauthlib` in your project 1) Directly add `esp-cryptoauthlib` as a component in your project with following three commands. (First change directory (cd) to your project directory) ``` mkdir components cd components git clone https://github.com/espressif/esp-cryptoauthlib.git ``` 2) Add `esp-cryptoauthlib` as an extra component in your project. * Download `esp-cryptoauthlib` with: ``` git clone https://github.com/espressif/esp-cryptoauthlib.git ``` * Include `esp-cryptoauthlib` in `ESP-IDF` with setting `EXTRA_COMPONENT_DIRS` in CMakeLists.txt/Makefile of your project.For reference see [Optional Project Variables](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/build-system.html#optional-project-variables) ## How to configure and provision ATECC608 The python utilty `esp_cryptoauth_utility` helps to configure, generate resources as well as provision ATECC608A chip connected to an ESP module. For detailed instructions on how to use the utility please refer utility [README.md](https://github.com/espressif/esp-cryptoauthlib/blob/master/esp_cryptoauth_utility/README.md)
| Supported Targets | ESP32 | ESP32-S3 | ESP32-C3 | | ----------------- | ----- | -------- | -------- | # ECDSA sign/verify Example with ESP32 series SoC interfaced with ATECC608A ## Description (See the README.md file in the upper level 'examples' directory for more information about examples.) This example requires ESP32 platform interfaced with Microchip's [ATECC608A](https://www.microchip.com/wwwproducts/en/ATECC608A) Secure Element. For making the hardware connections with `ATECC608A` chip (Secure Element), please refer [this](https://github.com/espressif/esp-cryptoauthlib/blob/master/esp_cryptoauth_utility/README.md#using-atecc608a-with-esp32-wroom-32) for details. The example performs `ECDSA sign/verify` functions on sample data using hardware private key stored in ATECC608A chip. ## How to use example Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`. ### Hardware Required * A development board with ESP32 series based SoC * `ATECC608A` IC based external module or dev. board. * A USB cable for Power supply and programming ### Configure the project Hardware should be configured to run the example, for details on configuration of ATECC608A chip, please refer [esp_cryptoauth_utility](https://github.com/espressif/esp-cryptoauthlib/blob/master/esp_cryptoauth_utility/README.md#esp_cryptoauth_utility) Open the project configuration menu (`idf.py menuconfig`). In the `Component config -> esp-cryptoauthlib` menu: * Use `Choose the type of ATECC608A chip` to set the Crypto IC type [1]. * Use `Enable Hardware ECDSA keys for mbedTLS` Enable Hardware ECDSA. * Set `Enable ATECC608A sign operations in mbedTLS` to use Hardware ECDSA sign. * Set `Enable ATECC608A verify operations in mbedTLS` to use Hardware ECDSA verify. * Set `I2C SDA pin used to communicate with the ATECC608A`. * Set `I2C SCL pin used to communicate with the ATECC608A`. [1]: for more details refer [Find ATECC608A chip type](https://github.com/espressif/esp-cryptoauthlib/blob/master/esp_cryptoauth_utility/README.md). ### Build and Flash Build the project and flash it to the board, then run the monitor tool to view the serial output: Run `idf.py -p PORT flash monitor` to build, flash and monitor the project. (To exit the serial monitor, type ``Ctrl-]``.) See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for all the steps to configure and use the ESP-IDF to build projects. ## Troubleshooting For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
idf.py add-dependency "espressif/esp-cryptoauthlib^3.5.1~3"
To create a project from this example, run:
idf.py create-project-from-example "espressif/esp-cryptoauthlib^3.5.1~3:atecc608_ecdsa"