1 /*
2 * Copyright (c) 2025 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 #include "softbus_authentication_init.h"
16 #include "softbus_init_common.h"
17 #include "softbus_error_code.h"
18 #include "comm_log.h"
19
AuthOpenFuncInit(void * soHandle)20 int32_t AuthOpenFuncInit(void *soHandle)
21 {
22 if (soHandle == NULL) {
23 COMM_LOGE(COMM_SVC, "libdsoftbus_server_plugin.z.so soHandle is null");
24 return SOFTBUS_NETWORK_DLOPEN_FAILED;
25 }
26 int32_t (*authRegisterOpenfunc)(void);
27
28 int ret = SOFTBUS_OK;
29
30 ret = SoftBusDlsym(soHandle, "AuthRegisterOpenFunc", (void**)&authRegisterOpenfunc);
31 if (ret != SOFTBUS_OK) {
32 COMM_LOGE(COMM_SVC, "dlsym AuthRegisterOpenFunc failed, ret=%d", ret);
33 return SOFTBUS_NETWORK_DLSYM_FAILED;
34 }
35
36 if (authRegisterOpenfunc() != SOFTBUS_OK) {
37 COMM_LOGE(COMM_SVC, "AuthRegisterOpenFunc return failed, ret=%d", ret);
38 return SOFTBUS_NETWORK_AUTH_OPEN_FUNC_INIT_FAILED;
39 }
40
41 return ret;
42 }