Description: Fix error EAP-TLS: Cannot load PKCS11 key When attempting EAP authentication private key could not be loaded by SSL engine. Some PKCS11 modules, like Netkey TCOS 3.0, do not support setting the password in the ENGINE_load_private_key() call. This patch uses ENGINE_ctrl_cmd_string(engine, "PIN", passwd, 0)) instead. This method should work for all PKCS11 modules. Forwarded: no Author: Werner Jaeger --- a/pppd/eap-tls.c +++ b/pppd/eap-tls.c @@ -466,13 +466,15 @@ if (pkey_engine) { EVP_PKEY *pkey = NULL; - PW_CB_DATA cb_data; - - cb_data.password = passwd; - cb_data.prompt_info = pkey_identifier; + dbglog("Setting PIN"); + if (!ENGINE_ctrl_cmd_string(pkey_engine, "PIN", passwd, 0)) + { + error("EAP-TLS: Setting ÜIN failed"); + goto fail; + } dbglog( "Loading private key '%s' from engine", pkey_identifier ); - pkey = ENGINE_load_private_key(pkey_engine, pkey_identifier, NULL, &cb_data); + pkey = ENGINE_load_private_key(pkey_engine, pkey_identifier, NULL, NULL); if (pkey) { dbglog( "Got the private key, adding it to SSL context" );