change(bt): moved porting/ext/tinycrypt into common

This commit is contained in:
Shen Weilong
2025-03-04 15:23:22 +08:00
parent f9cbfdd0f5
commit 6678e68cdb
37 changed files with 184 additions and 40 deletions

View File

@@ -637,23 +637,23 @@ if(CONFIG_BT_ENABLED)
if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS)) if(NOT (CONFIG_BT_LE_CRYPTO_STACK_MBEDTLS OR CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS))
list(APPEND include_dirs list(APPEND include_dirs
porting/ext/tinycrypt/include common/tinycrypt/include
) )
list(APPEND srcs "porting/ext/tinycrypt/src/utils.c" list(APPEND srcs "common/tinycrypt/src/utils.c"
"porting/ext/tinycrypt/src/sha256.c" "common/tinycrypt/src/sha256.c"
"porting/ext/tinycrypt/src/ecc.c" "common/tinycrypt/src/ecc.c"
"porting/ext/tinycrypt/src/ctr_prng.c" "common/tinycrypt/src/ctr_prng.c"
"porting/ext/tinycrypt/src/ctr_mode.c" "common/tinycrypt/src/ctr_mode.c"
"porting/ext/tinycrypt/src/aes_decrypt.c" "common/tinycrypt/src/aes_decrypt.c"
"porting/ext/tinycrypt/src/aes_encrypt.c" "common/tinycrypt/src/aes_encrypt.c"
"porting/ext/tinycrypt/src/ccm_mode.c" "common/tinycrypt/src/ccm_mode.c"
"porting/ext/tinycrypt/src/ecc_dsa.c" "common/tinycrypt/src/ecc_dsa.c"
"porting/ext/tinycrypt/src/cmac_mode.c" "common/tinycrypt/src/cmac_mode.c"
"porting/ext/tinycrypt/src/ecc_dh.c" "common/tinycrypt/src/ecc_dh.c"
"porting/ext/tinycrypt/src/hmac_prng.c" "common/tinycrypt/src/hmac_prng.c"
"porting/ext/tinycrypt/src/ecc_platform_specific.c" "common/tinycrypt/src/ecc_platform_specific.c"
"porting/ext/tinycrypt/src/hmac.c" "common/tinycrypt/src/hmac.c"
"porting/ext/tinycrypt/src/cbc_mode.c") "common/tinycrypt/src/cbc_mode.c")
endif() endif()
if(CONFIG_BT_NIMBLE_ENABLED) if(CONFIG_BT_NIMBLE_ENABLED)

View File

