zkey_kmip: Setup ext-lib once the APQNs have been configured

During plugin initialization, the external libraries such as the
EP11 or CCA host libraries are set up, if the configuration is
appropriate.

A secure identity key may be generated once the APQNs are configured,
but before the server connection is configured. Trying to re-encipher
the plugin's secure keys to a new HSM master key at that stage fails
with 'ERROR: Invalid ext lib type: 0' because the external libraries
have not been setup yet.

Change the code to setup the libraries once the APQNs have been
configured, and not only after the server connection has been
configured.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2022-06-10 14:28:41 +02:00
committed by Jan Höppner
parent 80e54ac888
commit f7c048d0eb

View File

@@ -670,13 +670,16 @@ static int _get_kmip_config(struct plugin_handle *ph)
char *tmp;
int rc;
if (ph->server == NULL || ph->profile == NULL)
if (!ph->apqns_configured)
return 0;
rc = _setup_ext_lib(ph);
if (rc != 0)
return rc;
if (ph->server == NULL || ph->profile == NULL)
return 0;
rc = _get_client_key(ph, &ph->kmip_config.tls_client_key);
if (rc != 0)
return rc;