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 #include "pake_server.h"
17 #include "log.h"
18
19 #if !(defined(_CUT_PAKE_) || defined(_CUT_PAKE_SERVER_))
20
21 #include "securec.h"
22 #include "huks_adapter.h"
23 #include "mem_stat.h"
24
25 #ifdef DESC
26 #undef DESC
27 #endif
28 #define DESC(...) 1
29
30
31 #define HICHAIN_SPEKE_BASE_INFO "hichain_speke_base_info"
32 #define HICHAIN_RETURN_KEY "hichain_return_key"
33 #define HICHAIN_SPEKE_SESSIONKEY_INFO "hichain_speke_sessionkey_info"
34
35 #if DESC("interface")
36
destroy_pake_server(struct pake_server * pake_server)37 void destroy_pake_server(struct pake_server *pake_server)
38 {
39 if (pake_server == NULL) {
40 return;
41 }
42
43 LOGI("Destroy pake server object %u success", pake_server_sn(pake_server));
44 (void)memset_s(&pake_server->pin, sizeof(struct hc_pin), 0, sizeof(struct hc_pin));
45 (void)memset_s(&pake_server->self_esk, sizeof(struct esk), 0, sizeof(struct esk));
46 (void)memset_s(&pake_server->session_key, sizeof(struct pake_session_key), 0, sizeof(struct pake_session_key));
47 (void)memset_s(&pake_server->hmac_key, sizeof(struct pake_hmac_key), 0, sizeof(struct pake_hmac_key));
48 (void)memset_s(&pake_server->service_key, sizeof(struct hc_session_key), 0, sizeof(struct hc_session_key));
49 FREE(pake_server);
50 }
51
52 #endif /* DESC */
53
54 #if DESC("virtual") /* called by base class */
55
56 #endif /* DESC */
57
58
59 #else /* _CUT_XXX_ */
60
61 #include "stdlib_south.h"
62
63 #endif /* _CUT_XXX_ */
64