Compare commits

...

11 Commits

Author SHA1 Message Date
openeuler-ci-bot
294e941d9b
!14 请求将distributeddatamgr_kv_store合入next分支
From: @zxstty 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-12-12 08:04:30 +00:00
zxstty
fc547d6cb7 change by zj 2023-12-06 16:47:37 +08:00
openeuler-ci-bot
509253a256
!11 同步 sp2 next分支
From: @muyuying1 
Reviewed-by: @heppen 
Signed-off-by: @heppen
2023-10-30 13:21:07 +00:00
openeuler-ci-bot
8b1321bdbb
!10 同步SP2分支代码到master分支
From: @heppen 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-08-29 12:28:46 +00:00
openeuler-ci-bot
a3a4662206
!9 add source file and spec file
From: @heppen 
Reviewed-by: @yukaii 
Signed-off-by: @yukaii
2023-08-29 11:26:30 +00:00
openeuler-ci-bot
854a5a6d4a
!8 补充patch
From: @muyuying1 
Reviewed-by: @heppen 
Signed-off-by: @heppen
2023-08-29 02:38:47 +00:00
heppen
dc0e0a7b6d add source file and spec file 2023-08-29 10:23:35 +08:00
openeuler-ci-bot
0213da2e22
!6 添加patch 0006 establish-kvstore-dependence-on-boundscheck
From: @muyuying1 
Reviewed-by: @heppen 
Signed-off-by: @heppen
2023-08-28 12:38:29 +00:00
muyuying1
d8e1c201de establish-kvstore-dependence-on-boundscheck 2023-08-28 20:32:51 +08:00
openeuler-ci-bot
bc462764c2
!5 添加patch 0005 add third part component
From: @muyuying1 
Reviewed-by: @heppen 
Signed-off-by: @heppen
2023-08-28 12:28:21 +00:00
muyuying1
dd880ded4e add third part component 2023-08-28 20:10:23 +08:00
7 changed files with 307 additions and 569 deletions

View File

