• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef HUKS_HDI_PASSTHROUGH_ADAPTER_H
17 #define HUKS_HDI_PASSTHROUGH_ADAPTER_H
18 
19 #include "huks_hdi_template.h"
20 #include "huks_sa_type.h"
21 #include "huks_sa_hdi_struct.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 int32_t HuksHdiAdapterGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn,
28     const struct HksBlob *keyIn, struct HksBlob *keyOut);
29 
30 int32_t HuksHdiAdapterSign(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData,
31     struct HksBlob *signature);
32 
33 int32_t HuksHdiAdapterVerify(const struct HksBlob *key, const struct HksParamSet *paramSet,
34     const struct HksBlob *srcData, const struct HksBlob *signature);
35 
36 int32_t HuksHdiAdapterEncrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
37     const struct HksBlob *plainText, struct HksBlob *cipherText);
38 
39 int32_t HuksHdiAdapterDecrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
40     const struct HksBlob *cipherText, struct HksBlob *plainText);
41 
42 int32_t HuksHdiAdapterGenerateRandom(const struct HksParamSet *paramSet, struct HksBlob *random);
43 
44 int32_t HuksHdiAdapterGetErrorInfo(struct  HksBlob *errorInfo);
45 
46 int32_t HuksHdiAdapterGetStatInfo(struct  HksBlob *statInfo);
47 
48 int32_t HuksHdiAdapterImportKey(const struct HksBlob *keyAlias, const struct HksBlob *key,
49     const struct HksParamSet *paramSet, struct HksBlob *keyOut);
50 
51 int32_t HuksHdiAdapterExportPublicKey(const struct HksBlob *key, const struct HksParamSet *paramSet,
52     struct HksBlob *keyOut);
53 
54 int32_t HuksHdiAdapterAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
55     const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey);
56 
57 int32_t HuksHdiAdapterDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *kdfKey,
58     struct HksBlob *derivedKey);
59 
60 int32_t HuksHdiAdapterMac(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData,
61     struct HksBlob *mac);
62 
63 int32_t HuksHdiAdapterModuleInit(void);
64 
65 int32_t HuksHdiAdapterModuleDestroy(void);
66 
67 int32_t HuksHdiAdapterImportWrappedKey(const struct HksBlob *wrappingKeyAlias, const struct HksBlob *wrappingKey,
68     const struct HksBlob *wrappedKeyData, const struct HksParamSet *paramSet, struct HksBlob *keyOut);
69 
70 int32_t HuksHdiAdapterInit(const struct  HksBlob *key, const struct HksParamSet *paramSet, struct HksBlob *handle,
71     struct HksBlob *token);
72 
73 int32_t HuksHdiAdapterUpdate(const struct HksBlob *handle, const struct HksParamSet *paramSet,
74     const struct HksBlob *inData, struct HksBlob *outData);
75 
76 int32_t HuksHdiAdapterFinish(const struct HksBlob *handle, const struct HksParamSet *paramSet,
77     const struct HksBlob *inData, struct HksBlob *outData);
78 
79 int32_t HuksHdiAdapterAbort(const struct HksBlob *handle, const struct HksParamSet *paramSet);
80 
81 int32_t HuksHdiAdapterGetKeyProperties(const struct HksParamSet *paramSet, const struct HksBlob *key);
82 
83 int32_t HuksHdiAdapterAttestKey(const struct HksBlob *key, const  struct HksParamSet *paramSet,
84     struct HksBlob *certChain);
85 
86 int32_t HuksHdiAdapterUpgradeKey(const struct HksBlob *oldKey, const struct HksParamSet *paramSet,
87     struct HksBlob *newKey);
88 
89 int32_t HuksInitHuksCoreEngine(void);
90 
91 int32_t HuksReleaseCoreEngine(void);
92 
93 struct HuksHdi *HuksGetCoreEngine(void);
94 
95 #ifdef __cplusplus
96 }
97 #endif
98 
99 #endif