Skip to content

Commit

Permalink
Merge branch 'feature/add_cryptoauthlib_support_for_c6' into 'master'
Browse files Browse the repository at this point in the history
support esp32c6 target in esp_cryptoauthlib

Closes IDFGH-13380

See merge request espressif/esp-cryptoauthlib!34
  • Loading branch information
mahavirj committed Aug 14, 2024
2 parents c822273 + 7cafbc1 commit a4138da
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 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).
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, ESP32C3 and ESP32C6. 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.
* [ESP-IDF](https://github.com/espressif/esp-idf) version should be `release/v5.0` or newer.
* Environment variable `IDF_PATH` should be set

## How to use esp-cryptoauthlib with ESP-IDF
Expand Down
19 changes: 18 additions & 1 deletion cryptoauthlib/third_party/hal/esp32/hal_esp32_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <soc/soc_caps.h>
#include "esp_err.h"
#include "esp_log.h"
#include "esp_idf_version.h"

#include "cryptoauthlib.h"

Expand All @@ -36,6 +37,22 @@

#define MAX_I2C_BUSES SOC_I2C_NUM //ESP32 has 2 I2C bus

#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)

#if SOC_HP_I2C_NUM >= 2
#define I2C_PORT_2 I2C_NUM_1
#elif SOC_LP_I2C_NUM >= 1
#define I2C_PORT_2 LP_I2C_NUM_0
#endif // SOC_HP_I2C_NUM >= 2

#else // ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)

#if SOC_I2C_NUM >= 2
#define I2C_PORT_2 I2C_NUM_1
#endif // SOC_I2C_NUM >= 2

#endif // !ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)

typedef struct atcaI2Cmaster
{
int id;
Expand Down Expand Up @@ -112,7 +129,7 @@ ATCA_STATUS hal_i2c_init(ATCAIface iface, ATCAIfaceCfg *cfg)
break;
case 1:
#if SOC_I2C_NUM >= 2
i2c_hal_data[bus].id = I2C_NUM_1;
i2c_hal_data[bus].id = I2C_PORT_2;
#endif
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions esp_cryptoauth_utility/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# ESP_CRYPTOAUTH_UTILITY

# Description
The python utility helps to configure and provision [ATECC608A](https://www.microchip.com/en-us/product/atecc608a)/[ATECC608B](https://www.microchip.com/en-us/product/atecc608b) chip connected to an ESP module. Currently the utility is supported for ESP32, ESP32S3 and ESP32C3.
The python utility helps to configure and provision [ATECC608A](https://www.microchip.com/en-us/product/atecc608a)/[ATECC608B](https://www.microchip.com/en-us/product/atecc608b) chip connected to an ESP module. Currently the utility is supported for ESP32, ESP32S3, ESP32C3 and ESP32C6.

There are currently three types of ATECC608 which are [Trust & Go](https://www.microchip.com/wwwproducts/en/ATECC608A-TNGTLS), [TrustFlex](https://www.microchip.com/wwwproducts/en/ATECC608A-TFLXTLS) and [TrustCustom](https://www.microchip.com/wwwproducts/en/ATECC608A). `Trust & Go` and `TrustFlex` chips are preconfigured by the manufacturer (Microchip) so we only need to generate manifest file for those chips. `TrustCustom` type of chips are not configured, so for `TrustCustom` type of chips need to be first configured and then provisioned with a newly generated device certificate and key pair. The script automatically detects which type of ATECC608 chip is connected to the ESP module so it will proceed to the next required step on its own.

# Hardware Required

* One ESP32, ESP32S3 or ESP32C3 module.
* One ESP32, ESP32S3, ESP32C3 or ESP32C6 module.
* An [ATECC608A](https://www.microchip.com/en-us/product/atecc608a)/[ATECC608B](https://www.microchip.com/en-us/product/atecc608b) connected with the ESP module using I2C interface.

## Installation
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion esp_cryptoauth_utility/secure_cert_mfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import sample_bins
import sample_certs

supported_targets = {'esp32', 'esp32s2', 'esp32s3', 'esp32c3'}
supported_targets = {'esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp32c6'}
try:
import esptool
except ImportError: # cheat and use IDF's copy of esptool if available
Expand Down
4 changes: 2 additions & 2 deletions esp_cryptoauth_utility/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def get_install_requires():
)
exit(1)

VERSION = '0.11.2'
VERSION = '0.12.0'

long_description = """
======================
esp-cryptoauth-utility
======================
The python utility helps to configure and provision ATECC608 chip connected to an ESP module. Currently the utility is supported for ESP32, ESP32S3, ESP32C3.
The python utility helps to configure and provision ATECC608 chip connected to an ESP module. Currently the utility is supported for ESP32, ESP32S3, ESP32C3 and ESP32C6.
The esp-cryptoauth-utility is `hosted on github <https://github.com/espressif/esp-cryptoauthlib/tree/master/esp_cryptoauth_utility>`_.
Expand Down
4 changes: 2 additions & 2 deletions examples/atecc608_ecdsa/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
| Supported Targets | ESP32 | ESP32-S3 | ESP32-C3 |
| ----------------- | ----- | -------- | -------- |
| Supported Targets | ESP32 | ESP32-S3 | ESP32-C3 | ESP32-C6 |
| ----------------- | ----- | -------- | -------- | -------- |

# ECDSA sign/verify Example with ESP32 series SoC interfaced with ATECC608A

Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "3.5.1~5"
version: "3.5.1~6"
description: "esp-cryptoauthlib: The port of Microchip CryptoAuthentication Library for ESP-IDF"
url: https://github.com/espressif/esp-cryptoauthlib
dependencies:
Expand Down

0 comments on commit a4138da

Please sign in to comment.