1 /*
2  * Copyright (c) 2021 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_CHECK_PARAMSET_H
17 #define HKS_CHECK_PARAMSET_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #include "hks_type_inner.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 int32_t HksCoreCheckGenKeyParams(const struct HksBlob *keyAlias, const struct HksParamSet *paramSet,
29     const struct HksBlob *keyIn, const struct HksBlob *keyOut, uint32_t keyFlag);
30 
31 int32_t HksCoreCheckImportKeyParams(const struct HksBlob *keyAlias, const struct HksBlob *key,
32     const struct HksParamSet *paramSet, const struct HksBlob *keyOut);
33 
34 int32_t HksCoreCheckImportWrappedKeyParams(const struct HksBlob *key, const struct HksBlob *wrappedKeyData,
35     const struct HksParamSet *paramSet, struct HksBlob *keyOut, uint32_t *outUnwrapSuite);
36 
37 int32_t HksCoreCheckSignVerifyParams(uint32_t cmdId, const struct HksBlob *key, const struct HksParamSet *paramSet,
38     const struct HksBlob *srcData, const struct HksBlob *signature);
39 
40 int32_t HksCoreCheckCipherParams(uint32_t cmdId, const struct HksBlob *key, const struct HksParamSet *paramSet,
41     const struct HksBlob *inData, const struct HksBlob *outData);
42 
43 int32_t HksCoreCheckAgreeKeyParams(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
44     const struct HksBlob *peerPublicKey, const struct HksBlob *agreedKey, bool isLocalCheck);
45 
46 int32_t HksLocalCheckSignVerifyParams(uint32_t cmdId, uint32_t keySize, const struct HksParamSet *paramSet,
47     const struct HksBlob *srcData, const struct HksBlob *signature);
48 
49 int32_t HksLocalCheckCipherParams(uint32_t cmdId, uint32_t keySize, const struct HksParamSet *paramSet,
50     const struct HksBlob *inData, const struct HksBlob *outData);
51 
52 int32_t HksCoreCheckDeriveKeyParams(const struct HksParamSet *paramSet, const struct HksBlob *mainKey,
53     const struct HksBlob *derivedKey, bool isLocalCheck);
54 
55 int32_t HksCoreCheckMacParams(const struct HksBlob *key, const struct HksParamSet *paramSet,
56     const struct HksBlob *srcData, const struct HksBlob *mac, bool isLocalCheck);
57 
58 int32_t HksCoreCheckAgreeDeriveFinishParams(const struct HksBlob *key, const struct HksParamSet *paramSet);
59 
60 #ifdef __cplusplus
61 }
62 #endif
63 
64 #endif /* HKS_CHECK_PARAMSET_H */
65