1 /*
2  * Copyright (c) 2021-2024 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 HKS_CRYPTO_CHECK_H
17 #define HKS_CRYPTO_CHECK_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #include "hks_type.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 int32_t HksCheckIpcGenerateKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn);
29 
30 int32_t HksCheckIpcImportKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
31     const struct HksBlob *key);
32 
33 int32_t HksCheckIpcImportWrappedKey(const struct HksBlob *keyAlias, const struct HksBlob *wrappingKeyAlias,
34     const struct HksParamSet *paramSet, const struct HksBlob *wrappedKeyData);
35 
36 int32_t HksCheckIpcDeleteKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet);
37 
38 int32_t HksCheckIpcExportPublicKey(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
39     const struct HksBlob *key);
40 
41 int32_t HksCheckIpcGetKeyParamSet(const struct HksBlob *keyAlias, const struct HksParamSet *paramSetIn,
42     struct HksParamSet *paramSetOut);
43 
44 int32_t HksCheckIpcKeyExist(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet);
45 
46 int32_t HksCheckIpcAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
47     const struct HksBlob *peerPublicKey, const struct HksBlob *agreedKey);
48 
49 int32_t HksCheckIpcDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *mainKey,
50     const struct HksBlob *derivedKey);
51 
52 int32_t HksCheckIpcGetKeyInfoList(const struct HksKeyInfo *keyInfoList, const struct HksParamSet *paramSet,
53     uint32_t listCount);
54 
55 int32_t HksCheckIpcCertificateChain(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
56     const struct HksCertChain *certChain);
57 
58 int32_t HksCheckIpcListAliases(const struct HksParamSet *paramSet);
59 
60 int32_t HksCheckIpcRenameKeyAlias(const struct HksBlob *oldKeyAlias, const struct HksParamSet *paramSet,
61     const struct HksBlob *newKeyAlias);
62 
63 int32_t HksCheckIpcChangeStorageLevel(const struct HksBlob *keyAlias, const struct HksParamSet *srcParamSet,
64     const struct HksParamSet *destParamSet);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif