• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LOCAL_ENGINE_H
17 #define HKS_LOCAL_ENGINE_H
18 
19 #include <stdint.h>
20 
21 #include "hks_type.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 int32_t HksLocalMac(const struct HksBlob *key, const struct HksParamSet *paramSet,
28     const struct HksBlob *srcData, struct HksBlob *mac);
29 
30 int32_t HksLocalHash(const struct HksParamSet *paramSet, const struct HksBlob *srcData, struct HksBlob *hash);
31 
32 int32_t HksLocalBnExpMod(struct HksBlob *x, const struct HksBlob *a, const struct HksBlob *e, const struct HksBlob *n);
33 
34 int32_t HksLocalGenerateKey(const struct HksParamSet *paramSetIn, struct HksParamSet *paramSetOut);
35 
36 int32_t HksLocalEncrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
37     const struct HksBlob *plainText, struct HksBlob *cipherText);
38 
39 int32_t HksLocalDecrypt(const struct HksBlob *key, const struct HksParamSet *paramSet,
40     const struct HksBlob *cipherText, struct HksBlob *plainText);
41 
42 int32_t HksLocalAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey,
43     const struct HksBlob *peerPublicKey, struct HksBlob *agreedKey);
44 
45 int32_t HksLocalDeriveKey(const struct HksParamSet *paramSet, const struct HksBlob *mainKey,
46     struct HksBlob *derivedKey);
47 
48 int32_t HksLocalSign(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData,
49     struct HksBlob *signature);
50 
51 int32_t HksLocalVerify(const struct HksBlob *key, const struct HksParamSet *paramSet, const struct HksBlob *srcData,
52     const struct HksBlob *signature);
53 
54 #ifdef __cplusplus
55 }
56 #endif
57 
58 #endif /* HKS_LOCAL_ENGINE_H */