mirror of
https://gitee.com/openharmony/security_huks
synced 2024-11-30 10:21:22 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3ee0c04b26
@ -1,28 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef CIPHER_H
|
||||
#define CIPHER_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
@ -13,6 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef CIPHER_LOG_H
|
||||
#define CIPHER_LOG_H
|
||||
|
||||
#include "securec.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -41,4 +44,6 @@ void CipherLog(uint32_t logLevel, const char *funcName, uint32_t lineNo, const c
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif // CIPHER_LOG_H
|
@ -19,12 +19,6 @@
|
||||
|
||||
#include "hilog/log.h"
|
||||
|
||||
|
||||
#undef LOG_DOMAIN
|
||||
#undef LOG_TAG
|
||||
static const unsigned int LOG_DOMAIN = 0xD002F01;
|
||||
static const char* LOG_TAG = "CIPHER";
|
||||
|
||||
#define MAX_LOG_BUFF_LEN 4096
|
||||
|
||||
void CipherLog(uint32_t logLevel, const char *funcName, uint32_t lineNo, const char *format, ...)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2022-2023 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
|
||||
@ -68,9 +68,9 @@ struct AesAsyncContext {
|
||||
};
|
||||
|
||||
static const char g_failCode[] = "System error";
|
||||
static const int g_errorCode = 200;
|
||||
static const int g_failArg = 2;
|
||||
static const int g_ivLen = 16;
|
||||
static const int ERROR_CODE = 200;
|
||||
static const int FAIL_ARG = 2;
|
||||
static const int IV_LEN = 16;
|
||||
|
||||
#define SELF_FREE_PTR(PTR, FREE_FUNC) \
|
||||
{ \
|
||||
@ -200,7 +200,7 @@ static int32_t ReadAesData(napi_env env, AesAsyncContext *context)
|
||||
}
|
||||
|
||||
(void)context->ivLen_napi;
|
||||
context->ivLen = g_ivLen;
|
||||
context->ivLen = IV_LEN;
|
||||
|
||||
len = 0;
|
||||
ret = GetString(env, context->iv_napi, &context->ivBuf, &len);
|
||||
@ -443,7 +443,7 @@ static int32_t RsaExcute(RsaAsyncContext *asyncContext)
|
||||
return ERROR_CODE_GENERAL;
|
||||
}
|
||||
|
||||
asyncContext->textOut->data = (char *)malloc(asyncContext->textOut->length);
|
||||
asyncContext->textOut->data = static_cast<char *>(malloc(asyncContext->textOut->length));
|
||||
if (asyncContext->textOut->data == nullptr) {
|
||||
return ERROR_CODE_GENERAL;
|
||||
}
|
||||
@ -490,11 +490,11 @@ void SetFail(napi_env env, CallbackContext *asyncContext)
|
||||
napi_create_string_utf8(env, g_failCode, sizeof(g_failCode), &result);
|
||||
|
||||
napi_value errorCode = nullptr;
|
||||
napi_create_int32(env, g_errorCode, &errorCode);
|
||||
napi_create_int32(env, ERROR_CODE, &errorCode);
|
||||
|
||||
napi_value params[g_failArg] = { result, errorCode };
|
||||
napi_value params[FAIL_ARG] = { result, errorCode };
|
||||
napi_get_reference_value(env, asyncContext->callbackFail, &callback);
|
||||
napi_call_function(env, nullptr, callback, g_failArg, params, &ret);
|
||||
napi_call_function(env, nullptr, callback, FAIL_ARG, params, &ret);
|
||||
napi_delete_reference(env, asyncContext->callbackFail);
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,12 @@
|
||||
|
||||
using namespace OHOS;
|
||||
|
||||
sptr<IRemoteObject> GetHksProxy();
|
||||
|
||||
namespace {
|
||||
constexpr int SA_ID_KEYSTORE_SERVICE = 3510;
|
||||
const std::u16string SA_KEYSTORE_SERVICE_DESCRIPTOR = u"ohos.security.hks.service";
|
||||
}
|
||||
|
||||
sptr<IRemoteObject> GetHksProxy()
|
||||
static sptr<IRemoteObject> GetHksProxy()
|
||||
{
|
||||
auto registry = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
HKS_IF_NULL_LOGE_RETURN(registry, nullptr, "GetHksProxy registry is null")
|
||||
|
@ -207,6 +207,9 @@ if (ohos_kernel_type == "liteos_m") {
|
||||
"MBEDTLS_ECP_RESTARTABLE=1",
|
||||
"LOG_ENGINE_HILOG_MODULE_SCY",
|
||||
]
|
||||
if (product_name == "wifiiot_hispark_pegasus") {
|
||||
defines += [ "USE_HISI_MBED" ]
|
||||
}
|
||||
|
||||
if (huks_enable_upgrade_key && !huks_use_lite_storage) {
|
||||
defines += [ "HKS_ENABLE_UPGRADE_KEY" ]
|
||||
|
@ -24,7 +24,7 @@ void __attribute__((weak)) OHOS_SystemInit(void)
|
||||
SAMGR_Bootstrap();
|
||||
};
|
||||
|
||||
int main()
|
||||
int main(void)
|
||||
{
|
||||
OHOS_SystemInit();
|
||||
pause();
|
||||
|
Loading…
Reference in New Issue
Block a user