@ -1,569 +0,0 @@
From 1a119f78a70ff04a2fe4415986a02d9991894802 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Sat, 15 Jul 2023 11:12:16 +0800
Subject: [PATCH] add huks component
---
huks/BUILD.gn | 0
huks/bundle.json | 77 ++++++++++++++++
.../huks_standard/main/os_dependency/BUILD.gn | 10 +++
.../ipc/include/hks_client_ipc.h | 90 +++++++++++++++++++
.../os_dependency/ipc/include/hks_ipc_check.h | 55 ++++++++++++
.../ipc/include/hks_ipc_serialization.h | 76 ++++++++++++++++
.../os_dependency/ipc/include/hks_ipc_slice.h | 34 +++++++
.../os_dependency/ipc/include/hks_request.h | 69 ++++++++++++++
.../ipc/include/hks_samgr_client.h | 32 +++++++
.../innerkits/huks_standard/main/BUILD.gn | 23 +++++
.../innerkits/huks_standard/main/include | 1 +
12 files changed, 482 insertions(+)
create mode 100755 huks/.gitattributes
create mode 100644 huks/BUILD.gn
create mode 100644 huks/bundle.json
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/BUILD.gn
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_client_ipc.h
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_check.h
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_serialization.h
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_slice.h
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_request.h
create mode 100644 huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_samgr_client.h
create mode 100644 huks/interfaces/innerkits/huks_standard/main/BUILD.gn
create mode 120000 huks/interfaces/innerkits/huks_standard/main/include
diff --git a/huks/BUILD.gn b/huks/BUILD.gn
new file mode 100644
index 0000000..e69de29
diff --git a/huks/bundle.json b/huks/bundle.json
new file mode 100644
index 0000000..635f7ed
--- /dev/null
+++ b/huks/bundle.json
@@ -0,0 +1,77 @@
+{
+ "name": "@ohos/huks",
+ "description": "The provider of key and certificate manangement capbility, which belongs to security subsystem",
+ "version": "3.1",
+ "license": "Apache License 2.0",
+ "publishAs": "code-segment",
+ "segment": {
+ "destPath": "base/security/huks"
+ },
+ "dirs":{},
+ "scripts": {
+ "install": "DEST_PATH=${DEP_BUNDLE_BASE}/base/security/huks && mkdir -p $DEST_PATH && cp -r ./* $DEST_PATH"
+ },
+ "author": {},
+ "repository": "",
+ "component": {
+ "name": "huks",
+ "subsystem": "security",
+ "syscap": [
+ "SystemCapability.Security.Huks",
+ "SystemCapability.Security.Cipher"
+ ],
+ "features": [],
+ "adapted_system_type": [
+ "standard",
+ "small",
+ "mini"
+ ],
+ "rom": "5000KB",
+ "ram": "500kB",
+ "deps": {
+ "components": [
+ "ability_base",
+ "access_token",
+ "bundle_framework",
+ "common",
+ "common_event_service",
+ "hisysevent_native",
+ "hitrace_native",
+ "hiviewdfx_hilog_native",
+ "ipc",
+ "napi",
+ "os_account",
+ "safwk",
+ "samgr",
+ "thirdparty_bounds_checking_function",
+ "c_utils"
+ ],
+ "third_party": [
+ "openssl",
+ "bounds_checking_function"
+ ]
+ },
+ "build": {
+ "group_type": {
+ "base_group": [],
+ "fwk_group": [
+
+ ],
+ "service_group": [
+
+ ]
+ },
+ "inner_kits": [
+ {
+ "name": "//base/security/huks/interfaces/innerkits/huks_standard/main:libhukssdk",
+ "header": {
+ "header_files": [
+ "hks_api.h"
+ ],
+ "header_base": "//base/security/huks/interfaces/innerkits/huks_standard/main/include"
+ }
+ }
+ ]
+ }
+ }
+ }
diff --git a/huks/frameworks/huks_standard/main/os_dependency/BUILD.gn b/huks/frameworks/huks_standard/main/os_dependency/BUILD.gn
new file mode 100644
index 0000000..3cc5c64
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/BUILD.gn
@@ -0,0 +1,10 @@
+import("//build/ohos.gni")
+
+config("huks_config") {
+ include_dirs = ["//base/security/huks/frameworks/huks_standard/main/os_dependency/ipc/include"]
+ libs = ["huks_os_dependency_standard_static"]
+}
+
+group("libhuks_os_dependency_standard_static") {
+ public_configs = [":huks_config"]
+}
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_client_ipc.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_client_ipc.h
new file mode 100644
index 0000000..206dfd4
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_client_ipc.h
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2021-2022 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 HKS_CLIENT_IPC_H
+#define HKS_CLIENT_IPC_H
+
+#include "hks_type_inner.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t HksClientInitialize(void);
+
+int32_t HksClientRefreshKeyInfo(void);
+
+int32_t HksClientGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn,
+ struct HksParamSet *paramSetOut);
+
+int32_t HksClientImportKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ const struct HksBlob *key);
+
+int32_t HksClientExportPublicKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ struct HksBlob *key);
+
+int32_t HksClientImportWrappedKey(const struct HksBlob *keyAlias, const struct HksBlob *wrappingKeyAlias,
+ const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData);
+
+int32_t HksClientDeleteKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet);
+
+int32_t HksClientGetKeyParamSet(const struct HksBlob *keyAlias, struct HksParamSet *paramSet);
+
+int32_t HksClientKeyExist(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet);
+
+int32_t HksClientGenerateRandom(struct HksBlob *random, const struct HksParamSet *paramSet);
+
+int32_t HksClientSign(const struct HksBlob *key, const struct HksParamSet *paramSet,
+ const struct HksBlob *srcData, struct HksBlob *signature);
+
+int32_t HksClientVerify(const struct HksBlob *key, const struct HksParamSet *paramSet,
+ const struct HksBlob *srcData, const struct HksBlob *signature);
+
+int32_t HksClientEncrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
+ const struct HksBlob *plainText, struct HksBlob *cipherText);
+
+int32_t HksClientDecrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
+ const struct HksBlob *cipherText, struct HksBlob *plainText);
+
+int32_t HksClientAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
+ const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey);
+
+int32_t HksClientDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *mainKey,
+ struct HksBlob *derivedKey);
+
+int32_t HksClientMac(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData,
+ struct HksBlob *mac);
+
+int32_t HksClientGetKeyInfoList(struct HksKeyInfo *keyInfoList, uint32_t *listCount);
+
+int32_t HksClientAttestKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ struct HksCertChain *certChain);
+
+int32_t HksClientInit(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet, struct HksBlob *handle,
+ struct HksBlob *token);
+
+int32_t HksClientUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData,
+ struct HksBlob *outData);
+
+int32_t HksClientFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet, const struct HksBlob *inData,
+ struct HksBlob *outData);
+
+int32_t HksClientAbort(const struct HksBlob *handle, const struct HksParamSet *paramSet);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HKS_CLIENT_IPC_H */
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_check.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_check.h
new file mode 100644
index 0000000..761247c
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_check.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2021 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 HKS_CRYPTO_CHECK_H
+#define HKS_CRYPTO_CHECK_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "hks_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t HksCheckIpcGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn);
+
+int32_t HksCheckIpcImportKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ const struct HksBlob *key);
+
+int32_t HksCheckIpcImportWrappedKey(const struct HksBlob *keyAlias, const struct HksBlob *wrappingKeyAlias,
+ const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData);
+
+int32_t HksCheckIpcExportPublicKey(const struct HksBlob *keyAlias, const struct HksBlob *key);
+
+int32_t HksCheckIpcGetKeyParamSet(const struct HksBlob *keyAlias, struct HksParamSet *paramSet);
+
+int32_t HksCheckIpcAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
+ const struct HksBlob *peerPublicKey, const struct HksBlob *agreedKey);
+
+int32_t HksCheckIpcDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *mainKey,
+ const struct HksBlob *derivedKey);
+
+int32_t HksCheckIpcGetKeyInfoList(const struct HksKeyInfo *keyInfoList, uint32_t listCount);
+
+int32_t HksCheckIpcCertificateChain(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ const struct HksCertChain *certChain);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_serialization.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_serialization.h
new file mode 100644
index 0000000..59cf16e
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_serialization.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2021-2022 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 HKS_IPC_SERIALIZATION_H
+#define HKS_IPC_SERIALIZATION_H
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#include "hks_type_inner.h"
+
+#define MAX_IPC_BUF_SIZE 0x10000 /* Maximun IPC message buffer size. */
+#define MAX_IPC_RSV_SIZE 0x400 /* Reserve IPC message buffer size */
+#define MAX_PROCESS_SIZE (MAX_IPC_BUF_SIZE - MAX_IPC_RSV_SIZE)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t CopyUint32ToBuffer(uint32_t value, const struct HksBlob *destBlob, uint32_t *destOffset);
+
+int32_t HksGenerateKeyPack(struct HksBlob *destData, const struct HksBlob *keyAlias,
+ const struct HksParamSet *paramSetIn, const struct HksBlob *keyOut);
+
+int32_t HksImportKeyPack(struct HksBlob *destData, const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
+ const struct HksBlob *key);
+
+int32_t HksImportWrappedKeyPack(struct HksBlob *destData, const struct HksBlob *keyAlias,
+ const struct HksBlob *wrappingKeyAlias, const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData);
+
+int32_t HksExportPublicKeyPack(struct HksBlob *destData, const struct HksBlob *keyAlias, const struct HksBlob *key);
+
+int32_t HksGetKeyParamSetPack(struct HksBlob *destData, const struct HksBlob *keyAlias, const struct HksBlob *keyOut);
+
+int32_t HksOnceParamPack(struct HksBlob *destData, const struct HksBlob *key, const struct HksParamSet *paramSet,
+ uint32_t *offset);
+
+int32_t HksOnceDataPack(struct HksBlob *destData, const struct HksBlob *inputData, const struct HksBlob *rsvData,
+ const struct HksBlob *outputData, uint32_t *offset);
+
+int32_t HksAgreeKeyPack(struct HksBlob *destData, const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
+ const struct HksBlob *peerPublicKey, const struct HksBlob *agreedKey);
+
+int32_t HksDeriveKeyPack(struct HksBlob *destData, const struct HksParamSet *paramSet, const struct HksBlob *kdfKey,
+ const struct HksBlob *derivedKey);
+
+int32_t HksGetKeyInfoListPack(struct HksBlob *destData, uint32_t listCount, const struct HksKeyInfo *keyInfoList);
+
+int32_t HksGetKeyInfoListUnpackFromService(const struct HksBlob *srcData, uint32_t *listCount,
+ struct HksKeyInfo *keyInfoList);
+
+int32_t HksCertificateChainPack(struct HksBlob *destData, const struct HksBlob *keyAlias,
+ const struct HksParamSet *paramSet, const struct HksBlob *certChainBlob);
+
+int32_t HksCertificateChainUnpackFromService(const struct HksBlob *srcData, bool needEncode,
+ struct HksCertChain *certChain);
+
+int32_t HksParamsToParamSet(struct HksParam *params, uint32_t cnt, struct HksParamSet **outParamSet);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HKS_IPC_SERIALIZATION_H */
\ No newline at end of file
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_slice.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_slice.h
new file mode 100644
index 0000000..a712cc1
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_ipc_slice.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021 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 HKS_IPC_SLICE_H
+#define HKS_IPC_SLICE_H
+
+#include <stdint.h>
+
+#include "hks_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int32_t HksSliceDataEntry(uint32_t cmdId, const struct HksBlob *key, const struct HksParamSet *paramSet,
+ struct HksBlob *inData, struct HksBlob *outData);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HKS_SLICE_H */
\ No newline at end of file
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_request.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_request.h
new file mode 100644
index 0000000..332fb99
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_request.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2021-2022 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 HKS_REQUEST_H
+#define HKS_REQUEST_H
+
+#include "hks_type_inner.h"
+
+enum HksMessage {
+#ifndef _HKS_L1_TEE_
+ HKS_MSG_BASE = 0x3a400, /* range of message value defined by router. globally unique */
+#else
+ HKS_MSG_BASE = 1000, /* range of message value defined by SmartLock. Max 65535 */
+#endif
+ HKS_MSG_GEN_KEY = HKS_MSG_BASE,
+ HKS_MSG_IMPORT_KEY,
+ HKS_MSG_EXPORT_PUBLIC_KEY,
+ HKS_MSG_IMPORT_WRAPPED_KEY,
+ HKS_MSG_DELETE_KEY,
+ HKS_MSG_GET_KEY_PARAMSET,
+ HKS_MSG_KEY_EXIST,
+ HKS_MSG_GENERATE_RANDOM,
+ HKS_MSG_SIGN,
+ HKS_MSG_VERIFY,
+ HKS_MSG_ENCRYPT,
+ HKS_MSG_DECRYPT,
+ HKS_MSG_AGREE_KEY,
+ HKS_MSG_DERIVE_KEY,
+ HKS_MSG_MAC,
+ HKS_MSG_GET_KEY_INFO_LIST,
+ HKS_MSG_ATTEST_KEY,
+ HKS_MSG_GET_CERTIFICATE_CHAIN,
+ HKS_MSG_INIT,
+ HKS_MSG_UPDATE,
+ HKS_MSG_FINISH,
+ HKS_MSG_ABORT,
+ HKS_MSG_MAX, /* new cmd type must be added before HKS_MSG_MAX */
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * SendRequest - Send the request message to target module by function call or ipc or other ways.
+ * @type: the request message type.
+ * @inBlob: the input serialized data blob.
+ * @outBlob: the output serialized data blob, can be null.
+ */
+int32_t HksSendRequest(enum HksMessage type, const struct HksBlob *inBlob, struct HksBlob *outBlob,
+ const struct HksParamSet *paramSet);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HKS_REQUEST_H */
diff --git a/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_samgr_client.h b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_samgr_client.h
new file mode 100644
index 0000000..b20f73b
--- /dev/null
+++ b/huks/frameworks/huks_standard/main/os_dependency/ipc/include/hks_samgr_client.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2021 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 HKS_SAMGR_CLIENT_H
+#define HKS_SAMGR_CLIENT_H
+
+#include "hks_samgr_server.h"
+#include "iproxy_client.h"
+
+typedef struct {
+ INHERIT_CLIENT_IPROXY;
+ int32_t (*IpcAsyncCallBack)(IUnknown *iUnknown, enum HksMessageType type, const struct HksBlob *inBlob,
+ struct HksBlob *outBlob);
+} HksMgrClientApi;
+
+typedef struct {
+ INHERIT_IUNKNOWNENTRY(HksMgrClientApi);
+} HksMgrClientEntry;
+
+#endif
\ No newline at end of file
diff --git a/huks/interfaces/innerkits/huks_standard/main/BUILD.gn b/huks/interfaces/innerkits/huks_standard/main/BUILD.gn
new file mode 100644
index 0000000..a539688
--- /dev/null
+++ b/huks/interfaces/innerkits/huks_standard/main/BUILD.gn
@@ -0,0 +1,23 @@
+# Copyright (C) 2021-2022 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("//build/ohos.gni")
+
+config("huks_config") {
+ include_dirs = [ "//base/security/huks/interfaces/innerkits/huks_standard/main/include" ]
+ libs = [ "hukssdk.z" ]
+}
+
+group("libhukssdk") {
+ public_configs = [ ":huks_config" ]
+}
diff --git a/huks/interfaces/innerkits/huks_standard/main/include b/huks/interfaces/innerkits/huks_standard/main/include
new file mode 120000
index 0000000..98a2378
--- /dev/null
+++ b/huks/interfaces/innerkits/huks_standard/main/include
@@ -0,0 +1 @@
+/usr/include/huks
\ No newline at end of file
--
2.33.0

View File

@ -0,0 +1,24 @@
From 1514ae3615cd6c376e6413c8b63775de39d9a2c1 Mon Sep 17 00:00:00 2001
From: wang--ge <wang__ge@126.com>
Date: Mon, 17 Jul 2023 17:55:44 +0800
Subject: [PATCH] establish kvstore dependence on boundscheck
---
.../kv_store/frameworks/libs/distributeddb/BUILD.gn | 1 +
1 file changed, 1 insertion(+)
diff --git a/distributeddatamgr/kv_store/frameworks/libs/distributeddb/BUILD.gn b/distributeddatamgr/kv_store/frameworks/libs/distributeddb/BUILD.gn
index d08716e..536f8ee 100644
--- a/distributeddatamgr/kv_store/frameworks/libs/distributeddb/BUILD.gn
+++ b/distributeddatamgr/kv_store/frameworks/libs/distributeddb/BUILD.gn
@@ -273,6 +273,7 @@ ohos_shared_library("distributeddb") {
deps = [
"//third_party/sqlite:sqlite",
"//third_party/zlib:shared_libz",
+ "//third_party/bounds_checking_function:libsec_shared",
]
configs += [ "//third_party/jsoncpp:jsoncpp_config" ]
--
2.33.0

116
bundle.json Normal file
View File

@ -0,0 +1,116 @@
{
"name": "@openharmony/distributeddatamgr_kv_store",
"version": "1.0.0",
"license": "Apache License 2.0",
"description": "",
"domain": "os",
"language": "",
"publishAs": "code-segment",
"private": false,
"tags": [
"foundation"
],
"keywords": [
"distributeddatamgr",
"kv_store"
],
"envs": [],
"author": {
"name": "",
"email": "",
"url": ""
},
"contributors": [
{
"name": "",
"email": "",
"url": ""
}
],
"segment": {
"destPath": "foundation/distributeddatamgr/kv_store"
},
"dirs": {},
"scripts": {},
"component": {
"name": "kv_store",
"subsystem": "distributeddatamgr",
"syscap": [
"SystemCapability.DistributedDataManager.KVStore.Core",
"SystemCapability.DistributedDataManager.KVStore.Lite",
"SystemCapability.DistributedDataManager.KVStore.DistributedKVStore"
],
"features": [],
"adapted_system_type": [
"standard"
],
"rom": "",
"ram": "",
"hisysevent_config": [],
"deps": {
"thrid_party": [
"uv_static",
"sqlite",
"libz",
"jsoncpp",
"libcrypto_shared"
],
"kernel_special": {},
"board_special": {},
"components": [
"libuv",
"common_event_service",
"bundle_framework",
"safwk",
"zlib",
"init",
"os_account",
"common",
"samgr",
"dataclassification",
"dsoftbus",
"jsoncpp",
"hitrace_native",
"access_token",
"huks",
"ability_base",
"ability_runtime",
"hiviewdfx_hilog_native",
"hisysevent_native",
"device_auth",
"ipc",
"napi"
]
},
"build": {
"sub_component": [
"//foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb:build_module",
"//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:build_module"
],
"inner_kits": [
{
"name": "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata:distributeddata_inner",
"header": {
"header_files": [
"blob.h",
"change_notification.h",
"distributed_kv_data_manager.h",
"kvstore.h",
"kvstore_death_recipient.h",
"kvstore_observer.h",
"kvstore_result_set.h",
"kvstore_sync_callback.h",
"single_kvstore.h",
"types.h",
"visibility.h",
"data_query.h",
"device_status_change_listener.h",
"store_errno.h"
],
"header_base": "//foundation/distributeddatamgr/kv_store/interfaces/innerkits/distributeddata/include"
}
}
]
}
}
}

View File

@ -0,0 +1,127 @@
%define debug_package %{nil}
%global oh_version OpenHarmony-v3.2-Release
%global distributeddata_dir %{_builddir}/foundation/distributeddatamgr/
%global build_opt /opt/distributed-middleware-build
%global bundle_dir %{build_opt}/openeuler/compiler_gn/foundation/distributeddatamgr/kv_store
Name: distributeddatamgr_kv_store
Version: 1.0.0
Release: 4
Summary: Supports distributed key-value data management
License: Apache-2.0
Url: https://gitee.com/openharmony/distributeddatamgr_kv_store
Source1: https://gitee.com/openharmony/distributeddatamgr_kv_store/repository/archive/%{oh_version}.tar.gz#/distributeddatamgr_kv_store-%{oh_version}.tar.gz
Source2: frameworks.BUILD.gn
Source3: interface.BUILD.gn
Source4: bundle.json
Patch1: 0001-remove-useless-dependency-datashare.patch
Patch2: 0002-remove-useless-dependency-hitrace-hisysevent.patch
Patch3: 0003-remove-useless-dependency-compile.patch
Patch4: 0004-establish-kvstore-dependence-on-boundscheck.patch
BuildRequires: libboundscheck, zlib, zlib-devel, jsoncpp, jsoncpp-devel, openssl-devel
BuildRequires: distributed-build, distributed-beget, hilog, commonlibrary_c_utils
BuildRequires: communication_ipc, communication_dsoftbus
BuildRequires: systemabilitymgr_safwk, systemabilitymgr_samgr
BuildRequires: security_dataclassification, security_device_auth, security_huks
BuildRequires: distributedhardware_device_manager
Requires: libboundscheck, zlib, zlib-devel, jsoncpp, jsoncpp-devel, openssl-devel
Requires: distributed-beget, hilog, commonlibrary_c_utils
Requires: communication_ipc, communication_dsoftbus
Requires: systemabilitymgr_safwk, systemabilitymgr_samgr
Requires: security_dataclassification, security_device_auth, security_huks
Requires: distributedhardware_device_manager
%description
KV database (KV store) is developed based on the KV storage capability provided by the current public basic library,and provides key-value pair data management capabilities for device applications. On a platform with processes, the parameter management provided by KV storage is accessed by a single process and cannot be used by other processes. On such platforms, KV storage is loaded in the application process as a basic library to ensure that it is not accessed by other processes.
%prep
rm -rf %{_builddir}/*
cp -rf %{build_opt} %{_builddir}/build
ln -s %{_builddir}/build/build_scripts/build.sh %{_builddir}/build.sh
ln -s %{_builddir}/build/core/gn/dotfile.gn %{_builddir}/.gn
ln -s %{_builddir}/build/lite/build.py %{_builddir}/build.py
cp -rf %{_builddir}/build/openeuler/vendor %{_builddir}/
cp -rf %{_builddir}/build/openeuler/compiler_gn/* %{_builddir}
%setup -q -D -T -a 1 -c -n %{distributeddata_dir}
if [ -d "%{distributeddata_dir}/kv_store" ]; then
rm -rf %{distributeddata_dir}/kv_store
fi
mv %{distributeddata_dir}/%{name}-%{oh_version} %{distributeddata_dir}/kv_store
%patch -P1 -p1 -d %{distributeddata_dir}/kv_store
%patch -P2 -p1 -d %{distributeddata_dir}/kv_store
%patch -P3 -p1 -d %{distributeddata_dir}/kv_store
%patch -P4 -p1 -d %{_builddir}/foundation
%build
%ifarch x86_64
%{_builddir}/build.sh --product-name openeuler --target-cpu x86_64
%endif
%ifarch aarch64
%{_builddir}/build.sh --product-name openeuler --target-cpu arm64
%endif
%install
%define frameworks_dir %{bundle_dir}/frameworks/libs/distributeddb
%define interface_dir %{bundle_dir}/interfaces/innerkits/distributeddata
install -d -m 0755 %{buildroot}/%{_includedir}/kv_store
install -d -m 0755 %{buildroot}/%{_libdir}
install -d -m 0755 %{buildroot}/%{frameworks_dir}
install -d -m 0755 %{buildroot}/%{interface_dir}
install -d -m 0755 %{buildroot}/system/lib64
cp %{SOURCE2} %{buildroot}/%{frameworks_dir}/BUILD.gn
cp %{SOURCE3} %{buildroot}/%{interface_dir}/BUILD.gn
cp %{SOURCE4} %{buildroot}/%{bundle_dir}
%ifarch aarch64
%define lib_out_path out/openeuler/linux_clang_arm64/distributeddatamgr/kv_store
%define header_out_path out/openeuler/innerkits/linux-arm64/kv_store
%endif
%ifarch x86_64
%define lib_out_path out/openeuler/linux_clang_x86_64/distributeddatamgr/kv_store
%define header_out_path out/openeuler/innerkits/linux-x86_64/kv_store
%endif
install -m 0755 %{_builddir}/%{lib_out_path}/*.so %{buildroot}%{_libdir}
install -m 0755 %{_builddir}/%{lib_out_path}/*.so %{buildroot}/system/lib64/
# 对外头文件使用kv_store功能的头文件
find %{_builddir}/%{header_out_path} -name *.h -print0 | xargs -0 -i cp -rf {} %{buildroot}%{_includedir}/kv_store/
%define rdb_header_path foundation/distributeddatamgr/kv_store/frameworks/innerkitsimpl/rdb/include
cp -rf %{_builddir}/%{rdb_header_path}/*.h %{buildroot}%{_includedir}/kv_store/
# 导出所有的头文件到编译目录,给其他分布式数据组件编译使用
pushd %{_builddir}/foundation/distributeddatamgr/kv_store
for include_file in `find . \( -name kvstoremock -o -name test -o -name jskitsimpl \) -prune -o -name "*.h" -type f`
do
if [[ ${include_file} != *.h ]]; then
continue
fi
cp --parents ${include_file} %{buildroot}%{bundle_dir}
done
popd
%files
%{_libdir}/*.so
%{_includedir}/kv_store/*
%{bundle_dir}/*
/system/*
%changelog
* Tue Nov 21 2023 Peng He <hepeng68@huawei.com> - 1.0.0-4
- Update build requires and requires.
* Fri Aug 04 2023 Yuying Mu <muyuying1@huawei.com> - 1.0.0-3
- Disassemble the original patch according to its function.
* Thu Aug 03 2023 Peng He <hepeng68@huawei.com> - 1.0.0-2
- Add requires and rectify the contents of the RPM package.
* Tue Jul 18 2023 Ge Wang <wang__ge@126.com> - 1.0.0-1
- init package

20
frameworks.BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
import("//build/ohos.gni")
config("distrdb_config") {
include_dirs = [
"interfaces/include",
"interfaces/include/relational",
"include"
# "/usr/include/kv_store",
# "/usr/include/openssl",
]
libs = [ "distributeddb.z" ]
}
group("distributeddb") {
public_configs = [ ":distrdb_config" ]
}
group("build_module") {
deps = [ ":distributeddb" ]
}

20
interface.BUILD.gn Normal file
View File

@ -0,0 +1,20 @@
import("//build/ohos.gni")
group("build_module") {
deps = [ ":distributeddata_inner" ]
}
config("distributeddatall_config") {
include_dirs = [
"include",
"../../../frameworks/innerkitsimpl/rdb/include",
"../../../frameworks/innerkitsimpl/object/include",
"../../../frameworks/innerkitsimpl/distributeddatafwk/include",
"//commonlibrary/c_utils/base/include",
]
libs = [ "distributeddata_inner.z" ]
}
group("distributeddata_inner") {
public_configs = [ ":distributeddatall_config" ]
}