1 /*
2 * client_hash_auth.h
3 *
4 * function definition for CA code hash auth
5 *
6 * Copyright (C) 2022 Huawei Technologies Co., Ltd.
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18 #ifndef CLIENT_HASH_CALC_H
19 #define CLIENT_HASH_CALC_H
20
21 #include "tc_ns_client.h"
22 #include "teek_ns_client.h"
23
24 #ifdef CONFIG_CLIENT_AUTH
25 #include "auth_base_impl.h"
26
27 int calc_client_auth_hash(struct tc_ns_dev_file *dev_file,
28 struct tc_ns_client_context *context, struct tc_ns_session *session);
29
30 #else
31
calc_client_auth_hash(struct tc_ns_dev_file * dev_file,struct tc_ns_client_context * context,struct tc_ns_session * session)32 static inline int calc_client_auth_hash(struct tc_ns_dev_file *dev_file,
33 struct tc_ns_client_context *context, struct tc_ns_session *session)
34 {
35 (void)dev_file;
36 (void)context;
37 (void)session;
38 return 0;
39 }
40
41 #endif
42
43 #ifdef CONFIG_AUTH_SUPPORT_UNAME
44 #define MAX_NAME_LENGTH 256
45
46 int tc_ns_get_uname(uint32_t uid, char *username, int buffer_len, uint32_t *out_len);
47 #endif
48
49 #ifdef CONFIG_AUTH_HASH
50 int set_login_information_hash(struct tc_ns_dev_file *hash_dev_file);
51 #endif
52
53 #endif
54