Print this page
6414175 kcf.conf's supportedlist not providing much usefulness

*** 17,32 **** * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* ! * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - /* * This file is part of the core Kernel Cryptographic Framework. * It implements the management of tables of Providers. Entries to * added and removed when cryptographic providers register with * and unregister from the framework, respectively. The KCF scheduler --- 17,30 ---- * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ /* ! * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* * This file is part of the core Kernel Cryptographic Framework. * It implements the management of tables of Providers. Entries to * added and removed when cryptographic providers register with * and unregister from the framework, respectively. The KCF scheduler
*** 52,74 **** #include <sys/crypto/sched_impl.h> #include <sys/crypto/spi.h> #define KCF_MAX_PROVIDERS 512 /* max number of providers */ ! static kmutex_t prov_tab_mutex; /* ensure exclusive access to the table */ static kcf_provider_desc_t **prov_tab = NULL; static uint_t prov_tab_num = 0; /* number of providers in table */ static uint_t prov_tab_max = KCF_MAX_PROVIDERS; #if DEBUG extern int kcf_frmwrk_debug; ! static void kcf_prov_tab_dump(void); #endif /* DEBUG */ /* ! * Initialize the providers table. The providers table is dynamically ! * allocated with prov_tab_max entries. */ void kcf_prov_tab_init(void) { mutex_init(&prov_tab_mutex, NULL, MUTEX_DRIVER, NULL); --- 50,86 ---- #include <sys/crypto/sched_impl.h> #include <sys/crypto/spi.h> #define KCF_MAX_PROVIDERS 512 /* max number of providers */ ! /* ! * Prov_tab is an array of providers which is updated when ! * a crypto provider registers with kcf. The provider calls the ! * SPI routine, crypto_register_provider(), which in turn calls ! * kcf_prov_tab_add_provider(). ! * ! * A provider unregisters by calling crypto_unregister_provider() ! * which triggers the removal of the prov_tab entry. ! * It also calls kcf_remove_mech_provider(). ! * ! * prov_tab entries are not updated from kcf.conf or by cryptoadm(1M). ! */ static kcf_provider_desc_t **prov_tab = NULL; + static kmutex_t prov_tab_mutex; /* ensure exclusive access to the table */ static uint_t prov_tab_num = 0; /* number of providers in table */ static uint_t prov_tab_max = KCF_MAX_PROVIDERS; #if DEBUG extern int kcf_frmwrk_debug; ! static void kcf_prov_tab_dump(char *message); #endif /* DEBUG */ + /* ! * Initialize a mutex and the KCF providers table, prov_tab. ! * The providers table is dynamically allocated with prov_tab_max entries. ! * Called from kcf module _init(). */ void kcf_prov_tab_init(void) { mutex_init(&prov_tab_mutex, NULL, MUTEX_DRIVER, NULL);
*** 122,132 **** prov_desc->pd_kcf_prov_handle = (crypto_kcf_provider_handle_t)prov_desc->pd_prov_id; #if DEBUG if (kcf_frmwrk_debug >= 1) ! kcf_prov_tab_dump(); #endif /* DEBUG */ return (CRYPTO_SUCCESS); } --- 134,144 ---- prov_desc->pd_kcf_prov_handle = (crypto_kcf_provider_handle_t)prov_desc->pd_prov_id; #if DEBUG if (kcf_frmwrk_debug >= 1) ! kcf_prov_tab_dump("kcf_prov_tab_add_provider"); #endif /* DEBUG */ return (CRYPTO_SUCCESS); }
*** 168,178 **** KCF_PROV_REFRELE(prov_desc); KCF_PROV_IREFRELE(prov_desc); #if DEBUG if (kcf_frmwrk_debug >= 1) ! kcf_prov_tab_dump(); #endif /* DEBUG */ return (CRYPTO_SUCCESS); } --- 180,190 ---- KCF_PROV_REFRELE(prov_desc); KCF_PROV_IREFRELE(prov_desc); #if DEBUG if (kcf_frmwrk_debug >= 1) ! kcf_prov_tab_dump("kcf_prov_tab_rem_provider"); #endif /* DEBUG */ return (CRYPTO_SUCCESS); }
*** 815,841 **** return (CRYPTO_SUCCESS); } #if DEBUG ! static void ! kcf_prov_tab_dump(void) { ! uint_t i; mutex_enter(&prov_tab_mutex); - printf("Providers table:\n"); for (i = 0; i < KCF_MAX_PROVIDERS; i++) { ! if (prov_tab[i] != NULL) { ! printf("[%d]: (%s) %s\n", ! i, (prov_tab[i]->pd_prov_type == ! CRYPTO_HW_PROVIDER) ? "HW" : "SW", ! prov_tab[i]->pd_description); } } printf("(end of providers table)\n"); mutex_exit(&prov_tab_mutex); } --- 827,866 ---- return (CRYPTO_SUCCESS); } #if DEBUG ! /* ! * Dump the Kernel crypto providers table, prov_tab. ! * If kcf_frmwrk_debug is >=2, also dump the mechanism lists. ! */ static void ! kcf_prov_tab_dump(char *message) { ! uint_t i, j; mutex_enter(&prov_tab_mutex); + printf("Providers table prov_tab at %s:\n", + message != NULL ? message : ""); for (i = 0; i < KCF_MAX_PROVIDERS; i++) { ! kcf_provider_desc_t *p = prov_tab[i]; ! if (p != NULL) { ! printf("[%d]: (%s) %d mechanisms, %s\n", i, ! (p->pd_prov_type == CRYPTO_HW_PROVIDER) ? ! "HW" : "SW", ! p->pd_mech_list_count, p->pd_description); ! if (kcf_frmwrk_debug >= 2) { ! printf("\tpd_mechanisms: "); ! for (j = 0; j < p->pd_mech_list_count; ++j) { ! printf("%s \n", ! p->pd_mechanisms[j].cm_mech_name); } + printf("\n"); } + } + } printf("(end of providers table)\n"); mutex_exit(&prov_tab_mutex); }