mirror of
https://github.com/openharmony/device_soc_asrmicro.git
synced 2026-07-01 22:34:00 -04:00
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Copyright (c) 2020 Huawei Device Co., Ltd.
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import("//third_party/mbedtls/mbedtls.gni")
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/ndk/ndk.gni")
|
||||
|
||||
config("mbedtls_config") {
|
||||
include_dirs = [ "." ] + MBEDTLS_INLCUDE_DIRS
|
||||
defines += [
|
||||
"__unix__",
|
||||
"MBEDTLS_CONFIG_FILE=<config/config_liteos_m.h>",
|
||||
]
|
||||
}
|
||||
|
||||
lite_library("mbedtls_static") {
|
||||
target_type = "static_library"
|
||||
public_configs = [ ":mbedtls_config" ]
|
||||
sources = MBEDTLS_SOURCES + [ "library/entropy_hardware_alt.c" ]
|
||||
}
|
||||
|
||||
group("mbedtls") {
|
||||
public_deps = [ ":mbedtls_static" ]
|
||||
public_configs = [ ":mbedtls_config" ]
|
||||
}
|
||||
|
||||
ndk_lib("mbedtls_ndk") {
|
||||
lib_extension = ".a"
|
||||
deps = [ ":mbedtls" ]
|
||||
head_files = [ "include" ]
|
||||
}
|
||||
+3433
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mbedtls/entropy_poll.h"
|
||||
|
||||
#ifdef MBEDTLS_ENTROPY_HARDWARE_ALT
|
||||
|
||||
#include "lega_rnd.h"
|
||||
#include "lega_hw_common.h"
|
||||
|
||||
int mbedtls_hardware_poll( void *data,
|
||||
unsigned char *output, size_t len, size_t *olen )
|
||||
{
|
||||
int ret = 0;
|
||||
lega_rnd_init();
|
||||
ret = lega_RND_AddAdditionalInput(rndContext_ptr, "0123", 4);
|
||||
if (ret != LEGA_HW_OK){
|
||||
printf("\n CRYS_RND_AddAdditionalInput failed with 0x%x \n",ret);
|
||||
goto rnd_err;
|
||||
}
|
||||
ret = lega_RND_Reseeding (rndContext_ptr, rndWorkBuff_ptr);
|
||||
if (ret != LEGA_HW_OK){
|
||||
printf("\n CRYS_RND_Reseeding failed with 0x%x \n",ret);
|
||||
goto rnd_err;
|
||||
}
|
||||
ret = lega_RND_GenerateVector(rndContext_ptr, len, output);
|
||||
if (ret != LEGA_HW_OK){
|
||||
printf("\n CRYS_RND_GenerateVector for vector 1 failed with 0x%x \n",ret);
|
||||
goto rnd_err;
|
||||
}
|
||||
|
||||
*olen = len;
|
||||
lega_rnd_deinit();
|
||||
rnd_err:
|
||||
return ret;
|
||||
}
|
||||
#if 0
|
||||
#define RND_MAX_LEN 192
|
||||
#define RND_TEST_LEN 192
|
||||
uint32_t mbedtls_hw_rand()
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
uint8_t buffer[RND_MAX_LEN] ={0};
|
||||
uint32_t olen = 0;
|
||||
mbedtls_hardware_poll( "0", &buffer[0], RND_TEST_LEN, &olen );
|
||||
printf("data len = %d, data = \n", (int)olen);
|
||||
for(ret = 0;ret < RND_TEST_LEN; ret++)
|
||||
{
|
||||
printf("0x%x ", buffer[ret]);
|
||||
}
|
||||
printf("\n");
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -47,7 +47,6 @@ void iperf_value_format(char* format_value,int format_value_len,u64_t value)
|
||||
u64_t gv=value/(1000000000ULL);
|
||||
u64_t mv=value/(1000000ULL);
|
||||
u64_t kv=value/(1000ULL);
|
||||
if(value<0) return;
|
||||
|
||||
lega_rtos_declare_critical();
|
||||
lega_rtos_enter_critical();
|
||||
|
||||
@@ -442,18 +442,18 @@ WifiErrorCode RemoveDevice(int networkId)
|
||||
|
||||
return WIFI_SUCCESS;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void lalala_sta_device_config_set(void)
|
||||
{
|
||||
WifiDeviceConfig config;
|
||||
int result = 1;
|
||||
memcpy(config.ssid, "AP2311", 32);
|
||||
memcpy(config.preSharedKey, "12345678", 64);
|
||||
memcpy(config.ssid, "AP2311", sizeof("AP2311"));
|
||||
memcpy(config.preSharedKey, "12345678", sizeof("12345678"));
|
||||
RemoveDevice(result);
|
||||
AddDeviceConfig(&config, &result);
|
||||
RemoveDevice(result);
|
||||
}
|
||||
|
||||
#endif
|
||||
WifiErrorCode ConnectTo(int networkId)
|
||||
{
|
||||
lega_wlan_init_type_t init_param = {0};
|
||||
@@ -730,7 +730,7 @@ WifiErrorCode UnRegisterWifiEvent(const WifiEvent* event)
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%s fail 0x%x 0x%x\r\n",__func__,lega_wifi_event_ptr,event);
|
||||
printf("%s fail 0x%x 0x%x\r\n", __func__, (unsigned int)lega_wifi_event_ptr, (unsigned int)event);
|
||||
}
|
||||
|
||||
return WIFI_SUCCESS;
|
||||
|
||||
@@ -152,6 +152,7 @@ extern uint8_t* lega_ble_rf_get_txcali_from_efuse(uint8_t *test);
|
||||
void lega_devInit()
|
||||
{
|
||||
int ret = 0;
|
||||
(void)ret;
|
||||
#if defined ALIOS_SUPPORT || defined HARMONYOS_SUPPORT
|
||||
ota_roll_back_pro();
|
||||
#endif
|
||||
|
||||
@@ -122,7 +122,7 @@ int main(void)
|
||||
{
|
||||
threadId = osThreadNew((osThreadFunc_t)sys_init,NULL,&g_main_task);
|
||||
#ifdef CFG_HARMONY_TESTS
|
||||
threadId = osThreadNew((osThreadFunc_t)harmony_test,NULL,&harmony_test_task);
|
||||
osThreadNew((osThreadFunc_t)harmony_test,NULL,&harmony_test_task);
|
||||
#endif
|
||||
if(threadId!=NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user