From: Eivind Næss Date: Sun, 11 Jul 2021 21:36:44 +0000 (-0700) Subject: Compiling with clang encounters an error in eap-tls.c X-Git-Tag: ppp-2.5.0~66^2~8 X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=6e6a48fe628b76ec368277fd52685428e3dc8766;p=ppp.git Compiling with clang encounters an error in eap-tls.c This moves the inline functions to outside the function and declares them static. Signed-off-by: Eivind Næss --- diff --git a/pppd/eap-tls.c b/pppd/eap-tls.c index 265f6d5..b15d801 100644 --- a/pppd/eap-tls.c +++ b/pppd/eap-tls.c @@ -285,6 +285,23 @@ ENGINE *eaptls_ssl_load_engine( char *engine_name ) #endif +#ifndef OPENSSL_NO_ENGINE +static int eaptls_UI_writer(UI *ui, UI_STRING *uis) +{ + PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui); + UI_set_result(ui, uis, cb_data->password); + return 1; +} + +static int eaptls_UI_stub(UI* ui) { + return 1; +} + +static int eaptls_UI_reader(UI *ui, UI_STRING *uis) { + return 1; +} +#endif + /* * Initialize the SSL stacks and tests if certificates, key and crl * for client or server use can be loaded. @@ -578,20 +595,11 @@ SSL_CTX *eaptls_init_ssl(int init_server, char *cacertfile, char *capath, { UI_METHOD* transfer_pin = UI_create_method("transfer_pin"); - int writer (UI *ui, UI_STRING *uis) - { - PW_CB_DATA* cb_data = (PW_CB_DATA*)UI_get0_user_data(ui); - UI_set_result(ui, uis, cb_data->password); - return 1; - }; - int stub (UI* ui) {return 1;}; - int stub_reader (UI *ui, UI_STRING *uis) {return 1;}; - - UI_method_set_writer(transfer_pin, writer); - UI_method_set_opener(transfer_pin, stub); - UI_method_set_closer(transfer_pin, stub); - UI_method_set_flusher(transfer_pin, stub); - UI_method_set_reader(transfer_pin, stub_reader); + UI_method_set_writer(transfer_pin, eaptls_UI_writer); + UI_method_set_opener(transfer_pin, eaptls_UI_stub); + UI_method_set_closer(transfer_pin, eaptls_UI_stub); + UI_method_set_flusher(transfer_pin, eaptls_UI_stub); + UI_method_set_reader(transfer_pin, eaptls_UI_reader); dbglog( "Using our private key URI: '%s' in engine", privkeyfile ); pkey = ENGINE_load_private_key(pkey_engine, privkeyfile, transfer_pin, &cb_data);