diff options
author | wyllys <none@none> | 2007-04-27 06:41:28 -0700 |
---|---|---|
committer | wyllys <none@none> | 2007-04-27 06:41:28 -0700 |
commit | 85b65b39e9a6fea849facdcfc7d06f5ece340e36 (patch) | |
tree | a69843985ca795e7e7db82639162fe5549ef8d0b /usr/src | |
parent | 032ae3d9dc781b45931a4e8b7c4c527ff1419ddc (diff) | |
download | illumos-gate-85b65b39e9a6fea849facdcfc7d06f5ece340e36.tar.gz |
6550297 elfsign mysteriously fails with missing packages
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/lib/libkmf/libkmf/common/generalop.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/usr/src/lib/libkmf/libkmf/common/generalop.c b/usr/src/lib/libkmf/libkmf/common/generalop.c index d0b6d7bfa5..73b6d75611 100644 --- a/usr/src/lib/libkmf/libkmf/common/generalop.c +++ b/usr/src/lib/libkmf/libkmf/common/generalop.c @@ -140,6 +140,17 @@ static kmf_error_map kmf_errcodes[] = { {KMF_ERR_KEY_MISMATCH, "KMF_ERR_KEY_MISMATCH"} }; +typedef struct { + KMF_KEYSTORE_TYPE kstype; + char *path; + boolean_t critical; +} KMF_PLUGIN_ITEM; + +KMF_PLUGIN_ITEM plugin_list[] = { + {KMF_KEYSTORE_OPENSSL, KMF_PLUGIN_PATH "kmf_openssl.so.1", TRUE}, + {KMF_KEYSTORE_PK11TOKEN, KMF_PLUGIN_PATH "kmf_pkcs11.so.1", TRUE}, + {KMF_KEYSTORE_NSS, KMF_PLUGIN_PATH "kmf_nss.so.1", FALSE} +}; static void free_extensions(KMF_X509_EXTENSIONS *extns); @@ -311,6 +322,7 @@ KMF_Initialize(KMF_HANDLE_T *outhandle, char *policyfile, char *policyname) KMF_RETURN ret = KMF_OK; KMF_HANDLE *handle = NULL; KMF_PLUGIN *pluginrec = NULL; + int i, numitems; if (outhandle == NULL) return (KMF_ERR_BAD_PARAMETER); @@ -323,7 +335,6 @@ KMF_Initialize(KMF_HANDLE_T *outhandle, char *policyfile, char *policyname) (void) memset(handle, 0, sizeof (KMF_HANDLE)); handle->plugins = NULL; - /* Initialize the handle with the policy */ ret = KMF_SetPolicy((void *)handle, policyfile == NULL ? KMF_DEFAULT_POLICY_FILE : policyfile, @@ -331,33 +342,27 @@ KMF_Initialize(KMF_HANDLE_T *outhandle, char *policyfile, char *policyname) if (ret != KMF_OK) goto errout; - /* Create a record for the plugin */ - if ((ret = InitializePlugin(KMF_KEYSTORE_NSS, - KMF_PLUGIN_PATH "kmf_nss.so.1", &pluginrec)) != KMF_OK) - goto errout; - - /* Add it to the handle */ - if (pluginrec != NULL) { - if ((ret = AddPlugin(handle, pluginrec))) - goto errout; + numitems = sizeof (plugin_list)/sizeof (KMF_PLUGIN_ITEM); + for (i = 0; i < numitems; i++) { + ret = InitializePlugin(plugin_list[i].kstype, + plugin_list[i].path, &pluginrec); + if (ret != KMF_OK) { + cryptoerror( + plugin_list[i].critical ? LOG_WARNING : LOG_DEBUG, + "KMF was unable to load %s plugin module %s\n", + plugin_list[i].critical ? "critical" : "optional", + plugin_list[i].path); + + if (plugin_list[i].critical == FALSE) + ret = KMF_OK; + else + goto errout; + } + if (pluginrec != NULL) { + if ((ret = AddPlugin(handle, pluginrec))) + goto errout; + } } - if ((ret = InitializePlugin(KMF_KEYSTORE_OPENSSL, - KMF_PLUGIN_PATH "kmf_openssl.so.1", &pluginrec)) != KMF_OK) - goto errout; - - /* Add it to the handle */ - if (pluginrec != NULL) - if ((ret = AddPlugin(handle, pluginrec))) - goto errout; - - if ((ret = InitializePlugin(KMF_KEYSTORE_PK11TOKEN, - KMF_PLUGIN_PATH "kmf_pkcs11.so.1", &pluginrec)) != KMF_OK) - goto errout; - - /* Add it to the handle */ - if (pluginrec != NULL) - if ((ret = AddPlugin(handle, pluginrec))) - goto errout; CLEAR_ERROR(handle, ret); errout: |