mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
module: icp: rip out the Solaris loadable module architecture
After progressively folding away null cases, it turns out there's /literally/ nothing there, even if some things are part of the Solaris SPARC DDI/DKI or the seventeen module types (some doubled for 32-bit userland), or the entire modctl syscall definition. Nothing. Initialisation is handled in illumos-crypto.c, which calls all the initialisers directly Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Attila Fülöp <attila@fueloep.org> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #12895 Closes #12902
This commit is contained in:
+2
-26
@@ -32,27 +32,10 @@
|
||||
#include <sys/crypto/spi.h>
|
||||
#include <sys/crypto/icp.h>
|
||||
#include <modes/modes.h>
|
||||
#include <sys/modctl.h>
|
||||
#define _AES_IMPL
|
||||
#include <aes/aes_impl.h>
|
||||
#include <modes/gcm_impl.h>
|
||||
|
||||
#define CRYPTO_PROVIDER_NAME "aes"
|
||||
|
||||
extern struct mod_ops mod_cryptoops;
|
||||
|
||||
/*
|
||||
* Module linkage information for the kernel.
|
||||
*/
|
||||
static struct modlcrypto modlcrypto = {
|
||||
&mod_cryptoops,
|
||||
"AES Kernel SW Provider"
|
||||
};
|
||||
|
||||
static struct modlinkage modlinkage = {
|
||||
MODREV_1, { (void *)&modlcrypto, NULL }
|
||||
};
|
||||
|
||||
/*
|
||||
* Mechanism info structure passed to KCF during registration.
|
||||
*/
|
||||
@@ -199,20 +182,13 @@ static crypto_data_t null_crypto_data = { CRYPTO_DATA_RAW };
|
||||
int
|
||||
aes_mod_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Determine the fastest available implementation. */
|
||||
aes_impl_init();
|
||||
gcm_impl_init();
|
||||
|
||||
if ((ret = mod_install(&modlinkage)) != 0)
|
||||
return (ret);
|
||||
|
||||
/* Register with KCF. If the registration fails, remove the module. */
|
||||
if (crypto_register_provider(&aes_prov_info, &aes_prov_handle)) {
|
||||
(void) mod_remove(&modlinkage);
|
||||
if (crypto_register_provider(&aes_prov_info, &aes_prov_handle))
|
||||
return (EACCES);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -228,7 +204,7 @@ aes_mod_fini(void)
|
||||
aes_prov_handle = 0;
|
||||
}
|
||||
|
||||
return (mod_remove(&modlinkage));
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* CDDL HEADER START
|
||||
*
|
||||
* The contents of this file are subject to the terms of the
|
||||
* Common Development and Distribution License (the "License").
|
||||
* You may not use this file except in compliance with the License.
|
||||
*
|
||||
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
||||
* or http://opensource.org/licenses/CDDL-1.0.
|
||||
* See the License for the specific language governing permissions
|
||||
* and limitations under the License.
|
||||
*
|
||||
* When distributing Covered Code, include this CDDL HEADER in each
|
||||
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
||||
* If applicable, add the following below this CDDL HEADER, with the
|
||||
* fields enclosed by brackets "[]" replaced with your own identifying
|
||||
* information: Portions Copyright [yyyy] [name of copyright owner]
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2013 Saso Kiselkov. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/modctl.h>
|
||||
#include <sys/crypto/common.h>
|
||||
#include <sys/crypto/icp.h>
|
||||
#include <sys/crypto/spi.h>
|
||||
#include <sys/sysmacros.h>
|
||||
#include <sys/edonr.h>
|
||||
|
||||
/*
|
||||
* Unlike sha2 or skein, we won't expose edonr via the Kernel Cryptographic
|
||||
* Framework (KCF), because Edon-R is *NOT* suitable for general-purpose
|
||||
* cryptographic use. Users of Edon-R must interface directly to this module.
|
||||
*/
|
||||
|
||||
static struct modlmisc modlmisc = {
|
||||
&mod_cryptoops,
|
||||
"Edon-R Message-Digest Algorithm"
|
||||
};
|
||||
|
||||
static struct modlinkage modlinkage = {
|
||||
MODREV_1, {&modlmisc, NULL}
|
||||
};
|
||||
|
||||
int
|
||||
edonr_mod_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((error = mod_install(&modlinkage)) != 0)
|
||||
return (error);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
edonr_mod_fini(void)
|
||||
{
|
||||
return (mod_remove(&modlinkage));
|
||||
}
|
||||
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/modctl.h>
|
||||
#include <sys/crypto/common.h>
|
||||
#include <sys/crypto/icp.h>
|
||||
#include <sys/crypto/spi.h>
|
||||
@@ -33,25 +32,6 @@
|
||||
#include <sha1/sha1.h>
|
||||
#include <sha1/sha1_impl.h>
|
||||
|
||||
/*
|
||||
* The sha1 module is created with two modlinkages:
|
||||
* - a modlmisc that allows consumers to directly call the entry points
|
||||
* SHA1Init, SHA1Update, and SHA1Final.
|
||||
* - a modlcrypto that allows the module to register with the Kernel
|
||||
* Cryptographic Framework (KCF) as a software provider for the SHA1
|
||||
* mechanisms.
|
||||
*/
|
||||
|
||||
static struct modlcrypto modlcrypto = {
|
||||
&mod_cryptoops,
|
||||
"SHA1 Kernel SW Provider 1.1"
|
||||
};
|
||||
|
||||
static struct modlinkage modlinkage = {
|
||||
MODREV_1, { &modlcrypto, NULL }
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Macros to access the SHA1 or SHA1-HMAC contexts from a context passed
|
||||
* by KCF to one of the entry points.
|
||||
@@ -189,9 +169,6 @@ sha1_mod_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((ret = mod_install(&modlinkage)) != 0)
|
||||
return (ret);
|
||||
|
||||
/*
|
||||
* Register with KCF. If the registration fails, log an
|
||||
* error but do not uninstall the module, since the functionality
|
||||
@@ -208,7 +185,7 @@ sha1_mod_init(void)
|
||||
int
|
||||
sha1_mod_fini(void)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (sha1_prov_handle != 0) {
|
||||
if ((ret = crypto_unregister_provider(sha1_prov_handle)) !=
|
||||
@@ -221,7 +198,7 @@ sha1_mod_fini(void)
|
||||
sha1_prov_handle = 0;
|
||||
}
|
||||
|
||||
return (mod_remove(&modlinkage));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
*/
|
||||
|
||||
#include <sys/zfs_context.h>
|
||||
#include <sys/modctl.h>
|
||||
#include <sys/crypto/common.h>
|
||||
#include <sys/crypto/spi.h>
|
||||
#include <sys/crypto/icp.h>
|
||||
@@ -33,24 +32,6 @@
|
||||
#include <sys/sha2.h>
|
||||
#include <sha2/sha2_impl.h>
|
||||
|
||||
/*
|
||||
* The sha2 module is created with two modlinkages:
|
||||
* - a modlmisc that allows consumers to directly call the entry points
|
||||
* SHA2Init, SHA2Update, and SHA2Final.
|
||||
* - a modlcrypto that allows the module to register with the Kernel
|
||||
* Cryptographic Framework (KCF) as a software provider for the SHA2
|
||||
* mechanisms.
|
||||
*/
|
||||
|
||||
static struct modlcrypto modlcrypto = {
|
||||
&mod_cryptoops,
|
||||
"SHA2 Kernel SW Provider"
|
||||
};
|
||||
|
||||
static struct modlinkage modlinkage = {
|
||||
MODREV_1, {&modlcrypto, NULL}
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros to access the SHA2 or SHA2-HMAC contexts from a context passed
|
||||
* by KCF to one of the entry points.
|
||||
@@ -216,9 +197,6 @@ sha2_mod_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if ((ret = mod_install(&modlinkage)) != 0)
|
||||
return (ret);
|
||||
|
||||
/*
|
||||
* Register with KCF. If the registration fails, log an
|
||||
* error but do not uninstall the module, since the functionality
|
||||
@@ -235,7 +213,7 @@ sha2_mod_init(void)
|
||||
int
|
||||
sha2_mod_fini(void)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (sha2_prov_handle != 0) {
|
||||
if ((ret = crypto_unregister_provider(sha2_prov_handle)) !=
|
||||
@@ -248,7 +226,7 @@ sha2_mod_fini(void)
|
||||
sha2_prov_handle = 0;
|
||||
}
|
||||
|
||||
return (mod_remove(&modlinkage));
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
* Copyright 2013 Saso Kiselkov. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <sys/modctl.h>
|
||||
#include <sys/crypto/common.h>
|
||||
#include <sys/crypto/icp.h>
|
||||
#include <sys/crypto/spi.h>
|
||||
@@ -31,25 +30,6 @@
|
||||
#define SKEIN_MODULE_IMPL
|
||||
#include <sys/skein.h>
|
||||
|
||||
/*
|
||||
* Like the sha2 module, we create the skein module with two modlinkages:
|
||||
* - modlmisc to allow direct calls to Skein_* API functions.
|
||||
* - modlcrypto to integrate well into the Kernel Crypto Framework (KCF).
|
||||
*/
|
||||
static struct modlmisc modlmisc = {
|
||||
&mod_cryptoops,
|
||||
"Skein Message-Digest Algorithm"
|
||||
};
|
||||
|
||||
static struct modlcrypto modlcrypto = {
|
||||
&mod_cryptoops,
|
||||
"Skein Kernel SW Provider"
|
||||
};
|
||||
|
||||
static struct modlinkage modlinkage = {
|
||||
MODREV_1, {&modlmisc, &modlcrypto, NULL}
|
||||
};
|
||||
|
||||
static crypto_mech_info_t skein_mech_info_tab[] = {
|
||||
{CKM_SKEIN_256, SKEIN_256_MECH_INFO_TYPE,
|
||||
CRYPTO_FG_DIGEST | CRYPTO_FG_DIGEST_ATOMIC,
|
||||
@@ -214,11 +194,6 @@ skein_get_digest_bitlen(const crypto_mechanism_t *mechanism, size_t *result)
|
||||
int
|
||||
skein_mod_init(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
if ((error = mod_install(&modlinkage)) != 0)
|
||||
return (error);
|
||||
|
||||
/*
|
||||
* Try to register with KCF - failure shouldn't unload us, since we
|
||||
* still may want to continue providing misc/skein functionality.
|
||||
@@ -231,7 +206,7 @@ skein_mod_init(void)
|
||||
int
|
||||
skein_mod_fini(void)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if (skein_prov_handle != 0) {
|
||||
if ((ret = crypto_unregister_provider(skein_prov_handle)) !=
|
||||
@@ -244,7 +219,7 @@ skein_mod_fini(void)
|
||||
skein_prov_handle = 0;
|
||||
}
|
||||
|
||||
return (mod_remove(&modlinkage));
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user