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 "sts_server.h"
17 #include "log.h"
18 
19 #if !(defined(_CUT_STS_) || defined(_CUT_STS_SERVER_))
20 
21 #include "securec.h"
22 #include "commonutil.h"
23 #include "distribution.h"
24 #include "mem_stat.h"
25 #include "huks_adapter.h"
26 
27 #ifdef DESC
28 #undef DESC
29 #endif
30 #define DESC(...) 1
31 
32 #define HC_STS_REQUEST_LEN  256
33 #define HC_STS_RESPONSE_LEN 256
34 
35 
destroy_sts_server(struct sts_server * handle)36 void destroy_sts_server(struct sts_server *handle)
37 {
38     if (handle == NULL) {
39         DBG_OUT("Destroy sts server object failed");
40         return;
41     }
42     (void)memset_s(&handle->self_private_key, sizeof(struct stsk), 0, sizeof(struct stsk));
43     (void)memset_s(&handle->session_key, sizeof(struct sts_session_key), 0, sizeof(struct sts_session_key));
44     (void)memset_s(&handle->service_key, sizeof(struct hc_session_key), 0, sizeof(struct hc_session_key));
45     FREE(handle);
46     LOGI("FREE sts server object success");
47 }
48 #else /* _CUT_XXX_ */
49 
50 #include "mem_stat.h"
51 
52 #endif /* _CUT_XXX_ */
53