mirror of
https://github.com/openharmony/tee_tee_os_framework.git
synced 2026-07-19 19:53:44 -04:00
+7
-4
@@ -60,7 +60,6 @@ endif
|
||||
|
||||
export TEE_CLANG_DIR := ${TEE_COMPILER_DIR}/bin
|
||||
export TEE_SECUREC_DIR := $(THIRDPARTY)/bounds_checking_function
|
||||
export OPENSSL_DIR := $(THIRDPARTY)/openssl
|
||||
|
||||
export OLD_TOPDIR := $(TOPDIR)/config
|
||||
export TOOLS := $(TOPDIR)/build/tools
|
||||
@@ -98,7 +97,8 @@ ARCH = aarch64
|
||||
include $(BUILD_CONFIG)/var.mk
|
||||
include $(BUILD_CONFIG)/plat_config_file.mk
|
||||
|
||||
PHONY += GEN_CONF_FILE PATCH_OPENSSL
|
||||
PHONY += GEN_CONF_FILE PREBUILD_OPENSSL
|
||||
|
||||
GEN_CONF_FILE:
|
||||
echo "generated platautoconf.h "
|
||||
rm -rf $(PLAT_AUTOCONF_FILE)
|
||||
@@ -114,7 +114,10 @@ GEN_CONF_FILE:
|
||||
rm -rf $(PREBUILD_DIR)/headers/.config
|
||||
cat $(CONFIG_FILE) | tee $(PREBUILD_DIR)/headers/.config
|
||||
|
||||
PATCH_OPENSSL:=$(shell $(TOPDIR)/lib/teelib/libopenssl/build_openssl.sh $(THIRDPARTY) $(TOPDIR))
|
||||
PREBUILD_OPENSSL:
|
||||
@bash $(TOPDIR)/lib/teelib/libopenssl/build_openssl.sh $(THIRDPARTY) $(TOPDIR)
|
||||
|
||||
export CONFIG_CRYPTO_SOFT_ENGINE := $(CONFIG_CRYPTO_SOFT_ENGINE)
|
||||
|
||||
export PLAT_CFG_DIR := $(PLATFORM_DIR)/$(PLATFORM_NAME)/$(PRODUCT_NAME)/$(CHIP_NAME)/plat_cfg
|
||||
export PLAT_COMMON_DIR := $(PLATFORM_DIR)/common
|
||||
@@ -226,7 +229,7 @@ release:
|
||||
|
||||
PHONY += clean
|
||||
clean: clean_links
|
||||
sh $(TOPDIR)/lib/teelib/libopenssl/clean_openssl.sh $(THIRDPARTY) $(TOPDIR)
|
||||
bash $(TOPDIR)/lib/teelib/libopenssl/clean_openssl.sh $(TOPDIR)
|
||||
@rm -rf $(OUTPUTDIR)
|
||||
@rm -rf sec_trustedcore.img
|
||||
@rm -rf tools/linker.lds_pp
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
# See the Mulan PSL v2 for more details.
|
||||
|
||||
FRAMEWORK_DIR=$(pwd)/../
|
||||
make V=3 TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} GEN_CONF_FILE -j
|
||||
make V=3 TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} install_headers -j
|
||||
make V=3 TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} libs -j
|
||||
make V=3 TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} tees -j
|
||||
make V=3 TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} package -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} GEN_CONF_FILE -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} PREBUILD_OPENSSL -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} install_headers -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} libs -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} tees -j
|
||||
make TARGET_BOARD_PLATFORM=$1 FRAMEWORK_ELF_PATH=$2 TEE_COMPILER_DIR=$3 LLVM_BASEVER=$4 TOPDIR=${FRAMEWORK_DIR} package -j
|
||||
|
||||
@@ -26,9 +26,9 @@ CONFIG_PERMSRV_64BIT=false
|
||||
CONFIG_DRVMGR_64BIT=false
|
||||
CONFIG_DYN_CONF=true
|
||||
CONFIG_NO_VENDOR_LIB_EMBEDDED=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=true
|
||||
CONFIG_CRYPTO_SUPPORT_X509=true
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=false
|
||||
CONFIG_CRYPTO_SUPPORT_X509=false
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=false
|
||||
CONFIG_CRYPTO_AES_WRAPPER=true
|
||||
#
|
||||
# services
|
||||
@@ -75,7 +75,7 @@ CONFIG_USER_OPTIMIZATION_Os=y
|
||||
#
|
||||
CONFIG_OPENSSL_NO_ASM=true
|
||||
CONFIG_CRYPTO_GET_ENTROPY=true
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl3
|
||||
#
|
||||
# System
|
||||
#
|
||||
|
||||
@@ -31,9 +31,9 @@ CONFIG_TA_LOCAL_SIGN=true
|
||||
CONFIG_NO_VENDOR_LIB_EMBEDDED=true
|
||||
CONFIG_DRVMGR_64BIT=true
|
||||
CONFIG_DRVMGR_32BIT=false
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=true
|
||||
CONFIG_CRYPTO_SUPPORT_X509=true
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=false
|
||||
CONFIG_CRYPTO_SUPPORT_X509=false
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=false
|
||||
CONFIG_CRYPTO_AES_WRAPPER=true
|
||||
#
|
||||
# services
|
||||
@@ -80,7 +80,7 @@ CONFIG_USER_OPTIMIZATION_Os=y
|
||||
#
|
||||
CONFIG_OPENSSL_NO_ASM=true
|
||||
CONFIG_CRYPTO_GET_ENTROPY=true
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl3
|
||||
#
|
||||
# System
|
||||
#
|
||||
|
||||
@@ -26,9 +26,9 @@ CONFIG_PERMSRV_64BIT=false
|
||||
CONFIG_DRVMGR_64BIT=false
|
||||
CONFIG_DYN_CONF=true
|
||||
CONFIG_NO_VENDOR_LIB_EMBEDDED=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=true
|
||||
CONFIG_CRYPTO_SUPPORT_X509=true
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=false
|
||||
CONFIG_CRYPTO_SUPPORT_X509=false
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=false
|
||||
CONFIG_CRYPTO_AES_WRAPPER=true
|
||||
#
|
||||
# services
|
||||
@@ -75,7 +75,7 @@ CONFIG_USER_OPTIMIZATION_Os=y
|
||||
#
|
||||
CONFIG_OPENSSL_NO_ASM=true
|
||||
CONFIG_CRYPTO_GET_ENTROPY=true
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl3
|
||||
#
|
||||
# System
|
||||
#
|
||||
|
||||
@@ -31,9 +31,9 @@ CONFIG_TA_LOCAL_SIGN=true
|
||||
CONFIG_NO_VENDOR_LIB_EMBEDDED=true
|
||||
CONFIG_DRVMGR_64BIT=true
|
||||
CONFIG_DRVMGR_32BIT=false
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=true
|
||||
CONFIG_CRYPTO_SUPPORT_X509=true
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=true
|
||||
CONFIG_CRYPTO_SUPPORT_EC25519=false
|
||||
CONFIG_CRYPTO_SUPPORT_X509=false
|
||||
CONFIG_CRYPTO_ECC_WRAPPER=false
|
||||
CONFIG_CRYPTO_AES_WRAPPER=true
|
||||
|
||||
#
|
||||
@@ -81,7 +81,7 @@ CONFIG_USER_OPTIMIZATION_Os=y
|
||||
#
|
||||
CONFIG_OPENSSL_NO_ASM=true
|
||||
CONFIG_CRYPTO_GET_ENTROPY=true
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl
|
||||
CONFIG_CRYPTO_SOFT_ENGINE=openssl3
|
||||
#
|
||||
# System
|
||||
#
|
||||
|
||||
@@ -132,4 +132,6 @@ flags += -DTA_LOG_LEVEL=2
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl)
|
||||
flags += -DOPENSSL_ENABLE
|
||||
else ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
|
||||
flags += -DOPENSSL3_ENABLE
|
||||
endif
|
||||
|
||||
@@ -18,11 +18,17 @@ CFILES := $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_ext
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify.c))
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_key_ops.c))
|
||||
|
||||
ifeq ($(CONFIG_ELF_DECRYPT_ENABLE),y)
|
||||
CFLAGS += -DELF_DECRYPT_ENABLE
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_dec_key_ops.c))
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), mbedtls)
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_mbedtls.c))
|
||||
else
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_openssl.c))
|
||||
endif
|
||||
else
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_stub.c))
|
||||
endif
|
||||
|
||||
ifneq ($(findstring y, $(CONFIG_APP_TEE_PERM) $(CONFIG_APP_TEE_PERM_A32)),)
|
||||
CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_perm_img.c))
|
||||
@@ -62,7 +68,7 @@ CPPFLAGS += -I$(TEELIB)/libtimer/include/
|
||||
CPPFLAGS += -I$(SYSLIB)/libspawn_common/include/
|
||||
CPPFLAGS += -I$(TEELIB)/libdrv/include
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/include
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
endif
|
||||
@@ -71,7 +77,11 @@ endif
|
||||
CPPFLAGS += -I$(SOURCE_DIR)/include/
|
||||
CPPFLAGS += -I$(TEELIB)/libteeagentcommon_client/include
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl3)
|
||||
CFLAGS += -DOPENSSL3_ENABLE
|
||||
else
|
||||
CFLAGS += -DOPENSSL_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_DYN_TA_FORMAT),1)
|
||||
CFLAGS += -DDYN_TA_SUPPORT_V3
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "tee_load_key_ops.h"
|
||||
#include "tee_crypto_hal.h"
|
||||
#include <sys/mman.h>
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
#include <openssl/rsa.h>
|
||||
#endif
|
||||
|
||||
TEE_Result tee_secure_img_header_check(uint32_t img_version)
|
||||
{
|
||||
|
||||
@@ -134,19 +134,6 @@ clean:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void print_ta_sign_algorithm_info(const struct sign_config_t *config)
|
||||
{
|
||||
if (config == NULL)
|
||||
return;
|
||||
|
||||
ta_cipher_layer_t *ta_cipher_layer = get_ta_cipher_layer();
|
||||
|
||||
tloge("sec config info:sign_alg=0x%x, key_len=%u, hash_size=%zu, hash_padding=%s, key_style=%s\n",
|
||||
ta_cipher_layer->cipher_hdr.signature_alg, config->key_len, config->hash_size,
|
||||
config->padding == MBEDTLS_RSA_PKCS_V21 ? "PKCS_V21" : "PKCS_V15",
|
||||
config->key_style == PUB_KEY_RELEASE ? "release" : "debug");
|
||||
}
|
||||
|
||||
static TEE_Result ecies_kem_init(const struct ecc_derive_data_st *ecc_data,
|
||||
mbedtls_ecp_group *grp, mbedtls_ecp_point *q, mbedtls_mpi *d)
|
||||
{
|
||||
@@ -282,14 +269,3 @@ clean:
|
||||
mbedtls_cipher_free(&cipher_ctx);
|
||||
return -1;
|
||||
}
|
||||
|
||||
const rsa_pub_key_t *get_ta_verify_key(void)
|
||||
{
|
||||
struct ta_verify_key verify_key = { PUB_KEY_2048_BITS, PUB_KEY_RELEASE, NULL };
|
||||
|
||||
TEE_Result ret = get_ta_verify_pubkey(&verify_key);
|
||||
if (ret != TEE_SUCCESS || verify_key.key == NULL)
|
||||
return NULL;
|
||||
|
||||
return verify_key.key;
|
||||
}
|
||||
|
||||
@@ -64,19 +64,6 @@ TEE_Result tee_secure_img_decrypt_cipher_layer(const uint8_t *cipher_layer, uint
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
|
||||
void print_ta_sign_algorithm_info(const struct sign_config_t *config)
|
||||
{
|
||||
if (config == NULL)
|
||||
return;
|
||||
|
||||
ta_cipher_layer_t *ta_cipher_layer = get_ta_cipher_layer();
|
||||
|
||||
tloge("sec config info:sign_alg=0x%x, key_len=%u, hash_size=%zu, hash_padding=%s, key_style=%s\n",
|
||||
ta_cipher_layer->cipher_hdr.signature_alg, config->key_len, config->hash_size,
|
||||
config->padding == RSA_PKCS1_PSS_PADDING ? "PKCS1_PSS" : "PKCS1",
|
||||
config->key_style == PUB_KEY_RELEASE ? "release" : "debug");
|
||||
}
|
||||
|
||||
static void free_rsa_bn_n(BIGNUM *bn_n, BIGNUM *bn_e, BIGNUM *bn_d, BIGNUM *bn_p)
|
||||
{
|
||||
BN_free(bn_n);
|
||||
@@ -741,14 +728,3 @@ void free_private_key(RSA *priv_key)
|
||||
if (priv_key != NULL)
|
||||
RSA_free(priv_key);
|
||||
}
|
||||
|
||||
RSA *get_ta_verify_key(void)
|
||||
{
|
||||
struct ta_verify_key verify_key = { PUB_KEY_2048_BITS, PUB_KEY_RELEASE, NULL};
|
||||
|
||||
TEE_Result ret = get_ta_verify_pubkey(&verify_key);
|
||||
if (ret != TEE_SUCCESS || verify_key.key == NULL)
|
||||
return NULL;
|
||||
|
||||
return rsa_build_public_key(verify_key.key);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,6 @@ struct ecc_derive_data_st {
|
||||
|
||||
TEE_Result tee_secure_img_decrypt_cipher_layer(const uint8_t *cipher_layer, uint32_t cipher_size,
|
||||
uint8_t *plaintext_layer, uint32_t *plaintext_size);
|
||||
void print_ta_sign_algorithm_info(const struct sign_config_t *config);
|
||||
RSA *get_ta_verify_key(void);
|
||||
int32_t aes_cbc_256_decrypt(const uint8_t *key, const uint8_t *iv,
|
||||
const uint8_t *in, uint32_t in_len, uint8_t *out);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
#include "tee_elf_verify_openssl.h"
|
||||
|
||||
TEE_Result tee_secure_img_decrypt_cipher_layer(const uint8_t *cipher_layer,
|
||||
uint32_t cipher_size, uint8_t *plaintext_layer, uint32_t *plaintext_size)
|
||||
{
|
||||
(void)cipher_layer;
|
||||
(void)cipher_size;
|
||||
(void)plaintext_layer;
|
||||
(void)plaintext_size;
|
||||
return TEE_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
#include "tee_load_key_ops.h"
|
||||
#include "tee_elf_verify.h"
|
||||
#include "ta_load_key.h"
|
||||
#include "ta_framework.h"
|
||||
#include "tee_mem_mgmt_api.h"
|
||||
#include "tee_log.h"
|
||||
#include "crypto_inner_interface.h"
|
||||
#include "tee_crypto_hal.h"
|
||||
#include "ta_load_config.h"
|
||||
#include <tee_crypto_signature_verify.h>
|
||||
#include "securec.h"
|
||||
#include "tee_elf_verify_openssl.h"
|
||||
|
||||
TEE_Result get_key_data(int32_t img_version, struct key_data *key_data)
|
||||
{
|
||||
TEE_Result ret;
|
||||
|
||||
switch (img_version) {
|
||||
case TA_RSA2048_VERSION:
|
||||
ret = get_ta_load_key(key_data);
|
||||
break;
|
||||
case CIPHER_LAYER_VERSION:
|
||||
ret = get_ta_load_key(key_data);
|
||||
break;
|
||||
default:
|
||||
tloge("Unsupported secure image version: %d\n", img_version);
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
if (ret != TEE_SUCCESS)
|
||||
tloge("get key failed for version:%d\n", img_version);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct ecies_key_struct *get_ecies_key_data(int32_t img_version, enum ta_type type)
|
||||
{
|
||||
TEE_Result ret;
|
||||
struct key_data key_data = {
|
||||
.pro_type = ECIES_KEY,
|
||||
.ta_type = type,
|
||||
.key = NULL,
|
||||
.key_len = 0,
|
||||
};
|
||||
|
||||
ret = get_key_data(img_version, &key_data);
|
||||
if (ret != TEE_SUCCESS) {
|
||||
tloge("get ecies key failed for version:%d\n", img_version);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (key_data.key_len != sizeof(struct ecies_key_struct)) {
|
||||
tloge("ecies key len error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (struct ecies_key_struct *)key_data.key;
|
||||
}
|
||||
|
||||
TEE_Result get_rsa_priv_aes_key(const struct ecies_key_struct *ecies_key_data, uint8_t *key_buff,
|
||||
uint32_t buff_size)
|
||||
{
|
||||
if (ecies_key_data == NULL)
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
uint8_t oem_ecc_priv[ECIES_PRIV_LEN];
|
||||
struct ecc_derive_data_st ecc_data = {0};
|
||||
|
||||
int ret = get_class_ecc_key(oem_ecc_priv, ECIES_PRIV_LEN);
|
||||
if (ret != 0) {
|
||||
tloge("OEM KEY get failed");
|
||||
return TEE_ERROR_ITEM_NOT_FOUND;
|
||||
}
|
||||
ecc_data.ec1_priv = oem_ecc_priv;
|
||||
ecc_data.ec1_len = sizeof(oem_ecc_priv);
|
||||
ecc_data.ec2_pub = ecies_key_data->ecc_pub;
|
||||
ecc_data.ec2_len = sizeof(ecies_key_data->ecc_pub);
|
||||
ret = ecies_kem_decrypt(&ecc_data, key_buff, buff_size);
|
||||
(void)memset_s(oem_ecc_priv, sizeof(oem_ecc_priv), 0, sizeof(oem_ecc_priv));
|
||||
if (ret < 0) {
|
||||
tloge("ECIES decryption failed");
|
||||
return TEE_ERROR_GENERIC;
|
||||
}
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
|
||||
TEE_Result aes_decrypt_rsa_private(const struct ecies_key_struct *ecies_data, const uint8_t *aes_key,
|
||||
uint32_t key_size, struct rsa_priv_key *priv)
|
||||
{
|
||||
(void)key_size;
|
||||
if (ecies_data == NULL)
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
|
||||
int32_t ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_p,
|
||||
ecies_data->wrapped_rsa_priv_p_len, priv->p);
|
||||
bool con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_p_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->p_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_q,
|
||||
ecies_data->wrapped_rsa_priv_q_len, priv->q);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_q_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->q_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_dq,
|
||||
ecies_data->wrapped_rsa_priv_dq_len, priv->dq);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_dq_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->dq_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_dp,
|
||||
ecies_data->wrapped_rsa_priv_dp_len, priv->dp);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_dp_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->dp_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_qinv,
|
||||
ecies_data->wrapped_rsa_priv_qinv_len, priv->qinv);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_qinv_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->qinv_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_pub_d,
|
||||
ecies_data->wrapped_rsa_pub_d_len, priv->d);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_pub_d_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->d_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_pub_e,
|
||||
sizeof(ecies_data->wrapped_rsa_pub_e), priv->e);
|
||||
con = (ret == -1 || ret > (int32_t)sizeof(ecies_data->wrapped_rsa_pub_e));
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->e_size = (uint32_t)ret;
|
||||
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
@@ -24,129 +24,15 @@
|
||||
#include "tee_elf_verify_openssl.h"
|
||||
#include <tee_crypto_signature_verify.h>
|
||||
|
||||
TEE_Result get_key_data(int32_t img_version, struct key_data *key_data)
|
||||
RSA *get_ta_verify_key(void)
|
||||
{
|
||||
TEE_Result ret;
|
||||
struct ta_verify_key verify_key = { PUB_KEY_2048_BITS, PUB_KEY_RELEASE, NULL};
|
||||
|
||||
switch (img_version) {
|
||||
case TA_RSA2048_VERSION:
|
||||
ret = get_ta_load_key(key_data);
|
||||
break;
|
||||
case CIPHER_LAYER_VERSION:
|
||||
ret = get_ta_load_key(key_data);
|
||||
break;
|
||||
default:
|
||||
tloge("Unsupported secure image version: %d\n", img_version);
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
if (ret != TEE_SUCCESS)
|
||||
tloge("get key failed for version:%d\n", img_version);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct ecies_key_struct *get_ecies_key_data(int32_t img_version, enum ta_type type)
|
||||
{
|
||||
TEE_Result ret;
|
||||
struct key_data key_data = {
|
||||
.pro_type = ECIES_KEY,
|
||||
.ta_type = type,
|
||||
.key = NULL,
|
||||
.key_len = 0,
|
||||
};
|
||||
|
||||
ret = get_key_data(img_version, &key_data);
|
||||
if (ret != TEE_SUCCESS) {
|
||||
tloge("get ecies key failed for version:%d\n", img_version);
|
||||
TEE_Result ret = get_ta_verify_pubkey(&verify_key);
|
||||
if (ret != TEE_SUCCESS || verify_key.key == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (key_data.key_len != sizeof(struct ecies_key_struct)) {
|
||||
tloge("ecies key len error\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (struct ecies_key_struct *)key_data.key;
|
||||
}
|
||||
|
||||
TEE_Result get_rsa_priv_aes_key(const struct ecies_key_struct *ecies_key_data, uint8_t *key_buff,
|
||||
uint32_t buff_size)
|
||||
{
|
||||
if (ecies_key_data == NULL)
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
uint8_t oem_ecc_priv[ECIES_PRIV_LEN];
|
||||
struct ecc_derive_data_st ecc_data = {0};
|
||||
|
||||
int ret = get_class_ecc_key(oem_ecc_priv, ECIES_PRIV_LEN);
|
||||
if (ret != 0) {
|
||||
tloge("OEM KEY get failed");
|
||||
return TEE_ERROR_ITEM_NOT_FOUND;
|
||||
}
|
||||
ecc_data.ec1_priv = oem_ecc_priv;
|
||||
ecc_data.ec1_len = sizeof(oem_ecc_priv);
|
||||
ecc_data.ec2_pub = ecies_key_data->ecc_pub;
|
||||
ecc_data.ec2_len = sizeof(ecies_key_data->ecc_pub);
|
||||
ret = ecies_kem_decrypt(&ecc_data, key_buff, buff_size);
|
||||
(void)memset_s(oem_ecc_priv, sizeof(oem_ecc_priv), 0, sizeof(oem_ecc_priv));
|
||||
if (ret < 0) {
|
||||
tloge("ECIES decryption failed");
|
||||
return TEE_ERROR_GENERIC;
|
||||
}
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
|
||||
TEE_Result aes_decrypt_rsa_private(const struct ecies_key_struct *ecies_data, const uint8_t *aes_key,
|
||||
uint32_t key_size, struct rsa_priv_key *priv)
|
||||
{
|
||||
(void)key_size;
|
||||
if (ecies_data == NULL)
|
||||
return TEE_ERROR_BAD_PARAMETERS;
|
||||
|
||||
int32_t ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_p,
|
||||
ecies_data->wrapped_rsa_priv_p_len, priv->p);
|
||||
bool con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_p_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->p_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_q,
|
||||
ecies_data->wrapped_rsa_priv_q_len, priv->q);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_q_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->q_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_dq,
|
||||
ecies_data->wrapped_rsa_priv_dq_len, priv->dq);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_dq_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->dq_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_dp,
|
||||
ecies_data->wrapped_rsa_priv_dp_len, priv->dp);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_dp_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->dp_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_priv_qinv,
|
||||
ecies_data->wrapped_rsa_priv_qinv_len, priv->qinv);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_priv_qinv_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->qinv_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_pub_d,
|
||||
ecies_data->wrapped_rsa_pub_d_len, priv->d);
|
||||
con = (ret == -1 || ret > (int32_t)ecies_data->wrapped_rsa_pub_d_len);
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->d_size = (uint32_t)ret;
|
||||
ret = aes_cbc_256_decrypt(aes_key, ecies_data->iv, ecies_data->wrapped_rsa_pub_e,
|
||||
sizeof(ecies_data->wrapped_rsa_pub_e), priv->e);
|
||||
con = (ret == -1 || ret > (int32_t)sizeof(ecies_data->wrapped_rsa_pub_e));
|
||||
if (con)
|
||||
return TEE_ERROR_GENERIC;
|
||||
priv->e_size = (uint32_t)ret;
|
||||
|
||||
return TEE_SUCCESS;
|
||||
return rsa_build_public_key(verify_key.key);
|
||||
}
|
||||
|
||||
/* Process steps:
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "tee_elf_verify_openssl.h"
|
||||
#include "ipclib.h"
|
||||
#include <sys/mman.h>
|
||||
#ifdef OPENSSL_ENABLE
|
||||
#if defined(OPENSSL_ENABLE) || defined(OPENSSL3_ENABLE)
|
||||
#include <openssl/obj_mac.h>
|
||||
#endif
|
||||
|
||||
@@ -720,6 +720,19 @@ static TEE_Result do_ta_image_verify(uint8_t *signature, uint32_t signature_size
|
||||
return TEE_SUCCESS;
|
||||
}
|
||||
|
||||
static void print_ta_sign_algorithm_info(const struct sign_config_t *config)
|
||||
{
|
||||
if (config == NULL)
|
||||
return;
|
||||
|
||||
ta_cipher_layer_t *ta_cipher_layer = get_ta_cipher_layer();
|
||||
|
||||
tloge("sec config info:sign_alg=0x%x, key_len=%u, hash_size=%zu, hash_padding=%s, key_style=%s\n",
|
||||
ta_cipher_layer->cipher_hdr.signature_alg, config->key_len, config->hash_size,
|
||||
config->padding == RSA_PKCS1_PSS_PADDING ? "PKCS1_PSS" : "PKCS1",
|
||||
config->key_style == PUB_KEY_RELEASE ? "release" : "debug");
|
||||
}
|
||||
|
||||
TEE_Result tee_secure_img_signature_verify(const uint8_t *plaintext_payload, uint32_t plaintext_size,
|
||||
uint8_t *signature, uint32_t signature_size, elf_hash_data *hash_data)
|
||||
{
|
||||
|
||||
@@ -37,11 +37,17 @@ endif
|
||||
CFLAGS += -DMAX_SRC_SIZE=512000
|
||||
A32_CFLAGS += -DMAX_SRC_SIZE=512000
|
||||
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/include
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
CFLAGS += -DOPENSSL_ENABLE
|
||||
A32_CFLAGS += -DOPENSSL_ENABLE
|
||||
CPPFLAGS += -I$(OPENSSL_DIR)/include
|
||||
CPPFLAGS += -I$(OPENSSL_DIR)/crypto
|
||||
else ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl3)
|
||||
CFLAGS += -DOPENSSL3_ENABLE
|
||||
A32_CFLAGS += -DOPENSSL3_ENABLE
|
||||
endif
|
||||
|
||||
ifeq (${TARG}, _a32)
|
||||
|
||||
@@ -474,7 +474,7 @@ void TEE_FreeOperation(TEE_OperationHandle operation)
|
||||
delete_operation((const TEE_OperationHandle)operation);
|
||||
TEE_Free(operation);
|
||||
#ifdef OPENSSL_ENABLE
|
||||
tee_crypto_free_opensssl_drbg();
|
||||
tee_crypto_free_openssl_drbg();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -564,7 +564,7 @@ void TEE_ResetOperation(TEE_OperationHandle operation)
|
||||
operation->handleState &= ~TEE_HANDLE_FLAG_INITIALIZED;
|
||||
crypto_unlock_operation(operation);
|
||||
#ifdef OPENSSL_ENABLE
|
||||
tee_crypto_free_opensssl_drbg();
|
||||
tee_crypto_free_openssl_drbg();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2218,7 +2218,7 @@ void TEE_GenerateRandom(void *randomBuffer, size_t randomBufferLen)
|
||||
}
|
||||
tee_crypto_generate_random(randomBuffer + left, randomBufferLen, false);
|
||||
#ifdef OPENSSL_ENABLE
|
||||
tee_crypto_free_opensssl_drbg();
|
||||
tee_crypto_free_openssl_drbg();
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
*/
|
||||
|
||||
#include "tee_crypto_signature_verify.h"
|
||||
#ifdef OPENSSL_ENABLE
|
||||
#if defined(OPENSSL_ENABLE) || defined (OPENSSL3_ENABLE)
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <evp/evp_local.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
@@ -14,7 +14,11 @@ ifeq ($(CONFIG_CRYPTO_SUPPORT_EC25519),true)
|
||||
c-flags += -DCRYPTO_SSL_SUPPORT_EC25519
|
||||
endif
|
||||
|
||||
c-flags += -DOPENSSL_ENABLE
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
|
||||
c-flags += -DOPENSSL3_ENABLE
|
||||
else
|
||||
c-flags += -DOPENSSL_ENABLE
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_TEE_CRYPTO_MGR_SERVER_64BIT), )
|
||||
c-flags += -DCRYPTO_MGR_SERVER_ENABLE
|
||||
@@ -34,13 +38,27 @@ inc-flags += -I$(TEELIB)/libteemem/include
|
||||
inc-flags += -I$(TEELIB)/libssa/include
|
||||
inc-flags += -I$(PREBUILD_HEADER)/sys
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/include
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
endif
|
||||
|
||||
# Source files required to build the target
|
||||
libcrypto_hal_c_files += $(wildcard src/*.c) \
|
||||
$(wildcard src/stub/*.c) \
|
||||
$(wildcard src/boringssl/*.c)
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SUPPORT_SOFT_ECC),true)
|
||||
c-flags += -DCRYPTO_SUPPORT_SOFT_ECC
|
||||
libcrypto_hal_c_files := $(filter-out src/stub/soft_ec_api.c, $(libcrypto_hal_c_files))
|
||||
else
|
||||
libcrypto_hal_c_files := $(filter-out src/boringssl/soft_ec_api.c, $(libcrypto_hal_c_files))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SUPPORT_SOFT_SM2),true)
|
||||
c-flags += -DCRYPTO_SUPPORT_SOFT_SM2
|
||||
libcrypto_hal_c_files := $(filter-out src/stub/soft_gmssl_asym.c, $(libcrypto_hal_c_files))
|
||||
else
|
||||
libcrypto_hal_c_files := $(filter-out src/boringssl/soft_gmssl_asym.c, $(libcrypto_hal_c_files))
|
||||
endif
|
||||
include $(BUILD_LIB)/lib-common.mk
|
||||
|
||||
@@ -41,6 +41,6 @@ struct ctx_handle_t *driver_alloc_ctx_handle(uint32_t alg_type, uint32_t engine,
|
||||
int64_t get_ctx_fd_handle(uint32_t alg_type, bool is_copy_ctx);
|
||||
int32_t driver_ctx_buffer_prepare(const struct ctx_handle_t *src_ctx, struct ctx_handle_t *dest_ctx);
|
||||
#ifdef OPENSSL_ENABLE
|
||||
void tee_crypto_free_opensssl_drbg(void);
|
||||
void tee_crypto_free_openssl_drbg(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,6 @@ static struct aes_init_oper g_aes_des_init_oeration[] = {
|
||||
{ CRYPTO_TYPE_AES_GCM, AES_TEN_ROUNDS_KEY_SIZE, EVP_aes_128_gcm },
|
||||
{ CRYPTO_TYPE_AES_GCM, AES_TWELVE_ROUNDS_KEY_SIZE, EVP_aes_192_gcm },
|
||||
{ CRYPTO_TYPE_AES_GCM, AES_FOURTEEN_ROUNDS_KEY_SIZE, EVP_aes_256_gcm },
|
||||
{ CRYPTO_TYPE_SM4_GCM, SM4_GCM_KEY_SIZE, EVP_sm4_gcm },
|
||||
{ CRYPTO_TYPE_AES_XTS, AES_MAX_KEY_SIZE, EVP_aes_256_xts },
|
||||
{ CRYPTO_TYPE_AES_ECB_PKCS5, AES_TEN_ROUNDS_KEY_SIZE, EVP_aes_128_ecb },
|
||||
{ CRYPTO_TYPE_AES_ECB_PKCS5, AES_TWELVE_ROUNDS_KEY_SIZE, EVP_aes_192_ecb },
|
||||
|
||||
@@ -14,11 +14,18 @@
|
||||
|
||||
#include <crypto_driver_adaptor.h>
|
||||
#include <crypto/sm2.h>
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
#include <internal/sm3.h>
|
||||
#else
|
||||
#include <crypto/sm3.h>
|
||||
#endif
|
||||
#include <crypto/sm4.h>
|
||||
#include <crypto/evp.h>
|
||||
#include <openssl/evp.h>
|
||||
#ifdef CRYPTO_SUPPORT_SOFT_ECC
|
||||
#include <openssl/ec.h>
|
||||
#include <ec/ec_local.h>
|
||||
#endif
|
||||
#include "crypto/ec.h"
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <openssl/crypto.h>
|
||||
@@ -27,7 +34,6 @@
|
||||
#include <openssl/rand.h>
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/asn1t.h>
|
||||
#include <ec/ec_local.h>
|
||||
#include <bn/bn_local.h>
|
||||
#include <tee_log.h>
|
||||
#include <tee_crypto_api.h>
|
||||
@@ -66,6 +72,7 @@
|
||||
#define SM2_SIG_LEN 64
|
||||
#define SM2_MAX_PLAINTEXT_LENGTH 1024
|
||||
|
||||
#ifdef CRYPTO_SUPPORT_SOFT_SM2
|
||||
struct sm2_public_key {
|
||||
uint8_t sm2_x[KEY_SIZE_2 + 1];
|
||||
uint8_t sm2_y[KEY_SIZE_2 + 1];
|
||||
@@ -118,3 +125,4 @@ struct sm2_new_ec_group_t {
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -16,9 +16,11 @@
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <openssl/cmac.h>
|
||||
#ifdef CONFIG_CRYPTO_SUPPORT_SIPHASH
|
||||
#ifdef OPENSSL_ENABLE
|
||||
#include <crypto/siphash.h>
|
||||
#include <siphash/siphash_local.h>
|
||||
#elif defined OPENSSL3_ENABLE
|
||||
#include <crypto/siphash.h>
|
||||
#endif
|
||||
#include <openssl/rand.h>
|
||||
#include <securec.h>
|
||||
@@ -192,7 +194,7 @@ static int32_t soft_copy_hmac_info(struct ctx_handle_t *dest, const struct ctx_h
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CRYPTO_SUPPORT_SIPHASH
|
||||
#if defined(OPENSSL_ENABLE) || defined (OPENSSL3_ENABLE)
|
||||
static int32_t soft_copy_siphash_info(struct ctx_handle_t *dest, const struct ctx_handle_t *src)
|
||||
{
|
||||
TEE_Free((void *)(uintptr_t)(dest->ctx_buffer));
|
||||
@@ -239,7 +241,7 @@ static struct soft_ctx_copy g_soft_copy_ctx[] = {
|
||||
{ CRYPTO_TYPE_HMAC_SHA256, soft_copy_hmac_info },
|
||||
{ CRYPTO_TYPE_HMAC_SHA384, soft_copy_hmac_info },
|
||||
{ CRYPTO_TYPE_HMAC_SHA512, soft_copy_hmac_info },
|
||||
#ifdef CONFIG_CRYPTO_SUPPORT_SIPHASH
|
||||
#if defined(OPENSSL_ENABLE) || defined (OPENSSL3_ENABLE)
|
||||
{ CRYPTO_TYPE_SIP_HASH, soft_copy_siphash_info },
|
||||
#endif
|
||||
{ CRYPTO_TYPE_SM4_ECB, soft_copy_gmssl_info },
|
||||
@@ -306,6 +308,7 @@ int32_t get_boring_nid_by_tee_curve(uint32_t tee_domain, uint32_t *nid)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_ENABLE
|
||||
int32_t get_openssl_rand(unsigned char *buf, int num)
|
||||
{
|
||||
if (num == 0 || num > INT32_MAX)
|
||||
@@ -320,3 +323,4 @@ void free_openssl_drbg_mem(void)
|
||||
drbg_delete_thread_state();
|
||||
OPENSSL_thread_stop();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
*/
|
||||
|
||||
#include "soft_derive_key_api.h"
|
||||
#include <ec/ec_local.h>
|
||||
#include <crypto/evp.h>
|
||||
#ifdef CRYPTO_SUPPORT_SOFT_ECC
|
||||
#include <ec/ec_local.h>
|
||||
#include <openssl/ecdh.h>
|
||||
#endif
|
||||
#include <openssl/evp.h>
|
||||
#include <securec.h>
|
||||
#include <tee_log.h>
|
||||
@@ -39,6 +41,7 @@ static EVP_MD *get_pbkdf_digest_type(uint32_t digest_type)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CRYPTO_SUPPORT_SOFT_ECC
|
||||
static int32_t x25519_derive_key(const struct ecc_pub_key_t *client_key, const struct ecc_priv_key_t *server_key,
|
||||
uint8_t *out_shared_key, uint32_t *out_share_key_len)
|
||||
{
|
||||
@@ -159,6 +162,19 @@ int32_t soft_crypto_ecdh_derive_key(uint32_t alg_type, const struct ecc_pub_key_
|
||||
}
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
#else
|
||||
int32_t soft_crypto_ecdh_derive_key(uint32_t alg_type, const struct ecc_pub_key_t *client_key,
|
||||
const struct ecc_priv_key_t *server_key, const struct asymmetric_params_t *ec_params,
|
||||
struct memref_t *secret)
|
||||
{
|
||||
(void)alg_type;
|
||||
(void)client_key;
|
||||
(void)server_key;
|
||||
(void)ec_params;
|
||||
(void)secret;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t soft_crypto_pbkdf2(const struct memref_t *password, const struct memref_t *salt,
|
||||
uint32_t iterations, uint32_t digest_type, struct memref_t *data_out)
|
||||
|
||||
@@ -533,8 +533,13 @@ static int32_t ed25519_sign_digest(struct memref_t *signature, const struct memr
|
||||
uint8_t *digest_buffer = (uint8_t *)(uintptr_t)(digest->buffer);
|
||||
uint8_t *signature_buffer = (uint8_t *)(uintptr_t)(signature->buffer);
|
||||
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
sign_ret = ossl_ed25519_sign(signature_buffer, digest_buffer, digest->size,
|
||||
private_key->r + X25519_SHARE_KEY_LEN, private_key->r, NULL, NULL);
|
||||
#else
|
||||
sign_ret = ED25519_sign(signature_buffer, digest_buffer, digest->size,
|
||||
private_key->r + X25519_SHARE_KEY_LEN, private_key->r);
|
||||
#endif
|
||||
if (sign_ret != BORINGSSL_OK) {
|
||||
tloge("ed25519 sign fail");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
@@ -581,8 +586,13 @@ static int32_t ed25519_verify_digest(const struct memref_t *signature, const str
|
||||
|
||||
uint8_t *signature_buffer = (uint8_t *)(uintptr_t)(signature->buffer);
|
||||
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
int32_t verf_ret = ossl_ed25519_verify((const uint8_t *)(uintptr_t)digest->buffer,
|
||||
digest->size, signature_buffer, public_key->x, NULL, NULL);
|
||||
#else
|
||||
int32_t verf_ret = ED25519_verify((const uint8_t *)(uintptr_t)digest->buffer,
|
||||
digest->size, signature_buffer, public_key->x);
|
||||
#endif
|
||||
if (verf_ret != BORINGSSL_OK) {
|
||||
tloge("soft verify fail");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <tee_defines.h>
|
||||
#include <crypto_driver_adaptor.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
int32_t sm3_digest_init(struct ctx_handle_t *ctx);
|
||||
|
||||
@@ -51,4 +52,5 @@ int32_t sm2_generate_keypair(uint32_t key_size, uint32_t curve,
|
||||
int32_t soft_copy_gmssl_info(struct ctx_handle_t *dest, const struct ctx_handle_t *src);
|
||||
|
||||
void free_sm4_context(uint64_t *ctx);
|
||||
|
||||
#endif
|
||||
|
||||
+34
-563
@@ -18,7 +18,6 @@
|
||||
#include <crypto/sm2.h>
|
||||
#include <evp/evp_local.h>
|
||||
#include <hmac/hmac_local.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <openssl/obj_mac.h>
|
||||
#include <openssl/ec.h>
|
||||
#include <tee_log.h>
|
||||
@@ -128,7 +127,11 @@ static int32_t sm2_sign_new_level(const uint8_t *digest, uint32_t digest_len,
|
||||
ECDSA_SIG *sig = NULL;
|
||||
int32_t ret;
|
||||
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
ret = ossl_sm2_internal_sign(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#else
|
||||
ret = sm2_sign(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#endif
|
||||
if (ret != GMSSL_OK) {
|
||||
tloge("SM2 sign failed\n");
|
||||
goto exit;
|
||||
@@ -159,7 +162,12 @@ static int32_t sm2_sign_old_level(const uint8_t *digest, uint32_t digest_len,
|
||||
|
||||
gmssl_generate_random();
|
||||
|
||||
int32_t ret = sm2_sign(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
int32_t ret;
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
ret = ossl_sm2_internal_sign(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#else
|
||||
ret = sm2_sign(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#endif
|
||||
if (ret != GMSSL_OK) {
|
||||
tloge("SM2 sign failed\n");
|
||||
return get_soft_crypto_error(CRYPTO_SIGNATURE_INVALID);
|
||||
@@ -232,7 +240,11 @@ static int32_t sm2_verify_new_level(const uint8_t *digest, uint32_t digest_len,
|
||||
temp_len_src = i2d_ECDSA_SIG(sig, &temp_data_src);
|
||||
temp_data_src -= temp_len_src;
|
||||
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
rc = ossl_sm2_internal_verify(digest, digest_len, temp_data_src, temp_len_src, (EC_KEY *)ec_key);
|
||||
#else
|
||||
rc = sm2_verify(digest, digest_len, temp_data_src, temp_len_src, (EC_KEY *)ec_key);
|
||||
#endif
|
||||
if (rc != GMSSL_OK) {
|
||||
tloge("SM2 verify failed\n");
|
||||
rc = CRYPTO_SIGNATURE_INVALID;
|
||||
@@ -256,7 +268,11 @@ static int32_t sm2_verify_old_level(const uint8_t *digest, uint32_t digest_len,
|
||||
return TEE_ERROR_SHORT_BUFFER;
|
||||
}
|
||||
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
rc = ossl_sm2_internal_verify(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#else
|
||||
rc = sm2_verify(digest, digest_len, signature, signature_len, (EC_KEY *)ec_key);
|
||||
#endif
|
||||
if (rc != GMSSL_OK) {
|
||||
tloge("SM2 verify failed\n");
|
||||
rc = get_soft_crypto_error(CRYPTO_SIGNATURE_INVALID);
|
||||
@@ -986,7 +1002,11 @@ static int32_t do_sm2_encrypt(const EC_KEY *ec_key, const uint8_t *src_data, uin
|
||||
gmssl_generate_random();
|
||||
|
||||
/* use publicKey to encrypt */
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
ret = ossl_sm2_encrypt(ec_key, EVP_sm3(), src_data, src_len, dest_data, &temp_len);
|
||||
#else
|
||||
ret = sm2_encrypt(ec_key, EVP_sm3(), src_data, src_len, dest_data, &temp_len);
|
||||
#endif
|
||||
if (ret != GMSSL_OK) {
|
||||
tloge("SM2 do encrypt failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
@@ -1102,7 +1122,12 @@ static int32_t sm2_decrypt_new(const EC_KEY *ec_key, const void *src_data, uint3
|
||||
ret = pure_to_asn1((uint8_t *)src_data, src_len, temp_data_src, &temp_len_src);
|
||||
if (ret != CRYPTO_SUCCESS)
|
||||
goto release;
|
||||
int32_t rc = sm2_decrypt(ec_key, EVP_sm3(), temp_data_src, temp_len_src, dest_data, &temp_len);
|
||||
int32_t rc;
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
rc = ossl_sm2_decrypt(ec_key, EVP_sm3(), temp_data_src, temp_len_src, dest_data, &temp_len);
|
||||
#else
|
||||
rc = sm2_decrypt(ec_key, EVP_sm3(), temp_data_src, temp_len_src, dest_data, &temp_len);
|
||||
#endif
|
||||
bool check = (rc != GMSSL_OK || *dest_len < temp_len || temp_len > UINT32_MAX);
|
||||
if (check) {
|
||||
tloge("SM2 decrypt failed,rc = %d, temp_len = %u, dest_len = %u\n", rc, temp_len, *dest_len);
|
||||
@@ -1133,7 +1158,12 @@ static int32_t sm2_decrypt_old(const EC_KEY *ec_key, const void *src_data, uint3
|
||||
}
|
||||
|
||||
size_t temp_dest_len = *dest_len;
|
||||
int32_t rc = sm2_decrypt(ec_key, EVP_sm3(), src_data, src_len, dest_data, &temp_dest_len);
|
||||
int32_t rc;
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
rc = ossl_sm2_decrypt(ec_key, EVP_sm3(), src_data, src_len, dest_data, &temp_dest_len);
|
||||
#else
|
||||
rc = sm2_decrypt(ec_key, EVP_sm3(), src_data, src_len, dest_data, &temp_dest_len);
|
||||
#endif
|
||||
bool check = (rc != GMSSL_OK || temp_dest_len > UINT32_MAX);
|
||||
if (check) {
|
||||
tloge("SM2 decrypt failed\n");
|
||||
@@ -1188,270 +1218,6 @@ int32_t sm2_encrypt_decypt(const void *sm2_key, uint32_t mode,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static TEE_Result sm4_cipher_init_params_check(uint32_t alg_type, const struct memref_t *iv)
|
||||
{
|
||||
bool check = (alg_type == TEE_ALG_SM4_CTR) || (alg_type == TEE_ALG_SM4_CBC_NOPAD) ||
|
||||
(alg_type == TEE_ALG_SM4_CFB128) || (alg_type == TEE_ALG_SM4_CBC_PKCS7) ||
|
||||
(alg_type == TEE_ALG_SM4_GCM);
|
||||
if (check) {
|
||||
bool check_iv = (iv == NULL || iv->buffer == 0 || iv->size == 0);
|
||||
if (check_iv) {
|
||||
tloge("IV is NULL, please set IV first\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t sm4_cbc_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_cbc(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_cbc(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_ecb_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_ecb(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_ecb(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_ctr_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_ctr(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_ctr(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_cfb_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx,
|
||||
const uint8_t *key_buffer, const uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_cfb128(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_cfb128(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_do_encrypt_init(EVP_CIPHER_CTX *ctx, uint32_t alg_type, uint32_t direction,
|
||||
const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
uint8_t *iv_buffer = NULL;
|
||||
bool check = (alg_type == TEE_ALG_SM4_CBC_NOPAD || alg_type == TEE_ALG_SM4_CTR) ||
|
||||
(alg_type == TEE_ALG_SM4_CBC_PKCS7) || (alg_type == TEE_ALG_SM4_CFB128);
|
||||
if (check)
|
||||
iv_buffer = (uint8_t *)(uintptr_t)(iv->buffer);
|
||||
uint8_t *key_buffer = (uint8_t *)(uintptr_t)(key->key_buffer);
|
||||
|
||||
switch (alg_type) {
|
||||
case TEE_ALG_SM4_CBC_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_PKCS7:
|
||||
return sm4_cbc_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_ECB_NOPAD:
|
||||
return sm4_ecb_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_CTR:
|
||||
return sm4_ctr_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_CFB128:
|
||||
return sm4_cfb_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
default:
|
||||
return GMSSL_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
void *tee_sm4_cipher_init(uint32_t alg_type, uint32_t direction,
|
||||
const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
int32_t ret;
|
||||
TEE_Result ret_c;
|
||||
bool check = (key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check) {
|
||||
tloge("keybuf is NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret_c = sm4_cipher_init_params_check(alg_type, iv);
|
||||
if (ret_c != CRYPTO_SUCCESS) {
|
||||
tloge("check iv failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
if (ctx == NULL) {
|
||||
tloge("New SM4 ctx failed");
|
||||
return NULL;
|
||||
}
|
||||
ret = EVP_CIPHER_CTX_reset(ctx);
|
||||
if (ret != 1) {
|
||||
tloge("init SM4 ctx failed\n");
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = sm4_do_encrypt_init(ctx, alg_type, direction, key, iv);
|
||||
if (ret != 1)
|
||||
goto exit;
|
||||
|
||||
if (alg_type == TEE_ALG_SM4_CBC_PKCS7)
|
||||
(void)EVP_CIPHER_CTX_set_padding(ctx, EVP_PADDING_PKCS7);
|
||||
else
|
||||
(void)EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||
return ctx;
|
||||
|
||||
exit:
|
||||
tloge("EVP sm4 cipher init failed\n");
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_init(struct ctx_handle_t *ctx, const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
bool check = (ctx == NULL || key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check) {
|
||||
tloge("input is null\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
void *sm4_ctx = tee_sm4_cipher_init(ctx->alg_type, ctx->direction, key, iv);
|
||||
if (sm4_ctx == NULL) {
|
||||
tloge("sm4 init failed");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)sm4_ctx;
|
||||
ctx->free_context = free_sm4_context;
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t sm4_update_params_check(uint32_t alg_type, uint32_t src_len, uint32_t dest_len)
|
||||
{
|
||||
if (alg_type == TEE_ALG_SM4_CBC_PKCS7)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
bool check = (alg_type == TEE_ALG_SM4_ECB_NOPAD) || (alg_type == TEE_ALG_SM4_CBC_NOPAD);
|
||||
if (check) {
|
||||
if ((src_len % SM4_BLOCK) != 0) {
|
||||
tloge("DataSize should be 16 bytes aligned!");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
if (dest_len < src_len || dest_len == 0) {
|
||||
tloge("output buffer is too small\n");
|
||||
return CRYPTO_SHORT_BUFFER;
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t tee_sm4_update(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
EVP_CIPHER_CTX *sm4_ctx = (EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer;
|
||||
if (sm4_ctx == NULL) {
|
||||
tloge("The sm4 cipher ctx is null");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
uint8_t *in_buffer = (uint8_t *)(uintptr_t)data_in->buffer;
|
||||
uint8_t *out_buffer = (uint8_t *)(uintptr_t)data_out->buffer;
|
||||
|
||||
ret = sm4_update_params_check(ctx->alg_type, data_in->size, data_out->size);
|
||||
if (ret != CRYPTO_SUCCESS) {
|
||||
tloge("sm4 update parameter check failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (data_out->size > INT32_MAX) {
|
||||
tloge("data out size is too long\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
int32_t temp_dest_len = (int32_t)data_out->size;
|
||||
if (ctx->direction == ENC_MODE)
|
||||
ret = EVP_EncryptUpdate(sm4_ctx, out_buffer, &temp_dest_len, in_buffer, data_in->size);
|
||||
else
|
||||
ret = EVP_DecryptUpdate(sm4_ctx, out_buffer, &temp_dest_len, in_buffer, data_in->size);
|
||||
if (ret != GMSSL_OK || temp_dest_len < 0) {
|
||||
tloge("sm4 cipher update failed\n");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
data_out->size = (uint32_t)temp_dest_len;
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_update(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
bool check = (ctx == NULL || data_in == NULL || data_out == NULL ||
|
||||
((ctx->alg_type != TEE_ALG_SM4_CBC_PKCS7 || ctx->direction == ENC_MODE) && data_out->size < data_in->size));
|
||||
if (check) {
|
||||
tloge("input is null\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
return tee_sm4_update(ctx, data_in, data_out);
|
||||
}
|
||||
|
||||
static int32_t tee_sm4_do_final(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t update_len = 0;
|
||||
uint32_t temp_len = data_out->size;
|
||||
if (data_in->buffer != 0 && data_in->size != 0) {
|
||||
ret = tee_sm4_update(ctx, data_in, data_out);
|
||||
if (ret != CRYPTO_SUCCESS) {
|
||||
tloge("sm4 update last block failed");
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(ctx->ctx_buffer));
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
update_len = (int32_t)data_out->size;
|
||||
}
|
||||
|
||||
uint8_t *out_buffer = (uint8_t *)(uintptr_t)data_out->buffer;
|
||||
int32_t final_len = temp_len - update_len;
|
||||
if (ctx->direction == ENC_MODE)
|
||||
ret = EVP_EncryptFinal_ex((EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer,
|
||||
out_buffer + update_len, &final_len);
|
||||
else
|
||||
ret = EVP_DecryptFinal_ex((EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer,
|
||||
out_buffer + update_len, &final_len);
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(ctx->ctx_buffer));
|
||||
ctx->ctx_buffer = 0;
|
||||
if (ret != 1) {
|
||||
tloge("sm4 cipher final failed\n");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
if (update_len > INT32_MAX - final_len) {
|
||||
tloge("final len is invalid");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
data_out->size = (uint32_t)(update_len + final_len);
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_do_final(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
bool check = (ctx == NULL || data_in == NULL || data_out == NULL || data_out->buffer == 0 ||
|
||||
data_out->size == 0 || data_out->size < data_in->size);
|
||||
if (check) {
|
||||
tloge("bad parameters\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
return tee_sm4_do_final(ctx, data_in, data_out);
|
||||
}
|
||||
|
||||
static int32_t gen_sm2_key(sm2_key_pair **key_pair, uint32_t curve)
|
||||
{
|
||||
*key_pair = TEE_Malloc(sizeof(sm2_key_pair), 0);
|
||||
@@ -1552,298 +1318,3 @@ int32_t sm2_generate_keypair(uint32_t key_size, uint32_t curve,
|
||||
return sm2_gen_keypair_old(key_size, curve, public_key, private_key);
|
||||
}
|
||||
|
||||
int32_t sm3_mac_init(struct ctx_handle_t *ctx, const struct symmerit_key_t *key)
|
||||
{
|
||||
bool check = (ctx == NULL || key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
HMAC_CTX *hmac_ctx = HMAC_CTX_new();
|
||||
if (hmac_ctx == NULL) {
|
||||
tloge("malloc failed!\n");
|
||||
return get_soft_crypto_error(CRYPTO_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (HMAC_Init(hmac_ctx, (const unsigned char *)(uintptr_t)(key->key_buffer), key->key_size, EVP_sm3()) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
HMAC_CTX_free(hmac_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
}
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)hmac_ctx;
|
||||
ctx->ctx_size = sizeof(*hmac_ctx);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm3_mac_update(struct ctx_handle_t *ctx, const struct memref_t *data_in)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0 || data_in == NULL ||
|
||||
data_in->buffer == 0 || data_in->size == 0);
|
||||
if (check) {
|
||||
tloge("bad params\n");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (HMAC_Update((HMAC_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(const unsigned char *)(uintptr_t)(data_in->buffer), data_in->size) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
return CRYPTO_SUCCESS;
|
||||
out:
|
||||
if (ctx != NULL) {
|
||||
HMAC_CTX_free((HMAC_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_mac_computefinal(struct ctx_handle_t *ctx, struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
if (ctx == NULL || ctx->ctx_buffer == 0)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
bool check = (data_out == NULL || data_out->buffer == 0 || data_out->size < SM3_DIGEST_LENGTH);
|
||||
if (check) {
|
||||
tloge("context is NULL");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
uint32_t out_len = 0;
|
||||
if (HMAC_Final((HMAC_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(unsigned char *)(uintptr_t)data_out->buffer, &out_len) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
|
||||
data_out->size = out_len;
|
||||
ret = CRYPTO_SUCCESS;
|
||||
out:
|
||||
HMAC_CTX_free((HMAC_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_init(struct ctx_handle_t *ctx)
|
||||
{
|
||||
if (ctx == NULL)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
EVP_MD_CTX *sm3_ctx = EVP_MD_CTX_new();
|
||||
if (sm3_ctx == NULL) {
|
||||
tloge("malloc context failed!\n");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (EVP_DigestInit(sm3_ctx, EVP_sm3()) == 0) {
|
||||
tloge("sm3 init failed");
|
||||
EVP_MD_CTX_free(sm3_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
}
|
||||
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)sm3_ctx;
|
||||
ctx->ctx_size = sizeof(*sm3_ctx);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_update(struct ctx_handle_t *ctx, const struct memref_t *data_in)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0 || data_in == NULL ||
|
||||
data_in->buffer == 0 || data_in->size == 0);
|
||||
if (check) {
|
||||
tloge("Invalid params\n");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (EVP_DigestUpdate((EVP_MD_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(const unsigned char *)(uintptr_t)data_in->buffer, (size_t)data_in->size) == 0) {
|
||||
tloge("sm3 hash update failed");
|
||||
ret = CRYPTO_MAC_INVALID;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
out:
|
||||
if (ctx != NULL) {
|
||||
TEE_Free((void *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_dofinal(struct ctx_handle_t *ctx, struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
check = (data_out == NULL || data_out->buffer == 0 || data_out->size < SM3_DIGEST_LENGTH);
|
||||
if (check) {
|
||||
tloge("context is NULL");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (EVP_DigestFinal((EVP_MD_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(unsigned char *)(uintptr_t)(data_out->buffer), NULL) == 0) {
|
||||
tloge("do sm3 hash failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
data_out->size = SM3_DIGEST_LENGTH;
|
||||
|
||||
ret = CRYPTO_SUCCESS;
|
||||
|
||||
out:
|
||||
EVP_MD_CTX_free((EVP_MD_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int32_t copy_sm_buf_info(uint64_t *dst_buf, const uint64_t src_buf, uint32_t src_size)
|
||||
{
|
||||
TEE_Free((void *)(uintptr_t)*dst_buf);
|
||||
*dst_buf = 0;
|
||||
bool check = ((src_buf == 0) || (src_size == 0));
|
||||
if (check)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
*dst_buf = (uint64_t)(uintptr_t)TEE_Malloc(src_size, TEE_MALLOC_FILL_ZERO);
|
||||
if (*dst_buf == 0) {
|
||||
tloge("dst_buf malloc failed\n");
|
||||
return CRYPTO_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)memcpy_s((void *)(uintptr_t)*dst_buf, src_size, (void *)(uintptr_t)src_buf, src_size);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t copy_sm4_operation(struct ctx_handle_t *dest, const struct ctx_handle_t *src)
|
||||
{
|
||||
if (dest == NULL || src == NULL)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
if (dest->ctx_buffer != 0) {
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(dest->ctx_buffer));
|
||||
dest->ctx_buffer = 0;
|
||||
}
|
||||
if (src->ctx_buffer == 0)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
EVP_CIPHER_CTX *new_ctx = EVP_CIPHER_CTX_new();
|
||||
if (new_ctx == NULL) {
|
||||
tloge("New aes ctx failed");
|
||||
return CRYPTO_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
int32_t ret = EVP_CIPHER_CTX_copy(new_ctx, (EVP_CIPHER_CTX *)(uintptr_t)(src->ctx_buffer));
|
||||
if (ret != GMSSL_OK) {
|
||||
tloge("Copy aes ctx failed");
|
||||
EVP_CIPHER_CTX_free(new_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
dest->ctx_buffer = (uint64_t)(uintptr_t)new_ctx;
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t soft_copy_gmssl_info(struct ctx_handle_t *dest, const struct ctx_handle_t *src)
|
||||
{
|
||||
bool check = (dest == NULL || src == NULL);
|
||||
if (check) {
|
||||
tloge("Invalid params!\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
switch (src->alg_type) {
|
||||
case TEE_ALG_SM3:
|
||||
return copy_sm_buf_info(&(dest->ctx_buffer), src->ctx_buffer, sizeof(EVP_MD_CTX));
|
||||
case TEE_ALG_HMAC_SM3:
|
||||
return copy_sm_buf_info(&(dest->ctx_buffer), src->ctx_buffer, sizeof(HMAC_CTX));
|
||||
case TEE_ALG_SM4_ECB_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_PKCS7:
|
||||
case TEE_ALG_SM4_CTR:
|
||||
case TEE_ALG_SM4_CFB128:
|
||||
case TEE_ALG_SM4_GCM:
|
||||
return copy_sm4_operation(dest, src);
|
||||
default:
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
void free_sm4_context(uint64_t *ctx)
|
||||
{
|
||||
bool check = (ctx == NULL || *ctx == 0);
|
||||
if (check) {
|
||||
tloge("Invalid params!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(*ctx));
|
||||
*ctx = 0;
|
||||
}
|
||||
|
||||
int32_t crypto_sm3_hash(const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
bool check = (data_in == NULL || data_out == NULL);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
struct ctx_handle_t ctx;
|
||||
int32_t rc = sm3_digest_init(&ctx);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hash init failed");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_digest_update(&ctx, data_in);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 update failed");
|
||||
TEE_Free((void *)(uintptr_t)(ctx.ctx_buffer));
|
||||
return rc;
|
||||
}
|
||||
rc = sm3_digest_dofinal(&ctx, data_out);
|
||||
if (rc != CRYPTO_SUCCESS)
|
||||
tloge("sm3 dofinal failed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int32_t crypto_sm3_hmac(const struct symmerit_key_t *key, const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
bool check = (key == NULL || data_in == NULL || data_out == NULL);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
struct ctx_handle_t ctx = {0};
|
||||
|
||||
int32_t rc = sm3_mac_init(&ctx, key);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hmac init failed");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_mac_update(&ctx, data_in);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hmac init failed");
|
||||
TEE_Free((void *)(uintptr_t)(ctx.ctx_buffer));
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_mac_computefinal(&ctx, data_out);
|
||||
if (rc != CRYPTO_SUCCESS)
|
||||
tloge("sm3 hmac dofinal failed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,585 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "soft_gmssl.h"
|
||||
#include "gmssl_internal.h"
|
||||
#include "soft_err.h"
|
||||
#include <securec.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <hmac/hmac_local.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <evp/evp_local.h>
|
||||
#include <tee_log.h>
|
||||
#include <tee_crypto_api.h>
|
||||
#include <tee_property_inner.h>
|
||||
#include "crypto_inner_defines.h"
|
||||
|
||||
#ifdef CRYPTO_SUPPORT_SOFT_SM4
|
||||
static TEE_Result sm4_cipher_init_params_check(uint32_t alg_type, const struct memref_t *iv)
|
||||
{
|
||||
bool check = (alg_type == TEE_ALG_SM4_CTR) || (alg_type == TEE_ALG_SM4_CBC_NOPAD) ||
|
||||
(alg_type == TEE_ALG_SM4_CFB128) || (alg_type == TEE_ALG_SM4_CBC_PKCS7) ||
|
||||
(alg_type == TEE_ALG_SM4_GCM);
|
||||
if (check) {
|
||||
bool check_iv = (iv == NULL || iv->buffer == 0 || iv->size == 0);
|
||||
if (check_iv) {
|
||||
tloge("IV is NULL, please set IV first\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t sm4_cbc_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_cbc(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_cbc(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_ecb_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_ecb(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_ecb(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_ctr_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx, uint8_t *key_buffer, uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_ctr(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_ctr(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_cfb_encrypt_init(uint32_t direction, EVP_CIPHER_CTX *ctx,
|
||||
const uint8_t *key_buffer, const uint8_t *iv_buffer)
|
||||
{
|
||||
if (direction == ENC_MODE)
|
||||
return EVP_EncryptInit_ex(ctx, EVP_sm4_cfb128(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
return EVP_DecryptInit_ex(ctx, EVP_sm4_cfb128(), NULL, key_buffer,
|
||||
(unsigned char *)iv_buffer);
|
||||
}
|
||||
|
||||
static int32_t sm4_do_encrypt_init(EVP_CIPHER_CTX *ctx, uint32_t alg_type, uint32_t direction,
|
||||
const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
uint8_t *iv_buffer = NULL;
|
||||
bool check = (alg_type == TEE_ALG_SM4_CBC_NOPAD || alg_type == TEE_ALG_SM4_CTR) ||
|
||||
(alg_type == TEE_ALG_SM4_CBC_PKCS7) || (alg_type == TEE_ALG_SM4_CFB128);
|
||||
if (check)
|
||||
iv_buffer = (uint8_t *)(uintptr_t)(iv->buffer);
|
||||
uint8_t *key_buffer = (uint8_t *)(uintptr_t)(key->key_buffer);
|
||||
|
||||
switch (alg_type) {
|
||||
case TEE_ALG_SM4_CBC_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_PKCS7:
|
||||
return sm4_cbc_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_ECB_NOPAD:
|
||||
return sm4_ecb_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_CTR:
|
||||
return sm4_ctr_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
case TEE_ALG_SM4_CFB128:
|
||||
return sm4_cfb_encrypt_init(direction, ctx, key_buffer, iv_buffer);
|
||||
default:
|
||||
return GMSSL_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
void *tee_sm4_cipher_init(uint32_t alg_type, uint32_t direction,
|
||||
const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
int32_t ret;
|
||||
TEE_Result ret_c;
|
||||
bool check = (key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check) {
|
||||
tloge("keybuf is NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret_c = sm4_cipher_init_params_check(alg_type, iv);
|
||||
if (ret_c != CRYPTO_SUCCESS) {
|
||||
tloge("check iv failed\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
|
||||
if (ctx == NULL) {
|
||||
tloge("New SM4 ctx failed");
|
||||
return NULL;
|
||||
}
|
||||
ret = EVP_CIPHER_CTX_reset(ctx);
|
||||
if (ret != 1) {
|
||||
tloge("init SM4 ctx failed\n");
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = sm4_do_encrypt_init(ctx, alg_type, direction, key, iv);
|
||||
if (ret != 1)
|
||||
goto exit;
|
||||
|
||||
if (alg_type == TEE_ALG_SM4_CBC_PKCS7)
|
||||
(void)EVP_CIPHER_CTX_set_padding(ctx, EVP_PADDING_PKCS7);
|
||||
else
|
||||
(void)EVP_CIPHER_CTX_set_padding(ctx, 0);
|
||||
return ctx;
|
||||
|
||||
exit:
|
||||
tloge("EVP sm4 cipher init failed\n");
|
||||
EVP_CIPHER_CTX_free(ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_init(struct ctx_handle_t *ctx, const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
bool check = (ctx == NULL || key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check) {
|
||||
tloge("input is null\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
void *sm4_ctx = tee_sm4_cipher_init(ctx->alg_type, ctx->direction, key, iv);
|
||||
if (sm4_ctx == NULL) {
|
||||
tloge("sm4 init failed");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)sm4_ctx;
|
||||
ctx->free_context = free_sm4_context;
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t sm4_update_params_check(uint32_t alg_type, uint32_t src_len, uint32_t dest_len)
|
||||
{
|
||||
if (alg_type == TEE_ALG_SM4_CBC_PKCS7)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
bool check = (alg_type == TEE_ALG_SM4_ECB_NOPAD) || (alg_type == TEE_ALG_SM4_CBC_NOPAD);
|
||||
if (check) {
|
||||
if ((src_len % SM4_BLOCK) != 0) {
|
||||
tloge("DataSize should be 16 bytes aligned!");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
}
|
||||
|
||||
if (dest_len < src_len || dest_len == 0) {
|
||||
tloge("output buffer is too small\n");
|
||||
return CRYPTO_SHORT_BUFFER;
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t tee_sm4_update(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
|
||||
EVP_CIPHER_CTX *sm4_ctx = (EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer;
|
||||
if (sm4_ctx == NULL) {
|
||||
tloge("The sm4 cipher ctx is null");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
uint8_t *in_buffer = (uint8_t *)(uintptr_t)data_in->buffer;
|
||||
uint8_t *out_buffer = (uint8_t *)(uintptr_t)data_out->buffer;
|
||||
|
||||
ret = sm4_update_params_check(ctx->alg_type, data_in->size, data_out->size);
|
||||
if (ret != CRYPTO_SUCCESS) {
|
||||
tloge("sm4 update parameter check failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (data_out->size > INT32_MAX) {
|
||||
tloge("data out size is too long\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
int32_t temp_dest_len = (int32_t)data_out->size;
|
||||
if (ctx->direction == ENC_MODE)
|
||||
ret = EVP_EncryptUpdate(sm4_ctx, out_buffer, &temp_dest_len, in_buffer, data_in->size);
|
||||
else
|
||||
ret = EVP_DecryptUpdate(sm4_ctx, out_buffer, &temp_dest_len, in_buffer, data_in->size);
|
||||
if (ret != GMSSL_OK || temp_dest_len < 0) {
|
||||
tloge("sm4 cipher update failed\n");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
data_out->size = (uint32_t)temp_dest_len;
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_update(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
bool check = (ctx == NULL || data_in == NULL || data_out == NULL ||
|
||||
((ctx->alg_type != TEE_ALG_SM4_CBC_PKCS7 || ctx->direction == ENC_MODE) && data_out->size < data_in->size));
|
||||
if (check) {
|
||||
tloge("input is null\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
return tee_sm4_update(ctx, data_in, data_out);
|
||||
}
|
||||
|
||||
static int32_t tee_sm4_do_final(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t update_len = 0;
|
||||
uint32_t temp_len = data_out->size;
|
||||
if (data_in->buffer != 0 && data_in->size != 0) {
|
||||
ret = tee_sm4_update(ctx, data_in, data_out);
|
||||
if (ret != CRYPTO_SUCCESS) {
|
||||
tloge("sm4 update last block failed");
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(ctx->ctx_buffer));
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
update_len = (int32_t)data_out->size;
|
||||
}
|
||||
|
||||
uint8_t *out_buffer = (uint8_t *)(uintptr_t)data_out->buffer;
|
||||
int32_t final_len = temp_len - update_len;
|
||||
if (ctx->direction == ENC_MODE)
|
||||
ret = EVP_EncryptFinal_ex((EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer,
|
||||
out_buffer + update_len, &final_len);
|
||||
else
|
||||
ret = EVP_DecryptFinal_ex((EVP_CIPHER_CTX *)(uintptr_t)ctx->ctx_buffer,
|
||||
out_buffer + update_len, &final_len);
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(ctx->ctx_buffer));
|
||||
ctx->ctx_buffer = 0;
|
||||
if (ret != 1) {
|
||||
tloge("sm4 cipher final failed\n");
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
if (update_len > INT32_MAX - final_len) {
|
||||
tloge("final len is invalid");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
data_out->size = (uint32_t)(update_len + final_len);
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_do_final(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
bool check = (ctx == NULL || data_in == NULL || data_out == NULL || data_out->buffer == 0 ||
|
||||
data_out->size == 0 || data_out->size < data_in->size);
|
||||
if (check) {
|
||||
tloge("bad parameters\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
return tee_sm4_do_final(ctx, data_in, data_out);
|
||||
}
|
||||
#endif // CRYPTO_SUPPORT_SOFT_SM4
|
||||
|
||||
int32_t sm3_mac_init(struct ctx_handle_t *ctx, const struct symmerit_key_t *key)
|
||||
{
|
||||
bool check = (ctx == NULL || key == NULL || key->key_buffer == 0 || key->key_size == 0);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
HMAC_CTX *hmac_ctx = HMAC_CTX_new();
|
||||
if (hmac_ctx == NULL) {
|
||||
tloge("malloc failed!\n");
|
||||
return get_soft_crypto_error(CRYPTO_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
if (HMAC_Init(hmac_ctx, (const unsigned char *)(uintptr_t)(key->key_buffer), key->key_size, EVP_sm3()) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
HMAC_CTX_free(hmac_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
}
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)hmac_ctx;
|
||||
ctx->ctx_size = sizeof(*hmac_ctx);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm3_mac_update(struct ctx_handle_t *ctx, const struct memref_t *data_in)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0 || data_in == NULL ||
|
||||
data_in->buffer == 0 || data_in->size == 0);
|
||||
if (check) {
|
||||
tloge("bad params\n");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (HMAC_Update((HMAC_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(const unsigned char *)(uintptr_t)(data_in->buffer), data_in->size) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
return CRYPTO_SUCCESS;
|
||||
out:
|
||||
if (ctx != NULL) {
|
||||
HMAC_CTX_free((HMAC_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_mac_computefinal(struct ctx_handle_t *ctx, struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
if (ctx == NULL || ctx->ctx_buffer == 0)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
bool check = (data_out == NULL || data_out->buffer == 0 || data_out->size < SM3_DIGEST_LENGTH);
|
||||
if (check) {
|
||||
tloge("context is NULL");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
uint32_t out_len = 0;
|
||||
if (HMAC_Final((HMAC_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(unsigned char *)(uintptr_t)data_out->buffer, &out_len) == 0) {
|
||||
tloge("sm3 hmac failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
|
||||
data_out->size = out_len;
|
||||
ret = CRYPTO_SUCCESS;
|
||||
out:
|
||||
HMAC_CTX_free((HMAC_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_init(struct ctx_handle_t *ctx)
|
||||
{
|
||||
if (ctx == NULL)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
EVP_MD_CTX *sm3_ctx = EVP_MD_CTX_new();
|
||||
if (sm3_ctx == NULL) {
|
||||
tloge("malloc context failed!\n");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if (EVP_DigestInit(sm3_ctx, EVP_sm3()) == 0) {
|
||||
tloge("sm3 init failed");
|
||||
EVP_MD_CTX_free(sm3_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
}
|
||||
|
||||
ctx->ctx_buffer = (uint64_t)(uintptr_t)sm3_ctx;
|
||||
ctx->ctx_size = sizeof(*sm3_ctx);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_update(struct ctx_handle_t *ctx, const struct memref_t *data_in)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0 || data_in == NULL ||
|
||||
data_in->buffer == 0 || data_in->size == 0);
|
||||
if (check) {
|
||||
tloge("Invalid params\n");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (EVP_DigestUpdate((EVP_MD_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(const unsigned char *)(uintptr_t)data_in->buffer, (size_t)data_in->size) == 0) {
|
||||
tloge("sm3 hash update failed");
|
||||
ret = CRYPTO_MAC_INVALID;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
out:
|
||||
if (ctx != NULL) {
|
||||
TEE_Free((void *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t sm3_digest_dofinal(struct ctx_handle_t *ctx, struct memref_t *data_out)
|
||||
{
|
||||
int32_t ret;
|
||||
bool check = (ctx == NULL || ctx->ctx_buffer == 0);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
check = (data_out == NULL || data_out->buffer == 0 || data_out->size < SM3_DIGEST_LENGTH);
|
||||
if (check) {
|
||||
tloge("context is NULL");
|
||||
ret = CRYPTO_BAD_PARAMETERS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (EVP_DigestFinal((EVP_MD_CTX *)(uintptr_t)(ctx->ctx_buffer),
|
||||
(unsigned char *)(uintptr_t)(data_out->buffer), NULL) == 0) {
|
||||
tloge("do sm3 hash failed");
|
||||
ret = get_soft_crypto_error(CRYPTO_MAC_INVALID);
|
||||
goto out;
|
||||
}
|
||||
data_out->size = SM3_DIGEST_LENGTH;
|
||||
|
||||
ret = CRYPTO_SUCCESS;
|
||||
|
||||
out:
|
||||
EVP_MD_CTX_free((EVP_MD_CTX *)(uintptr_t)ctx->ctx_buffer);
|
||||
ctx->ctx_buffer = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int32_t copy_sm_buf_info(uint64_t *dst_buf, const uint64_t src_buf, uint32_t src_size)
|
||||
{
|
||||
TEE_Free((void *)(uintptr_t)*dst_buf);
|
||||
*dst_buf = 0;
|
||||
bool check = ((src_buf == 0) || (src_size == 0));
|
||||
if (check)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
*dst_buf = (uint64_t)(uintptr_t)TEE_Malloc(src_size, TEE_MALLOC_FILL_ZERO);
|
||||
if (*dst_buf == 0) {
|
||||
tloge("dst_buf malloc failed\n");
|
||||
return CRYPTO_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
(void)memcpy_s((void *)(uintptr_t)*dst_buf, src_size, (void *)(uintptr_t)src_buf, src_size);
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
static int32_t copy_sm4_operation(struct ctx_handle_t *dest, const struct ctx_handle_t *src)
|
||||
{
|
||||
if (dest == NULL || src == NULL)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
if (dest->ctx_buffer != 0) {
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(dest->ctx_buffer));
|
||||
dest->ctx_buffer = 0;
|
||||
}
|
||||
if (src->ctx_buffer == 0)
|
||||
return CRYPTO_SUCCESS;
|
||||
|
||||
EVP_CIPHER_CTX *new_ctx = EVP_CIPHER_CTX_new();
|
||||
if (new_ctx == NULL) {
|
||||
tloge("New aes ctx failed");
|
||||
return CRYPTO_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
int32_t ret = EVP_CIPHER_CTX_copy(new_ctx, (EVP_CIPHER_CTX *)(uintptr_t)(src->ctx_buffer));
|
||||
if (ret != GMSSL_OK) {
|
||||
tloge("Copy aes ctx failed");
|
||||
EVP_CIPHER_CTX_free(new_ctx);
|
||||
return get_soft_crypto_error(CRYPTO_BAD_PARAMETERS);
|
||||
}
|
||||
dest->ctx_buffer = (uint64_t)(uintptr_t)new_ctx;
|
||||
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t soft_copy_gmssl_info(struct ctx_handle_t *dest, const struct ctx_handle_t *src)
|
||||
{
|
||||
bool check = (dest == NULL || src == NULL);
|
||||
if (check) {
|
||||
tloge("Invalid params!\n");
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
}
|
||||
|
||||
switch (src->alg_type) {
|
||||
case TEE_ALG_SM3:
|
||||
return copy_sm_buf_info(&(dest->ctx_buffer), src->ctx_buffer, sizeof(EVP_MD_CTX));
|
||||
case TEE_ALG_HMAC_SM3:
|
||||
return copy_sm_buf_info(&(dest->ctx_buffer), src->ctx_buffer, sizeof(HMAC_CTX));
|
||||
case TEE_ALG_SM4_ECB_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_NOPAD:
|
||||
case TEE_ALG_SM4_CBC_PKCS7:
|
||||
case TEE_ALG_SM4_CTR:
|
||||
case TEE_ALG_SM4_CFB128:
|
||||
case TEE_ALG_SM4_GCM:
|
||||
return copy_sm4_operation(dest, src);
|
||||
default:
|
||||
return CRYPTO_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
void free_sm4_context(uint64_t *ctx)
|
||||
{
|
||||
bool check = (ctx == NULL || *ctx == 0);
|
||||
if (check) {
|
||||
tloge("Invalid params!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)(uintptr_t)(*ctx));
|
||||
*ctx = 0;
|
||||
}
|
||||
|
||||
int32_t crypto_sm3_hash(const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
bool check = (data_in == NULL || data_out == NULL);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
struct ctx_handle_t ctx;
|
||||
int32_t rc = sm3_digest_init(&ctx);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hash init failed");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_digest_update(&ctx, data_in);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 update failed");
|
||||
TEE_Free((void *)(uintptr_t)(ctx.ctx_buffer));
|
||||
return rc;
|
||||
}
|
||||
rc = sm3_digest_dofinal(&ctx, data_out);
|
||||
if (rc != CRYPTO_SUCCESS)
|
||||
tloge("sm3 dofinal failed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int32_t crypto_sm3_hmac(const struct symmerit_key_t *key, const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
bool check = (key == NULL || data_in == NULL || data_out == NULL);
|
||||
if (check)
|
||||
return CRYPTO_BAD_PARAMETERS;
|
||||
|
||||
struct ctx_handle_t ctx = {0};
|
||||
|
||||
int32_t rc = sm3_mac_init(&ctx, key);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hmac init failed");
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_mac_update(&ctx, data_in);
|
||||
if (rc != CRYPTO_SUCCESS) {
|
||||
tloge("sm3 hmac init failed");
|
||||
TEE_Free((void *)(uintptr_t)(ctx.ctx_buffer));
|
||||
return get_soft_crypto_error(CRYPTO_ERROR_SECURITY);
|
||||
}
|
||||
|
||||
rc = sm3_mac_computefinal(&ctx, data_out);
|
||||
if (rc != CRYPTO_SUCCESS)
|
||||
tloge("sm3 hmac dofinal failed");
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -11,12 +11,17 @@
|
||||
*/
|
||||
#include "soft_hmac.h"
|
||||
#include <openssl/hmac.h>
|
||||
#ifdef OPENSSL_ENABLE
|
||||
#include <crypto/siphash.h>
|
||||
#include <siphash/siphash_local.h>
|
||||
#elif defined OPENSSL3_ENABLE
|
||||
#include <crypto/siphash.h>
|
||||
#endif
|
||||
#include <tee_log.h>
|
||||
#include "soft_gmssl.h"
|
||||
#include "soft_common_api.h"
|
||||
#include "soft_err.h"
|
||||
#include "crypto_inner_defines.h"
|
||||
|
||||
static const uint32_t g_algorithm_hmac[] = {
|
||||
CRYPTO_TYPE_HMAC_MD5,
|
||||
|
||||
@@ -390,7 +390,7 @@ int32_t tee_crypto_generate_random(void *buffer, uint32_t size, bool is_hw_rand)
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_ENABLE
|
||||
void tee_crypto_free_opensssl_drbg(void)
|
||||
void tee_crypto_free_openssl_drbg(void)
|
||||
{
|
||||
free_openssl_drbg_mem();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "soft_ec_api.h"
|
||||
#include "crypto_inner_interface.h"
|
||||
#include "soft_common_api.h"
|
||||
|
||||
int32_t soft_crypto_ecc_generate_keypair(uint32_t key_size, uint32_t curve,
|
||||
struct ecc_pub_key_t *public_key, struct ecc_priv_key_t *private_key)
|
||||
{
|
||||
(void)key_size;
|
||||
(void)curve;
|
||||
(void)public_key;
|
||||
(void)private_key;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int32_t soft_crypto_ecc_encrypt(uint32_t alg_type, const struct ecc_pub_key_t *public_key,
|
||||
const struct asymmetric_params_t *ec_params, const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
(void)alg_type;
|
||||
(void)public_key;
|
||||
(void)ec_params;
|
||||
(void)data_in;
|
||||
(void)data_out;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
int32_t soft_crypto_ecc_decrypt(uint32_t alg_type, const struct ecc_priv_key_t *private_key,
|
||||
const struct asymmetric_params_t *ec_params, const struct memref_t *data_in, struct memref_t *data_out)
|
||||
{
|
||||
(void)alg_type;
|
||||
(void)private_key;
|
||||
(void)ec_params;
|
||||
(void)data_in;
|
||||
(void)data_out;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int32_t soft_crypto_ecc_sign_digest(uint32_t alg_type, const struct ecc_priv_key_t *private_key,
|
||||
const struct asymmetric_params_t *ec_params, const struct memref_t *digest,
|
||||
struct memref_t *signature)
|
||||
{
|
||||
(void)alg_type;
|
||||
(void)private_key;
|
||||
(void)ec_params;
|
||||
(void)digest;
|
||||
(void)signature;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int32_t soft_crypto_ecc_verify_digest(uint32_t alg_type, const struct ecc_pub_key_t *public_key,
|
||||
const struct asymmetric_params_t *ec_params, const struct memref_t *digest,
|
||||
const struct memref_t *signature)
|
||||
{
|
||||
(void)alg_type;
|
||||
(void)public_key;
|
||||
(void)ec_params;
|
||||
(void)digest;
|
||||
(void)signature;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
#include "../boringssl/soft_gmssl.h"
|
||||
|
||||
int32_t sm4_cipher_init(struct ctx_handle_t *ctx, const struct symmerit_key_t *key, const struct memref_t *iv)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)key;
|
||||
(void)iv;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_update(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)data_in;
|
||||
(void)data_out;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
int32_t sm4_cipher_do_final(struct ctx_handle_t *ctx, const struct memref_t *data_in,
|
||||
struct memref_t *data_out)
|
||||
{
|
||||
(void)ctx;
|
||||
(void)data_in;
|
||||
(void)data_out;
|
||||
return CRYPTO_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -29,120 +29,21 @@ CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto/ec/curve448/arch_32
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto/evp
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto/modes
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto/siphash
|
||||
CPPFLAGS += -I$(TEELIB)/libcrypto/include
|
||||
CPPFLAGS += -I$(TEELIB)/libteeos/include/tee
|
||||
CPPFLAGS += -I$(PREBUILD_DIR)/headers/libc
|
||||
|
||||
OPENSSL_CRYPTO_PATH := $(TEELIB)/libopenssl/openssl/crypto
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/providers/common/include
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/providers/implementations/include
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/aes/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/asn1/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/bn/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/cmac/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/ec/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/evp/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/hmac/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/md5/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/modes/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/objects/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pem/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/rsa/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sha/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x509_set.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/t_x509.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x_attrib.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x_pubkey.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pkcs7/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pkcs12/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/bio/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/stack/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/buffer/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/lhash/lhash.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/conf/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/kdf/*.c) \
|
||||
$(wildcard $(TEELIB)/libopenssl/src/openssl_stub.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/des/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509v3/*.c)
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/siphash/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm2/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm3/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm4/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(OPENSSL_CRYPTO_PATH)/cryptlib.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem_sec.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem_dbg.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/ex_data.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/cpt_err.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/uid.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/o_time.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/o_str.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/ctype.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/getenv.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/init.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/err/err.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/err/err_all.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/rand/rand_lib.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/rand/drbg_lib.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/rand/drbg_ctr.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/rand/rand_unix.c \
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_GET_ENTROPY),true)
|
||||
LOCAL_SRC_FILES += $(OPENSSL_CRYPTO_PATH)/threads_pthread.c
|
||||
ifeq (${CONFIG_CRYPTO_SOFT_ENGINE},openssl3)
|
||||
include $(TEELIB)/libopenssl/openssl3.mk
|
||||
else
|
||||
LOCAL_SRC_FILES += $(OPENSSL_CRYPTO_PATH)/threads_none.c
|
||||
include $(TEELIB)/libopenssl/openssl.mk
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
LOCAL_SRC_FILES += $(OPENSSL_CRYPTO_PATH)/mem_clr.c
|
||||
endif
|
||||
|
||||
LOCAL_SRC_FILES := $(filter-out $(OPENSSL_CRYPTO_PATH)/ec/ecp_nistz256_table.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/aes/aes_ige.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/aes/aes_x86core.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/x509/x509_def.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_camellia.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_bf.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_cast.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_chacha20_poly1305.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_idea.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc2.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc4.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc4_hmac_md5.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_md4.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_mdc2.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_ripemd.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/conf/conf_sap.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_wp.c, $(LOCAL_SRC_FILES))
|
||||
|
||||
CFILES := $(patsubst $(TEELIB)/libopenssl/%,%,$(LOCAL_SRC_FILES))
|
||||
|
||||
ifeq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DCONFIG_OPENSSL_NO_ASM
|
||||
CFLAGS += -DCONFIG_OPENSSL_NO_ASM
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DBSAES_ASM -DOPENSSL_BN_ASM_GF2m
|
||||
CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DECP_NISTZ256_ASM
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_GET_ENTROPY),true)
|
||||
CFLAGS += -DOPENSSL_THREADS -DPTHREAD_RWLOCK_INITIALIZER
|
||||
endif
|
||||
CFLAGS += -DOPENSSL_NO_UI_CONSOLE -DOPENSSL_NO_EC448 -DOPENSSL_NO_KECCAK1600
|
||||
CFLAGS += -DCC_DRIVER -O3
|
||||
CFLAGS += -DOPENSSL_RAND_SEED_ENTROPY_CUSTOMER=crypto_driver_get_entropy
|
||||
|
||||
ASFLAGS := $(filter-out -march=armv8-a+nofp, $(ASFLAGS)) -march=armv8-a
|
||||
CFLAGS := $(filter-out -fno-builtin-memcpy, $(CFLAGS))
|
||||
|
||||
@@ -10,17 +10,50 @@
|
||||
# See the Mulan PSL v2 for more details.
|
||||
set -e
|
||||
|
||||
opensslpath="$1/openssl"
|
||||
ln -sf "${opensslpath}" "$2"/lib/teelib/libopenssl/
|
||||
third_party_ossl_path="$1/openssl"
|
||||
copy_path="$2/lib/teelib/libopenssl/"
|
||||
cp -r "${third_party_ossl_path}" "${copy_path}"
|
||||
|
||||
cd $opensslpath
|
||||
cd "${copy_path}/openssl"
|
||||
|
||||
# config and generate dso_conf.h
|
||||
echo "before ./config "
|
||||
chmod +x ./config
|
||||
./config
|
||||
make include/crypto/dso_conf.h
|
||||
cp "$2"/lib/teelib/libopenssl/include/opensslconf.h $opensslpath/include/openssl/
|
||||
cp "$2"/lib/teelib/libopenssl/include/bn_conf.h $opensslpath/include/crypto/
|
||||
patch -p1 < $2/lib/teelib/libopenssl/OpenSSL-customized-modification-unify.patch
|
||||
|
||||
if [ "$CONFIG_CRYPTO_SOFT_ENGINE" == "openssl3" ]; then
|
||||
make include/openssl/asn1.h
|
||||
make include/openssl/asn1t.h
|
||||
make include/openssl/bio.h
|
||||
make include/openssl/cmp.h
|
||||
make include/openssl/cms.h
|
||||
make include/openssl/conf.h
|
||||
make include/openssl/crmf.h
|
||||
make include/openssl/crypto.h
|
||||
make include/openssl/err.h
|
||||
make include/openssl/lhash.h
|
||||
make include/openssl/ocsp.h
|
||||
make include/openssl/opensslv.h
|
||||
make include/openssl/pkcs7.h
|
||||
make include/openssl/pkcs12.h
|
||||
make include/openssl/safestack.h
|
||||
make include/openssl/srp.h
|
||||
make include/openssl/ui.h
|
||||
make include/openssl/x509.h
|
||||
make include/openssl/x509_vfy.h
|
||||
make include/openssl/x509v3.h
|
||||
make providers/common/include/prov/der_digests.h
|
||||
make providers/common/include/prov/der_ec.h
|
||||
make providers/common/include/prov/der_rsa.h
|
||||
make providers/common/include/prov/der_sm2.h
|
||||
make providers/common/include/prov/der_wrap.h
|
||||
make providers/common/der/der_rsa_gen.c
|
||||
make providers/common/der/der_wrap_gen.c
|
||||
cp "$2"/lib/teelib/libopenssl/include/opensslconf3.h ./include/openssl/opensslconf.h
|
||||
cp "$2"/lib/teelib/libopenssl/include/bn_conf.h ./include/crypto/
|
||||
else
|
||||
cp "$2"/lib/teelib/libopenssl/include/opensslconf.h ./include/openssl/
|
||||
cp "$2"/lib/teelib/libopenssl/include/bn_conf.h ./include/crypto/
|
||||
fi
|
||||
|
||||
|
||||
@@ -8,12 +8,6 @@
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
# PURPOSE.
|
||||
# See the Mulan PSL v2 for more details.
|
||||
set -e
|
||||
cd "$1"/openssl
|
||||
|
||||
git checkout .
|
||||
git clean -df
|
||||
rm -rf "$1"/lib/teelib/libopenssl/openssl
|
||||
|
||||
if [ -d "$2"/lib/teelib/libopenssl/openssl ]; then
|
||||
rm -rf "$2"/lib/teelib/libopenssl/openssl
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,367 @@
|
||||
/*
|
||||
* Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef __TEE_OPENSSLCONF_H
|
||||
#define __TEE_OPENSSLCONF_H
|
||||
|
||||
#include <openssl/configuration.h>
|
||||
#include <openssl/macros.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define __NEED_ssize_t
|
||||
|
||||
#ifdef OPENSSL_ALGORITHM_DEFINES
|
||||
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OpenSSL was configured with the following options:
|
||||
*/
|
||||
|
||||
#ifdef linux
|
||||
# undef linux
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
# undef __linux__
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_PKCS12
|
||||
# define OPENSSL_NO_PKCS12
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM2_ENVELOP
|
||||
# define OPENSSL_NO_SM2_ENVELOP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_GMSM
|
||||
# define OPENSSL_NO_GMSM
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_GMTLS
|
||||
# define OPENSSL_NO_GMTLS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_PKCS7_SM2
|
||||
# define OPENSSL_NO_PKCS7_SM2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_PKCS8_SM2
|
||||
# define OPENSSL_NO_PKCS8_SM2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CMS_SM2
|
||||
# define OPENSSL_NO_CMS_SM2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM9
|
||||
# define OPENSSL_NO_SM9
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SM4_XTS
|
||||
# define OPENSSL_NO_SM4_XTS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_PQCHYBRID
|
||||
# define OPENSSL_NO_PQCHYBRID
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_PQC
|
||||
# define OPENSSL_NO_PQC
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WAPI
|
||||
# define OPENSSL_NO_WAPI
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CRL_MEMPOOL
|
||||
# define OPENSSL_NO_CRL_MEMPOOL
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_X509_REQ_EXP_ATTR
|
||||
# define OPENSSL_NO_X509_REQ_EXP_ATTR
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_NDCPP
|
||||
# define OPENSSL_NO_NDCPP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FIPS
|
||||
# define OPENSSL_NO_FIPS
|
||||
#endif
|
||||
#ifndef CONFIG_CRYPTO_ISO19790_MODE
|
||||
#ifndef OPENSSL_NO_CMVP
|
||||
# define OPENSSL_NO_CMVP
|
||||
#endif
|
||||
#endif
|
||||
#ifndef OPENSSL_RAND_SEED_HWENG
|
||||
# define OPENSSL_RAND_SEED_HWENG
|
||||
#endif
|
||||
#ifdef OPENSSL_NO_MD2
|
||||
# undef OPENSSL_NO_MD2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
# define OPENSSL_NO_RC5
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ASAN
|
||||
# define OPENSSL_NO_ASAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DEVCRYPTOENG
|
||||
# define OPENSSL_NO_DEVCRYPTOENG
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
# define OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EGD
|
||||
# define OPENSSL_NO_EGD
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EXTERNAL_TESTS
|
||||
# define OPENSSL_NO_EXTERNAL_TESTS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FUZZ_AFL
|
||||
# define OPENSSL_NO_FUZZ_AFL
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
# define OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_HEARTBEATS
|
||||
# define OPENSSL_NO_HEARTBEATS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MSAN
|
||||
# define OPENSSL_NO_MSAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
# define OPENSSL_NO_SCTP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
# define OPENSSL_NO_SSL_TRACE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
# define OPENSSL_NO_SSL3
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL3_METHOD
|
||||
# define OPENSSL_NO_SSL3_METHOD
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_UBSAN
|
||||
# define OPENSSL_NO_UBSAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_UNIT_TEST
|
||||
# define OPENSSL_NO_UNIT_TEST
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
# define OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_STATIC_ENGINE
|
||||
# define OPENSSL_NO_STATIC_ENGINE
|
||||
#endif
|
||||
|
||||
#ifndef CRYPTO_SUPPORT_SOFT_ECC
|
||||
#ifndef OPENSSL_NO_EC
|
||||
#define OPENSSL_NO_EC
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
#define OPENSSL_NO_ECDH
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ECDSA
|
||||
#define OPENSSL_NO_ECDSA
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TLS1_3
|
||||
#define OPENSSL_NO_TLS1_3
|
||||
#endif
|
||||
#endif
|
||||
#ifndef CRYPTO_SUPPORT_SOFT_SM2
|
||||
#ifndef OPENSSL_NO_SM2
|
||||
#define OPENSSL_NO_SM2
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
|
||||
* don't like that. This will hopefully silence them.
|
||||
*/
|
||||
#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
|
||||
|
||||
/*
|
||||
* Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
|
||||
* declarations of functions deprecated in or before <version>. Otherwise, they
|
||||
* still won't see them if the library has been built to disable deprecated
|
||||
* functions.
|
||||
*/
|
||||
#ifndef DECLARE_DEPRECATED
|
||||
# define DECLARE_DEPRECATED(f) f;
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_FILE
|
||||
# ifdef OPENSSL_NO_FILENAMES
|
||||
# define OPENSSL_FILE ""
|
||||
# define OPENSSL_LINE 0
|
||||
# else
|
||||
# define OPENSSL_FILE __FILE__
|
||||
# define OPENSSL_LINE __LINE__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_MIN_API
|
||||
# define OPENSSL_MIN_API 0x10100000L
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
|
||||
# undef OPENSSL_API_COMPAT
|
||||
# define OPENSSL_API_COMPAT OPENSSL_MIN_API
|
||||
#endif
|
||||
|
||||
#define OPENSSL_SUPPRESS_DEPRECATED
|
||||
|
||||
#ifndef MODULESDIR
|
||||
#define MODULESDIR "/usr/local/lib64/ossl-modules"
|
||||
#endif
|
||||
#ifndef OPENSSLDIR
|
||||
#define OPENSSLDIR "/usr/local/ssl"
|
||||
#endif
|
||||
#ifndef DSO_NONE
|
||||
#define DSO_NONE
|
||||
#endif
|
||||
/*
|
||||
* Do not deprecate things to be deprecated in version 1.2.0 before the
|
||||
* OpenSSL version number matches.
|
||||
*/
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10200000L
|
||||
# define DEPRECATEDIN_1_2_0(f) f;
|
||||
#elif OPENSSL_API_COMPAT < 0x10200000L
|
||||
# define DEPRECATEDIN_1_2_0(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_1_2_0(f) f;
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_1_1_0(f)
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10000000L
|
||||
# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_1_0_0(f)
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x00908000L
|
||||
# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_0_9_8(f)
|
||||
#endif
|
||||
|
||||
/* Generate 80386 code */
|
||||
#undef I386_ONLY
|
||||
|
||||
#undef OPENSSL_UNISTD
|
||||
#define OPENSSL_UNISTD <unistd.h>
|
||||
|
||||
#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
/*
|
||||
* The following are cipher-specific, but are part of the public API.
|
||||
*/
|
||||
# if defined(__arm) || defined(__arm__)
|
||||
# define THIRTY_TWO_BIT
|
||||
# undef SIXTY_FOUR_BIT_LONG
|
||||
# undef SIXTY_FOUR_BIT
|
||||
# elif defined(__aarch64__)
|
||||
# undef SIXTY_FOUR_BIT_LONG
|
||||
# undef THIRTY_TWO_BIT
|
||||
# define SIXTY_FOUR_BIT
|
||||
# endif
|
||||
|
||||
#ifndef __STDC_NO_ATOMICS__
|
||||
# define __STDC_NO_ATOMICS__
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
# define OPENSSL_NO_ENGINE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_POLY1305
|
||||
# define OPENSSL_NO_POLY1305
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DSA
|
||||
# define OPENSSL_NO_DSA
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SCRYPT
|
||||
# define OPENSSL_NO_SCRYPT
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SIPHASH
|
||||
# define OPENSSL_NO_SIPHASH
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAMELLIA
|
||||
# define OPENSSL_NO_CAMELLIA
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CHACHA
|
||||
# define OPENSSL_NO_CHACHA
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC4
|
||||
# define OPENSSL_NO_RC4
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_IDEA
|
||||
# define OPENSSL_NO_IDEA
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC2
|
||||
# define OPENSSL_NO_RC2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BF
|
||||
# define OPENSSL_NO_BF
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CAST
|
||||
# define OPENSSL_NO_CAST
|
||||
#endif
|
||||
#ifndef OPENSSL_USE_NODELETE
|
||||
# define OPENSSL_USE_NODELETE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
# define OPENSSL_NO_COMP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_TS
|
||||
# define OPENSSL_NO_TS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_OCSP
|
||||
# define OPENSSL_NO_OCSP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_POSIX_IO
|
||||
# define OPENSSL_NO_POSIX_IO
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
# define OPENSSL_NO_STDIO
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CT
|
||||
# define OPENSSL_NO_CT
|
||||
#endif
|
||||
#ifndef CONFIG_OPENSSL_NO_ASM
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CMS
|
||||
# define OPENSSL_NO_CMS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
# define OPENSSL_NO_ERR
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BLAKE2
|
||||
# define OPENSSL_NO_BLAKE2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ARIA
|
||||
# define OPENSSL_NO_ARIA
|
||||
#endif
|
||||
#ifdef OPENSSL_NO_SEED
|
||||
# undef OPENSSL_NO_SEED
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DGRAM
|
||||
# define OPENSSL_NO_DGRAM
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SOCK
|
||||
# define OPENSSL_NO_SOCK
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
# define OPENSSL_NO_OCB
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_DH
|
||||
# define OPENSSL_NO_DH
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
OPENSSL_CRYPTO_PATH := $(TEELIB)/libopenssl/openssl/crypto
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/aes/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/asn1/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/bn/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/cmac/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/ec/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/evp/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/hmac/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/md5/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/modes/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/objects/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pem/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/rsa/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sha/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x509_set.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/t_x509.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x_attrib.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/x_pubkey.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pkcs7/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/pkcs12/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/bio/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/stack/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/buffer/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/lhash/lhash.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/conf/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/kdf/*.c) \
|
||||
$(wildcard $(TEELIB)/libopenssl/src/openssl_stub.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/des/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/x509v3/*.c)
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/siphash/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm2/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm3/*.c) \
|
||||
$(wildcard $(OPENSSL_CRYPTO_PATH)/sm4/*.c)
|
||||
|
||||
LOCAL_SRC_FILES += \
|
||||
$(OPENSSL_CRYPTO_PATH)/cryptlib.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem_sec.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/mem_dbg.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/ex_data.c \
|
||||
|
||||
LOCAL_SRC_FILES := $(filter-out $(OPENSSL_CRYPTO_PATH)/ec/ecp_nistz256_table.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/aes/aes_ige.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/aes/aes_x86core.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/x509/x509_def.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_camellia.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_bf.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_cast.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_chacha20_poly1305.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_idea.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc2.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc4.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/e_rc4_hmac_md5.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_md4.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_mdc2.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_ripemd.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/conf/conf_sap.c \
|
||||
$(OPENSSL_CRYPTO_PATH)/evp/m_wp.c, $(LOCAL_SRC_FILES))
|
||||
|
||||
CFILES := $(patsubst $(TEELIB)/libopenssl/%,%,$(LOCAL_SRC_FILES))
|
||||
|
||||
ifeq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DCONFIG_OPENSSL_NO_ASM
|
||||
CFLAGS += -DCONFIG_OPENSSL_NO_ASM
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DBSAES_ASM -DOPENSSL_BN_ASM_GF2m
|
||||
CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DECP_NISTZ256_ASM
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_GET_ENTROPY),true)
|
||||
CFLAGS += -DOPENSSL_THREADS -DPTHREAD_RWLOCK_INITIALIZER
|
||||
endif
|
||||
CFLAGS += -DOPENSSL_NO_UI_CONSOLE -DOPENSSL_NO_EC448 -DOPENSSL_NO_KECCAK1600
|
||||
CFLAGS += -DCC_DRIVER -O3
|
||||
CFLAGS += -DOPENSSL_RAND_SEED_ENTROPY_CUSTOMER=crypto_driver_get_entropy
|
||||
@@ -0,0 +1,601 @@
|
||||
SOURCE_DIR := $(TEELIB)/libopenssl
|
||||
OPENSSL_FILE_PATH := $(SOURCE_DIR)/openssl
|
||||
|
||||
LOCAL_SRC_FILES := $(SOURCE_DIR)/src/openssl3_stub.c
|
||||
LOCAL_SRC_FILES += $(SOURCE_DIR)/src/entropy.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_cbc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_cfb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_core.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_ecb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_misc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_ofb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/aes/aes_wrap.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_bitstr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_d2i_fp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_digest.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_dup.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_gentm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_i2d_fp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_int.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_mbstr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_object.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_octet.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_print.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_strex.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_strnid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_time.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_type.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_utctm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_utf8.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/a_verify.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/ameth_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn1_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn1_gen.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn1_item_list.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn1_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn1_parse.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn_mime.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn_moid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn_mstbl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/asn_pack.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/bio_asn1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/bio_ndef.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/d2i_pr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/d2i_pu.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/evp_asn1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/f_int.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/f_string.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/n_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/nsseq.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/p5_pbe.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/p5_pbev2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/p5_scrypt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/p8_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/t_bitst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/t_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/t_spki.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_dec.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_fre.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_new.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_prn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_scn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_typ.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/tasn_utl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_algor.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_bignum.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_info.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_int64.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_long.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_spki.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1/x_val.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_buff.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_lbuf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_nbio.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_prefix.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bf_readbuff.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_cb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_dump.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bio_print.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_acpt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_bio.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_conn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_dgram.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_fd.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_file.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_log.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_mem.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/bss_sock.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bio/ossl_core_bio.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_add.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_asm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_blind.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_const.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_conv.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_ctx.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_depr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_dh.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_div.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_exp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_exp2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_gcd.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_gf2m.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_intern.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_kron.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_mod.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_mont.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_mpi.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_mul.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_nist.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_prime.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_print.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_rand.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_recp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_rsa_fips186_4.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_shift.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_sqr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_sqrt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_srp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_word.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/bn_x931p.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/rsa_sup_mul.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bn/rsaz_exp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/buffer/buf_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/buffer/buffer.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/cmac/cmac.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/cmp/cmp_util.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_api.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_def.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_mall.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_mod.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_sap.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/conf/conf_ssl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/cbc_cksm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/cbc_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/cfb64ede.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/cfb64enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/cfb_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/des_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ecb3_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ecb_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/fcrypt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/fcrypt_b.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ncbc_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ofb64ede.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ofb64enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/ofb_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/pcbc_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/qud_cksm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/rand_key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/set_key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/str2key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/des/xcbc_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/dso/dso_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/dso/dso_openssl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/decoder_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/decoder_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/decoder_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/encoder_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/encoder_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/encode_decode/encoder_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/err/err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/err/err_all.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/err/err_blocks.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/err/err_prn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/asymcipher.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/bio_b64.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/bio_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/bio_md.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/bio_ok.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/c_allc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/c_alld.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/cmeth_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/ctrl_params_translate.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/dh_support.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/digest.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_aes.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_aes_cbc_hmac_sha1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_aes_cbc_hmac_sha256.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_aria.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_des.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_des3.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_old.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_rc5.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_seed.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_sm4.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/e_xcbc_d.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/encode.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_cnf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_fetch.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_pbe.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_rand.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/evp_utils.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/exchange.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/kdf_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/kdf_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/kem.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/keymgmt_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/keymgmt_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_md4.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_md5.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_md5_sha1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_mdc2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_ripemd.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_sha.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/legacy_wp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/m_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/m_sigver.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/mac_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/mac_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/names.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p5_crpt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p5_crpt2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_dec.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_legacy.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_open.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_seal.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_sign.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/p_verify.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/pbe_scrypt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/pmeth_gn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/pmeth_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/evp/signature.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ffc/ffc_dh.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/hmac/hmac.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/kdf/kdf_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/lhash/lhash.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/md4/md4_dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/md5/md5_dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/md5/md5_one.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/md5/md5_sha1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/mdc2/mdc2dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/cbc128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/ccm128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/cfb128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/ctr128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/cts128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/gcm128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/ocb128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/ofb128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/siv128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/wrap128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/modes/xts128.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/objects/o_names.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/objects/obj_dat.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/objects/obj_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/objects/obj_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/objects/obj_xref.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_all.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_info.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_oth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_pk8.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_pkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_sign.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_x509.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pem_xaux.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pem/pvkfmt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_add.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_asn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_attr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_crpt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_crt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_decr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_init.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_kiss.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_mutl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_npas.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_p8d.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_p8e.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs12/p12_utl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/bio_pk7.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/pk7_attr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/pk7_doit.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/pk7_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/pk7_mime.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/pkcs7/pkcs7err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/property/defn_cache.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/property/property.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/property/property_parse.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/property/property_query.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/property/property_string.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rand/prov_seed.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rand/rand_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rand/rand_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rand/rand_pool.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ripemd/rmd_dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_ameth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_asn1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_backend.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_chk.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_crpt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_depr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_gen.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_mp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_mp_names.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_none.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_oaep.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_ossl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_pk1.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_pmeth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_prn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_pss.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_saos.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_schemes.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_sign.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_sp800_56b_check.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_sp800_56b_gen.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_x931.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/rsa/rsa_x931g.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/seed/seed.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/seed/seed_cbc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/seed/seed_cfb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/seed/seed_ecb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/seed/seed_ofb.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/keccak1600.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/sha1_one.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/sha1dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/sha256.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/sha3.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sha/sha512.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/siphash/siphash.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sm3/legacy_sm3.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sm3/sm3.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sm4/sm4.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/stack/stack.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/store/store_init.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/store/store_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/store/store_register.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ui/ui_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ui/ui_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ui/ui_openssl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ui/ui_util.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/whrlpool/wp_block.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/whrlpool/wp_dgst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/by_dir.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/by_file.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_cache.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_data.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_map.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_node.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/pcy_tree.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/t_crl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/t_req.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/t_x509.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_addr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_admis.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_akeya.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_akid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_asid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_bcons.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_bitst.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_conf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_cpols.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_crld.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_enum.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_extku.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_genn.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_ia5.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_info.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_int.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_ist.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_lib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_ncons.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_pci.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_pcia.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_pcons.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_pku.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_pmaps.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_purp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_san.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_skid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_sxnet.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_tlsf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_utf8.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/v3_utl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_att.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_cmp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_d2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_def.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_ext.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_lu.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_meth.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_obj.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_r2x.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_req.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_set.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_trust.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_txt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_v3.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_vfy.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509_vpm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509cset.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509name.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509rset.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509spki.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x509type.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_all.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_attrib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_crl.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_exten.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_name.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_pubkey.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_req.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_x509.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/x509/x_x509a.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/bio_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/capabilities.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_ec_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_rsa_gen.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_rsa_key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_rsa_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_sm2_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/der/der_wrap_gen.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/digest_to_nid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/provider_ctx.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/provider_seeding.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/provider_util.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/securitycheck.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/common/securitycheck_default.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/asymciphers/rsa_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/asymciphers/sm2_enc.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha1_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_cbc_hmac_sha256_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_ccm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_ccm_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_gcm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_gcm_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_siv.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_siv_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_wrp.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_xts.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_xts_fips.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_aes_xts_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_cts.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_null.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_hw.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_ccm.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_ccm_hw.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_gcm.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_gcm_hw.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_xts.c
|
||||
#LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_sm4_xts_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_common.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_default.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_default_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_wrap.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/cipher_tdes_wrap_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_block.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_ccm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_ccm_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_gcm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_gcm_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/ciphers/ciphercommon_hw.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/digestcommon.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/md5_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/md5_sha1_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/null_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/ripemd_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/sha2_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/sha3_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/digests/sm3_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_der2key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_epki2pki.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_msblob2key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_pem2der.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_pvk2key.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/decode_spki2typespki.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/encode_key2any.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/encode_key2blob.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/encode_key2ms.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/encode_key2text.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/encode_decode/endecoder_common.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/exchange/kdf_exch.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/hkdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/kbkdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/krb5kdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/pbkdf2.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/pbkdf2_fips.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/pkcs12kdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/sshkdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/sskdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/tls1_prf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kdfs/x942kdf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/kem/rsa_kem.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/keymgmt/kdf_legacy_kmgmt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/keymgmt/mac_legacy_kmgmt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/keymgmt/rsa_kmgmt.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/macs/cmac_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/macs/gmac_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/macs/hmac_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/macs/kmac_prov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/drbg.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/drbg_ctr.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/drbg_hash.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/drbg_hmac.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/seed_src.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/rands/test_rng.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/signature/ecdsa_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/signature/mac_legacy_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/signature/rsa_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/signature/sm2_sig.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/storemgmt/file_store.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/implementations/storemgmt/file_store_any2obj.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/ssl/record/tls_pad.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/packet.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/asn1_dsa.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/bsearch.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/context.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/core_algorithm.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/core_fetch.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/core_namemap.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/cryptlib.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/der_writer.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/mem.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/mem_sec.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ex_data.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/cpt_err.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/uid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/o_dir.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/o_time.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/o_str.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/params.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/param_build_set.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/params_dup.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/params_from_text.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/param_build.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/passphrase.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/provider.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/provider_child.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/provider_conf.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/provider_core.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/provider_predefined.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/sparse_array.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/punycode.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/trace.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/ctype.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/getenv.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/init.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/initthread.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/cpuid.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/baseprov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/defltprov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/nullprov.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/providers/prov_running.c
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/ssl/s3_cbc.c
|
||||
|
||||
CFLAGS += -DOPENSSL_NO_GMTLS
|
||||
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/threads_pthread.c
|
||||
ifeq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
LOCAL_SRC_FILES += $(OPENSSL_FILE_PATH)/crypto/mem_clr.c
|
||||
endif
|
||||
|
||||
CFILES := $(patsubst $(SOURCE_DIR)/%,%,$(LOCAL_SRC_FILES))
|
||||
|
||||
ifeq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DOPENSSL_NO_ASM
|
||||
CFLAGS += -DOPENSSL_NO_ASM
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_OPENSSL_NO_ASM),true)
|
||||
A32_CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ _DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DBSAES_ASM -DOPENSSL_BN_ASM_GF2m -DGHASH_ASM_ARM
|
||||
CFLAGS += -DOPENSSL_BN_ASM_MONT -DOPENSSL_CPUID_OBJ -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DECP_NIST256_ASM -DGHASH_ASM
|
||||
endif
|
||||
CFLAGS += -DOPENSSL_THREADS -DPTHREAD_RWLOCK_INITIALIZER
|
||||
CFLAGS += -DOPENSSL_NO_UI_CONSOLE -DPTHREAD_NO_KECCAK1600
|
||||
CFLAGS += -DCC_DRIVER -O3 -Wno-error
|
||||
CFLAGS += -DOPENSSL_RAND_SEED_ENTROPY_CUSTOMER=crypto_driver_get_entropy
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "crypto/rand_pool.h"
|
||||
#include "openssl/crypto.h"
|
||||
#include "openssl/types.h"
|
||||
|
||||
#ifdef OPENSSL_RAND_SEED_ENTROPY_CUSTOMER
|
||||
size_t rand_acquire_entropy_from_customer(RAND_POOL *pool)
|
||||
{
|
||||
size_t bytes_needed;
|
||||
unsigned char *buffer;
|
||||
int ret;
|
||||
|
||||
bytes_needed = ossl_rand_pool_bytes_needed(pool, 1);
|
||||
if (bytes_needed > 0) {
|
||||
buffer = ossl_rand_pool_add_begin(pool, bytes_needed);
|
||||
if (buffer != NULL){
|
||||
ret = (int)OPENSSL_RAND_SEED_ENTROPY_CUSTOMER(buffer, (uint32_t)bytes_needed);
|
||||
if (ret == 0)
|
||||
ossl_rand_pool_add_end(pool, bytes_needed, 8 * bytes_needed);
|
||||
}
|
||||
}
|
||||
return ossl_rand_pool_entropy_available(pool);
|
||||
}
|
||||
|
||||
size_t ossl_pool_acquire_entropy(RAND_POOL *pool)
|
||||
{
|
||||
size_t entropy_available;
|
||||
entropy_available = rand_acquire_entropy_from_customer(pool);
|
||||
if (entropy_available > 0)
|
||||
return entropy_available;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ossl_pool_add_nonce_data(RAND_POOL *pool)
|
||||
{
|
||||
struct data_t {
|
||||
pid_t pid;
|
||||
CRYPTO_THREAD_ID tid;
|
||||
uint64_t time;
|
||||
};
|
||||
struct data_t *data = malloc(sizeof(struct data_t));
|
||||
if (data == NULL)
|
||||
return 0;
|
||||
(void)memset(data, 0, sizeof(struct data_t));
|
||||
return ossl_rand_pool_add(pool, (unsigned char *)&data, sizeof(struct data_t), 0);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Huawei Technologies Co., Ltd.
|
||||
* Licensed under the Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* http://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
||||
* PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "crypto/rand_pool.h"
|
||||
#include "openssl/crypto.h"
|
||||
#include "openssl/types.h"
|
||||
|
||||
void async_deinit(void)
|
||||
{
|
||||
}
|
||||
|
||||
int async_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int geteuid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getgid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getegid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OSSL_SELF_TEST_get_callback(OSSL_LIB_CTX *libctx, OSSL_CALLBACK **cb, void **cbarg)
|
||||
{
|
||||
(void)libctx;
|
||||
(void)cb;
|
||||
(void)cbarg;
|
||||
}
|
||||
|
||||
char *readdir(char *dirp)
|
||||
{
|
||||
(void)dirp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *opendir(const char *dirname)
|
||||
{
|
||||
(void)dirname;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int closedir(char* dir)
|
||||
{
|
||||
(void)dir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ossl_rand_pool_cleanup(void)
|
||||
{
|
||||
}
|
||||
|
||||
int ossl_rand_pool_init(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int getuid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int getpid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -23,7 +23,12 @@ CPPFLAGS += -I$(TEELIB)/libteeagentcommon_client/include
|
||||
CPPFLAGS += -I$(TEELIB)/libhuk/include
|
||||
CPPFLAGS += -I$(TEELIB)/libipc_hal/include
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl)
|
||||
CFLAGS += -DOPENSSL_ENABLE
|
||||
A32_CFLAGS += -DOPENSSL_ENABLE
|
||||
else ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
|
||||
CFLAGS += -DOPENSSL3_ENABLE
|
||||
A32_CFLAGS += -DOPENSSL3_ENABLE
|
||||
endif
|
||||
|
||||
include $(BUILD_LIB)/lib-common.mk
|
||||
|
||||
@@ -820,7 +820,7 @@ void TEE_FreeTransientObject(TEE_ObjectHandle object)
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_ENABLE
|
||||
tee_crypto_free_opensssl_drbg();
|
||||
tee_crypto_free_openssl_drbg();
|
||||
#endif
|
||||
tlogd("TEE_FreeTransientObject end!\n");
|
||||
return;
|
||||
|
||||
@@ -23,7 +23,7 @@ inc-flags += -I$(TEELIB)/libhuk/include
|
||||
inc-flags += -I$(TEELIB)/libtee_shared/include
|
||||
inc-flags += -I$(PREBUILD_HEADER)/sys
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/include
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
endif
|
||||
@@ -60,7 +60,11 @@ else
|
||||
libswcrypto_engine_c_files := $(filter-out src/aes_wrapper.c, $(libswcrypto_engine_c_files))
|
||||
endif
|
||||
|
||||
c-flags += -DOPENSSL_ENABLE
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
|
||||
c-flags += -DOPENSSL3_ENABLE
|
||||
else
|
||||
c-flags += -DOPENSSL_ENABLE
|
||||
endif
|
||||
libswcrypto_engine_c_files := $(filter-out src/stub/rsa_wrapper_stub.c, $(libswcrypto_engine_c_files))
|
||||
|
||||
include $(BUILD_LIB)/lib-common.mk
|
||||
|
||||
@@ -1138,7 +1138,7 @@ int rsa_import_priv(rsa_priv_key_t *priv, const uint8_t *in, uint32_t in_len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
RSA *rsa_priv = EVP_PKEY_get0_RSA(evp_key);
|
||||
const RSA *rsa_priv = EVP_PKEY_get0_RSA(evp_key);
|
||||
if (rsa_priv == NULL) {
|
||||
tloge("get rsa key fail");
|
||||
return -1;
|
||||
|
||||
@@ -72,8 +72,12 @@ ld-flags := -lcrypto_hal$(TARG) -ltimer$(TARG) -lagent$(TARG) -lagent_base$(TARG
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),mbedtls)
|
||||
ld-flags += -lmbedtls${TARG}
|
||||
else ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3)
|
||||
ld-flags += -lopenssl${TARG}
|
||||
flag += -DOPENSSL3_ENABLE
|
||||
else
|
||||
ld-flags += -lopenssl${TARG}
|
||||
flag += -DOPENSSL_ENABLE
|
||||
endif
|
||||
|
||||
ifeq ($(findstring true, $(CONFIG_SE_SERVICE_32BIT) $(CONFIG_SE_SERVICE_64BIT)), true)
|
||||
|
||||
@@ -216,8 +216,14 @@ ECDSA_SIG_new;
|
||||
ECDSA_SIG_set0;
|
||||
ECDSA_do_verify;
|
||||
ED25519_public_from_private;
|
||||
#ifdef OPENSSL_ENABLE
|
||||
ED25519_sign;
|
||||
ED25519_verify;
|
||||
#endif
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
ossl_ed25519_sign;
|
||||
ossl_ed25519_verify;
|
||||
#endif
|
||||
|
||||
SHA256_Init;
|
||||
SHA256_Update;
|
||||
|
||||
@@ -215,8 +215,14 @@ ECDSA_SIG_new
|
||||
ECDSA_SIG_set0
|
||||
ECDSA_do_verify
|
||||
ED25519_public_from_private
|
||||
#ifdef OPENSSL_ENABLE
|
||||
ED25519_sign
|
||||
ED25519_verify
|
||||
#endif
|
||||
#ifdef OPENSSL3_ENABLE
|
||||
ossl_ed25519_sign
|
||||
ossl_ed25519_verify
|
||||
#endif
|
||||
|
||||
SHA256_Init
|
||||
SHA256_Update
|
||||
|
||||
@@ -84,7 +84,7 @@ inc-flags += -I$(SERVICES_PATH)/permission_service/src/anti_rollback
|
||||
inc-flags += -I$(SERVICES_PATH)/permission_service/src/auth/tee_auth_sign_rsa.h
|
||||
inc-flags += -I$(PREBUILD_HEADER)/sys
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/include
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto/include
|
||||
@@ -98,7 +98,9 @@ CFILES := $(filter-out , $(CFILES))
|
||||
endif
|
||||
|
||||
CFLAGS += -fvisibility=hidden -Wno-pointer-to-int-cast
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl)
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl3)
|
||||
CFLAGS += -DOPENSSL3_ENABLE
|
||||
else
|
||||
CFLAGS += -DOPENSSL_ENABLE
|
||||
endif
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ CPPFLAGS += -I$(TOPDIR)/libs/libcrypto_common
|
||||
CPPFLAGS += -I$(TEELIB)/libteeagentcommon_client/include
|
||||
CPPFLAGS += -I$(TEELIB)/libipc_hal/include
|
||||
|
||||
ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl)
|
||||
ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/include
|
||||
CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user