1 /*
2  * Copyright (c) 2020 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 HICHAIN_KEY_AGREEMENT_CLIENT_H
17 #define HICHAIN_KEY_AGREEMENT_CLIENT_H
18 
19 #include "key_agreement.h"
20 
21 typedef int32_t (*CLIENT_VIRTUAL_FUNC)(void *, void *);
22 
23 struct client_virtual_func_group {
24     CLIENT_VIRTUAL_FUNC build_start_request_data;
25     CLIENT_VIRTUAL_FUNC parse_start_response_data;
26     CLIENT_VIRTUAL_FUNC build_end_request_data;
27     CLIENT_VIRTUAL_FUNC parse_end_response_data;
28 };
29 
30 struct key_agreement_client {
31     struct key_agreement_protocol protocol_base_info;
32     struct client_virtual_func_group package_funcs;
33 };
34 
35 void init_client(struct key_agreement_client *handle, struct client_virtual_func_group *funcs);
36 int32_t send_start_request(void *handle, void *send_data);
37 int32_t send_end_request(void *handle, void *receive_data, void *send_data);
38 int32_t receive_end_response(void *handle, void *receive_data);
39 
40 #endif /* HICHAIN_KEY_AGREEMENT_CLIENT_H */
41