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 HCF_DETAILED_DH_KEY_PARAMS_H 17 #define HCF_DETAILED_DH_KEY_PARAMS_H 18 19 #include <stdint.h> 20 #include <stdbool.h> 21 22 #include "asy_key_params.h" 23 #include "big_integer.h" 24 25 typedef struct HcfDhCommParamsSpec { 26 HcfAsyKeyParamsSpec base; 27 HcfBigInteger p; 28 HcfBigInteger g; 29 int length; 30 } HcfDhCommParamsSpec; 31 32 typedef struct HcfDhPubKeyParamsSpec { 33 HcfDhCommParamsSpec base; 34 HcfBigInteger pk; 35 } HcfDhPubKeyParamsSpec; 36 37 typedef struct HcfDhPriKeyParamsSpec { 38 HcfDhCommParamsSpec base; 39 HcfBigInteger sk; 40 } HcfDhPriKeyParamsSpec; 41 42 typedef struct HcfDhKeyPairParamsSpec { 43 HcfDhCommParamsSpec base; 44 HcfBigInteger sk; 45 HcfBigInteger pk; 46 } HcfDhKeyPairParamsSpec; 47 #ifdef __cplusplus 48 extern "C" { 49 #endif 50 51 void FreeDhCommParamsSpec(HcfDhCommParamsSpec *spec); 52 53 void DestroyDhPubKeySpec(HcfDhPubKeyParamsSpec *spec); 54 55 void DestroyDhPriKeySpec(HcfDhPriKeyParamsSpec *spec); 56 57 void DestroyDhKeyPairSpec(HcfDhKeyPairParamsSpec *spec); 58 59 60 #ifdef __cplusplus 61 } 62 #endif 63 #endif