• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __SEC_CLONE_SERVER_H__
17 #define __SEC_CLONE_SERVER_H__
18 
19 #include "hichain.h"
20 
21 enum SEC_CLONE_MESSAGE_TYPE {
22     SEC_CLONE_START_MSG = 1,
23     SEC_CLONE_END_MSG,
24 };
25 
26 #if (defined(_SUPPORT_SEC_CLONE_) || defined(_SUPPORT_SEC_CLONE_SERVER_))
27 
28 #include "base.h"
29 #include "key_agreement_server.h"
30 
31 struct sec_clone_server {
32     struct key_agreement_server server_info;
33     bool need_clean_temp_key;
34     hc_handle hichain_handle;
35     struct uint8_buff start_request_data;
36     struct uint8_buff client_sec_data;
37     struct hc_key_alias cert_key_alias;
38 };
39 
40 int32_t send_sec_clone_start_response(struct sec_clone_server *sec_clone_server,
41     const struct message *receive, struct message *send);
42 int32_t send_sec_clone_end_response(struct sec_clone_server *sec_clone_server,
43     const struct message *receive, struct message *send);
44 
45 #else
46 
47 struct sec_clone_server {
48     char rsv;
49 };
50 
51 #endif
52 
53 struct sec_clone_server *build_sec_clone_server(hc_handle hichain);
54 void destroy_sec_clone_server(struct sec_clone_server *handle);
55 
56 #endif
57