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 ALG_25519_COMMON_PARAM_SPEC_H
17 #define ALG_25519_COMMON_PARAM_SPEC_H
18 
19 #include <stdint.h>
20 #include "asy_key_generator.h"
21 #include "detailed_alg_25519_key_params.h"
22 #include "result.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 HcfResult ConstructAlg25519KeyPairParamsSpec(const char *algoName, bool choose, HcfAsyKeyParamsSpec **spec);
29 HcfResult ConstructAlg25519PubKeyParamsSpec(const char *algoName, bool choose, HcfAsyKeyParamsSpec **spec);
30 HcfResult ConstructAlg25519PriKeyParamsSpec(const char *algoName, bool choose, HcfAsyKeyParamsSpec **spec);
31 
32 HcfResult TestHcfAsyKeyGeneratorCreate(const char *algName, HcfAsyKeyGenerator **generator);
33 HcfResult TestGenerateKeyPair(HcfAsyKeyGenerator *generator, HcfKeyPair **keyPair);
34 HcfResult TestKeyGeneratorAndGenerateKeyPair(const char *algName, HcfAsyKeyGenerator **generator, HcfKeyPair **keyPair);
35 HcfResult TestGenerateConvertKey(HcfAsyKeyGenerator *generator, HcfBlob *pubKeyBlob, HcfBlob *priKeyBlob,
36     HcfKeyPair **keyPair);
37 HcfResult TestGenerateKeyPairAndConvertKey(const char *algName, HcfAsyKeyGenerator **generator, HcfBlob *pubKeyBlob,
38     HcfBlob *priKeyBlob, HcfKeyPair **keyPair);
39 HcfResult TestCreateKeyPairParamsSpecAndGeneratorBySpec(const char *algName, bool choose,
40     HcfAsyKeyParamsSpec **paramSpec, HcfAsyKeyGeneratorBySpec **generator);
41 HcfResult TestCreatePubKeyParamsSpecAndGeneratorBySpec(const char *algName, bool choose,
42     HcfAsyKeyParamsSpec **paramSpec, HcfAsyKeyGeneratorBySpec **generator);
43 HcfResult TestCreatePriKeyParamsSpecAndGeneratorBySpec(const char *algName, bool choose,
44     HcfAsyKeyParamsSpec **paramSpec, HcfAsyKeyGeneratorBySpec **generator);
45 
46 #ifdef __cplusplus
47 }
48 #endif
49 #endif
50