summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/crypto/io/ecc.c
diff options
context:
space:
mode:
authorAnthony Scarpino <Anthony.Scarpino@Sun.COM>2010-02-23 13:34:52 -0800
committerAnthony Scarpino <Anthony.Scarpino@Sun.COM>2010-02-23 13:34:52 -0800
commitd3b2efc749bec3b757d5f018cf78c9a09fa29cb3 (patch)
tree2d3e389ca2be51b8fe1e4aed7072e59681fd52e2 /usr/src/uts/common/crypto/io/ecc.c
parent76fa7285ab719293f713601f68497677a82ce6f9 (diff)
downloadillumos-gate-d3b2efc749bec3b757d5f018cf78c9a09fa29cb3.tar.gz
6849769 crypto modules _init: crypto_register_provider() failed during shutdown
6885135 assertion failed: kcf_dh != NULL 6907099 module load/unload errors could be a little less techie and ominous
Diffstat (limited to 'usr/src/uts/common/crypto/io/ecc.c')
-rw-r--r--usr/src/uts/common/crypto/io/ecc.c46
1 files changed, 11 insertions, 35 deletions
diff --git a/usr/src/uts/common/crypto/io/ecc.c b/usr/src/uts/common/crypto/io/ecc.c
index 1cd7a26ed1..3d1a2c6317 100644
--- a/usr/src/uts/common/crypto/io/ecc.c
+++ b/usr/src/uts/common/crypto/io/ecc.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -248,50 +248,26 @@ _init(void)
{
int ret;
- /*
- * Register with KCF. If the registration fails, return error.
- */
- if ((ret = crypto_register_provider(&ecc_prov_info,
- &ecc_prov_handle)) != CRYPTO_SUCCESS) {
- cmn_err(CE_WARN, "ecc _init: crypto_register_provider()"
- "failed (0x%x)", ret);
- return (EACCES);
- }
+ if ((ret = mod_install(&modlinkage)) != 0)
+ return (ret);
- if ((ret = mod_install(&modlinkage)) != 0) {
- int rv;
-
- ASSERT(ecc_prov_handle != NULL);
- /* We should not return if the unregister returns busy. */
- while ((rv = crypto_unregister_provider(ecc_prov_handle))
- == CRYPTO_BUSY) {
- cmn_err(CE_WARN, "ecc _init: "
- "crypto_unregister_provider() "
- "failed (0x%x). Retrying.", rv);
- /* wait 10 seconds and try again. */
- delay(10 * drv_usectohz(1000000));
- }
+ /* Register with KCF. If the registration fails, remove the module. */
+ if (crypto_register_provider(&ecc_prov_info, &ecc_prov_handle)) {
+ (void) mod_remove(&modlinkage);
+ return (EACCES);
}
- return (ret);
+ return (0);
}
int
_fini(void)
{
- int ret;
-
- /*
- * Unregister from KCF if previous registration succeeded.
- */
+ /* Unregister from KCF if module is registered */
if (ecc_prov_handle != NULL) {
- if ((ret = crypto_unregister_provider(ecc_prov_handle)) !=
- CRYPTO_SUCCESS) {
- cmn_err(CE_WARN, "ecc _fini: "
- "crypto_unregister_provider() "
- "failed (0x%x)", ret);
+ if (crypto_unregister_provider(ecc_prov_handle))
return (EBUSY);
- }
+
ecc_prov_handle = NULL;
}