forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cryptoauthlib as a component with mbedtls integration
* Add options to mbedtls for hardware acceleration * Disable mbedtls EC curves if hardware acceleration is selected since the hardware will have to define the curves supported * Add a hardware ecdsa example
- Loading branch information
1 parent
7099c2b
commit 4553f6c
Showing
12 changed files
with
427 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
menu "Cryptoauthlib" | ||
|
||
config ATCA_MBEDTLS_ECDH | ||
bool "Enable Hardware ECDH with ATECC608A" | ||
depends on MBEDTLS_ECDH_C | ||
select MBEDTLS_HARDWARE_ECDH | ||
select MBEDTLS_ECP_DP_SECP256R1_ENABLED | ||
help | ||
Enable hardware ECDH operations on an ATECC608A device | ||
|
||
config ATCA_MBEDTLS_ECDSA | ||
bool "Enable Hardware ECDSA keys for mbedTLS" | ||
depends on MBEDTLS_ECDSA_C | ||
help | ||
Enable Hardware ECDSA | ||
|
||
config ATCA_MBEDTLS_ECDSA_SIGN | ||
bool "Enable ATECC608A sign operations in mbedTLS" | ||
depends on ATCA_MBEDTLS_ECDSA | ||
select MBEDTLS_HARDWARE_ECDSA_SIGN | ||
select MBEDTLS_ECP_DP_SECP256R1_ENABLED | ||
|
||
config ATCA_MBEDTLS_ECDSA_VERIFY | ||
bool "Enable ATECC608A verify operations in mbedTLS" | ||
depends on ATCA_MBEDTLS_ECDSA | ||
select MBEDTLS_HARDWARE_ECDSA_VERIFY | ||
select MBEDTLS_ECP_DP_SECP256R1_ENABLED | ||
|
||
endmenu # cryptoauthlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
# Component Makefile | ||
# | ||
COMPONENT_SUBMODULES += cryptoauthlib | ||
|
||
CRYPTOAUTHLIB_DIR := cryptoauthlib/lib | ||
|
||
COMPONENT_SRCDIRS := $(CRYPTOAUTHLIB_DIR)/atcacert \ | ||
$(CRYPTOAUTHLIB_DIR)/basic \ | ||
$(CRYPTOAUTHLIB_DIR)/crypto \ | ||
$(CRYPTOAUTHLIB_DIR)/crypto/hashes \ | ||
$(CRYPTOAUTHLIB_DIR)/host \ | ||
$(CRYPTOAUTHLIB_DIR)/mbedtls \ | ||
$(CRYPTOAUTHLIB_DIR) \ | ||
port | ||
|
||
COMPONENT_OBJS := $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.c,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.c))) \ | ||
$(CRYPTOAUTHLIB_DIR)/hal/atca_hal.o \ | ||
$(CRYPTOAUTHLIB_DIR)/hal/hal_freertos.o \ | ||
$(CRYPTOAUTHLIB_DIR)/hal/hal_esp32_i2c.o \ | ||
$(CRYPTOAUTHLIB_DIR)/hal/hal_esp32_timer.o | ||
|
||
# Make relative by removing COMPONENT_PATH from all found object paths | ||
COMPONENT_OBJS := $(patsubst $(COMPONENT_PATH)/%,%,$(COMPONENT_OBJS)) | ||
|
||
# Don't include the default interface configurations from cryptoauthlib | ||
COMPONENT_OBJEXCLUDE := $(CRYPTOAUTHLIB_DIR)/atca_cfgs.o | ||
|
||
# Add the hal directory back in for source search paths | ||
COMPONENT_SRCDIRS += $(CRYPTOAUTHLIB_DIR)/hal | ||
|
||
COMPONENT_ADD_INCLUDEDIRS := $(CRYPTOAUTHLIB_DIR) $(CRYPTOAUTHLIB_DIR)/hal | ||
|
||
# Library requires some global defines | ||
CFLAGS+=-DESP32 -DATCA_HAL_I2C -DATCA_USE_RTOS_TIMER | ||
|
||
$(CRYPTOAUTHLIB_DIR)/hal/hal_freertos.o: CFLAGS+= -I$(IDF_PATH)/components/freertos/include/freertos | ||
|
||
# Turn off some warnings for some files that have been checked | ||
$(CRYPTOAUTHLIB_DIR)/hal/hal_esp32_i2c.o: CFLAGS+= -Wno-unused-but-set-variable -Wno-unused-variable | ||
$(CRYPTOAUTHLIB_DIR)/basic/atca_helpers.o: CFLAGS+= -Wno-type-limits |
Submodule cryptoauthlib
added at
3bc5e2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** | ||
* \file | ||
* \brief a set of default configurations for various ATCA devices and interfaces | ||
* | ||
* \copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries. | ||
* | ||
* \page License | ||
* | ||
* Subject to your compliance with these terms, you may use Microchip software | ||
* and any derivatives exclusively with Microchip products. It is your | ||
* responsibility to comply with third party license terms applicable to your | ||
* use of third party software (including open source software) that may | ||
* accompany Microchip software. | ||
* | ||
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER | ||
* EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED | ||
* WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A | ||
* PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, | ||
* SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE | ||
* OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF | ||
* MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE | ||
* FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL | ||
* LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED | ||
* THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR | ||
* THIS SOFTWARE. | ||
*/ | ||
|
||
#include <stddef.h> | ||
#include "atca_cfgs.h" | ||
#include "atca_iface.h" | ||
#include "atca_device.h" | ||
|
||
/** \defgroup config Configuration (cfg_) | ||
* \brief Logical device configurations describe the CryptoAuth device type and logical interface. | ||
@{ */ | ||
|
||
/* if the number of these configurations grows large, we can #ifdef them based on required device support */ | ||
|
||
/** \brief default configuration for an ECCx08A device */ | ||
ATCAIfaceCfg cfg_ateccx08a_i2c_default = { | ||
.iface_type = ATCA_I2C_IFACE, | ||
.devtype = ATECC608A, | ||
.atcai2c.slave_address = 0xC0, | ||
.atcai2c.bus = 0, | ||
.atcai2c.baud = 100000, | ||
.wake_delay = 1500, | ||
.rx_retries = 20 | ||
}; | ||
|
||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# The following lines of boilerplate have to be in your project's CMakeLists | ||
# in this exact order for cmake to work correctly | ||
cmake_minimum_required(VERSION 3.5) | ||
|
||
include($ENV{IDF_PATH}/tools/cmake/project.cmake) | ||
project(atecc608a_ecdsa) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# This is a project Makefile. It is assumed the directory this Makefile resides in is a | ||
# project subdirectory. | ||
# | ||
|
||
PROJECT_NAME := atecc608a_ecdsa | ||
|
||
include $(IDF_PATH)/make/project.mk | ||
|
5 changes: 5 additions & 0 deletions
5
examples/peripherals/security/atecc608_ecdsa/main/component.mk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# | ||
# "main" pseudo-component makefile. | ||
# | ||
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) | ||
|
Oops, something went wrong.