@@ -1,4 +1,8 @@
/* aes.h - TinyCrypt interface to an AES-128 implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* cbc_mode.h - TinyCrypt interface to a CBC mode implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ccm_mode.h - TinyCrypt interface to a CCM mode implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* cmac_mode.h -- interface to a CMAC implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved * Copyright (C) 2017 by Intel Corporation, All Rights Reserved

View File

@@ -1,4 +1,8 @@
/* constants.h - TinyCrypt interface to constants */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ctr_mode.h - TinyCrypt interface to CTR mode */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ctr_prng.h - TinyCrypt interface to a CTR-PRNG implementation */ /* ctr_prng.h - TinyCrypt interface to a CTR-PRNG implementation */
/* /*

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ecc.h - TinyCrypt interface to common ECC functions */ /* ecc.h - TinyCrypt interface to common ECC functions */
/* Copyright (c) 2014, Kenneth MacKay /* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* ecc_dh.h - TinyCrypt interface to EC-DH implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (c) 2014, Kenneth MacKay * Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ecc_dh.h - TinyCrypt interface to EC-DSA implementation */ /* ecc_dh.h - TinyCrypt interface to EC-DSA implementation */
/* /*

View File

@@ -1,4 +1,8 @@
/* uECC_platform_specific.h - Interface to platform specific functions*/ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copyright (c) 2014, Kenneth MacKay /* Copyright (c) 2014, Kenneth MacKay
* All rights reserved. * All rights reserved.

View File

@@ -1,4 +1,8 @@
/* hmac.h - TinyCrypt interface to an HMAC implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -124,7 +128,7 @@ int tc_hmac_update(TCHmacState_t ctx, const void *data,
* key == NULL or * key == NULL or
* taglen != TC_SHA256_DIGEST_SIZE * taglen != TC_SHA256_DIGEST_SIZE
* @note ctx is erased before exiting. This should never be changed/removed. * @note ctx is erased before exiting. This should never be changed/removed.
* @note Assumes the tag bufer is at least sizeof(hmac_tag_size(state)) bytes * @note Assumes the tag buffer is at least sizeof(hmac_tag_size(state)) bytes
* state has been initialized by tc_hmac_init * state has been initialized by tc_hmac_init
* @param tag IN/OUT -- buffer to receive computed HMAC tag * @param tag IN/OUT -- buffer to receive computed HMAC tag
* @param taglen IN -- size of tag in bytes * @param taglen IN -- size of tag in bytes

View File

@@ -1,4 +1,8 @@
/* hmac_prng.h - TinyCrypt interface to an HMAC-PRNG implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* sha256.h - TinyCrypt interface to a SHA-256 implementation */ /* sha256.h - TinyCrypt interface to a SHA-256 implementation */
/* /*

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* utils.h - TinyCrypt interface to platform-dependent run-time operations */ /* utils.h - TinyCrypt interface to platform-dependent run-time operations */
/* /*

View File

@@ -1,4 +1,8 @@
/* aes_decrypt.c - TinyCrypt implementation of AES decryption procedure */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* aes_decrypt.c - TinyCrypt implementation of AES decryption procedure */
#include <tinycrypt/aes.h> #include <tinycrypt/aes.h>
#include <tinycrypt/constants.h> #include <tinycrypt/constants.h>
#include <tinycrypt/utils.h> #include <tinycrypt/utils.h>

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* aes_encrypt.c - TinyCrypt implementation of AES encryption procedure */ /* aes_encrypt.c - TinyCrypt implementation of AES encryption procedure */
/* /*

View File

@@ -1,4 +1,8 @@
/* cbc_mode.c - TinyCrypt implementation of CBC mode encryption & decryption */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* ccm_mode.c - TinyCrypt implementation of CCM mode */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* ccm_mode.c - TinyCrypt implementation of CCM mode */
#include <tinycrypt/ccm_mode.h> #include <tinycrypt/ccm_mode.h>
#include <tinycrypt/constants.h> #include <tinycrypt/constants.h>
#include <tinycrypt/utils.h> #include <tinycrypt/utils.h>

View File

@@ -1,4 +1,8 @@
/* cmac_mode.c - TinyCrypt CMAC mode implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* ctr_mode.c - TinyCrypt CTR mode implementation */ /* ctr_mode.c - TinyCrypt CTR mode implementation */
/* /*

View File

@@ -1,4 +1,8 @@
/* ctr_prng.c - TinyCrypt implementation of CTR-PRNG */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (c) 2016, Chris Morrison * Copyright (c) 2016, Chris Morrison

View File

@@ -1,4 +1,8 @@
/* ecc.c - TinyCrypt implementation of common ECC functions */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (c) 2014, Kenneth MacKay * Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* ec_dh.c - TinyCrypt implementation of EC-DH */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (c) 2014, Kenneth MacKay * Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* ec_dsa.c - TinyCrypt implementation of EC-DSA */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Copyright (c) 2014, Kenneth MacKay /* Copyright (c) 2014, Kenneth MacKay
* All rights reserved. * All rights reserved.

View File

@@ -1,3 +1,9 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* uECC_platform_specific.c - Implementation of platform specific functions*/ /* uECC_platform_specific.c - Implementation of platform specific functions*/
/* Copyright (c) 2014, Kenneth MacKay /* Copyright (c) 2014, Kenneth MacKay

View File

@@ -1,4 +1,8 @@
/* hmac.c - TinyCrypt implementation of the HMAC algorithm */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* hmac_prng.c - TinyCrypt implementation of HMAC-PRNG */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* hmac_prng.c - TinyCrypt implementation of HMAC-PRNG */
#include <tinycrypt/hmac_prng.h> #include <tinycrypt/hmac_prng.h>
#include <tinycrypt/hmac.h> #include <tinycrypt/hmac.h>
#include <tinycrypt/constants.h> #include <tinycrypt/constants.h>

View File

@@ -1,4 +1,8 @@
/* sha256.c - TinyCrypt SHA-256 crypto hash algorithm implementation */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.

View File

@@ -1,4 +1,8 @@
/* utils.c - TinyCrypt platform-dependent run-time operations */ /*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
/* /*
* Copyright (C) 2017 by Intel Corporation, All Rights Reserved. * Copyright (C) 2017 by Intel Corporation, All Rights Reserved.
@@ -30,6 +34,8 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
/* utils.c - TinyCrypt platform-dependent run-time operations */
#include <tinycrypt/utils.h> #include <tinycrypt/utils.h>
#include <tinycrypt/constants.h> #include <tinycrypt/constants.h>