diff options
Diffstat (limited to 'usr/src/uts/common/crypto/io/blowfish.c')
-rw-r--r-- | usr/src/uts/common/crypto/io/blowfish.c | 50 |
1 files changed, 12 insertions, 38 deletions
diff --git a/usr/src/uts/common/crypto/io/blowfish.c b/usr/src/uts/common/crypto/io/blowfish.c index 92b23b5aa4..f475f1e961 100644 --- a/usr/src/uts/common/crypto/io/blowfish.c +++ b/usr/src/uts/common/crypto/io/blowfish.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Blowfish provider for the Kernel Cryptographic Framework (KCF) */ @@ -203,51 +201,27 @@ _init(void) { int ret; - /* - * Register with KCF. If the registration fails, return error. - */ - if ((ret = crypto_register_provider(&blowfish_prov_info, - &blowfish_prov_handle)) != CRYPTO_SUCCESS) { - cmn_err(CE_WARN, "%s _init: crypto_register_provider() " - "failed (0x%x)", CRYPTO_PROVIDER_NAME, ret); - return (EACCES); - } + if ((ret = mod_install(&modlinkage)) != 0) + return (ret); - if ((ret = mod_install(&modlinkage)) != 0) { - int rv; - - ASSERT(blowfish_prov_handle != NULL); - /* We should not return if the unregister returns busy. */ - while ((rv = crypto_unregister_provider(blowfish_prov_handle)) - == CRYPTO_BUSY) { - cmn_err(CE_WARN, - "%s _init: crypto_unregister_provider() " - "failed (0x%x). Retrying.", - CRYPTO_PROVIDER_NAME, 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(&blowfish_prov_info, + &blowfish_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 (blowfish_prov_handle != NULL) { - if ((ret = crypto_unregister_provider(blowfish_prov_handle)) != - CRYPTO_SUCCESS) { - cmn_err(CE_WARN, - "%s _fini: crypto_unregister_provider() " - "failed (0x%x)", CRYPTO_PROVIDER_NAME, ret); + if (crypto_unregister_provider(blowfish_prov_handle)) return (EBUSY); - } + blowfish_prov_handle = NULL; } |