lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1299745272-25477-2-git-send-email-nab@linux-iscsi.org>
Date:	Thu, 10 Mar 2011 00:21:11 -0800
From:	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
To:	linux-kernel <linux-kernel@...r.kernel.org>,
	linux-crypto <linux-crypto@...r.kernel.org>,
	Herbert Xu <herbert@...dor.apana.org.au>
Cc:	James Bottomley <James.Bottomley@...e.de>,
	Christoph Hellwig <hch@....de>,
	Randy Dunlap <rdunlap@...otime.net>,
	linux-scsi <linux-scsi@...r.kernel.org>,
	Nicholas Bellinger <nab@...ux-iscsi.org>,
	Herbert Xu <herbert@...dor.apana.org.au>
Subject: [PATCH 1/2] crypto: Add struct crypto_alg->cra_check_optimized

From: Nicholas Bellinger <nab@...ux-iscsi.org>

This patch adds an optional struct crypto_alg->cra_check_optimized() caller
that can be used by libcrypto algorithms in order to load an architecture
dependent optimized / HW offload module.

This includes adding the call to alg->cra_check_optimized() inside of
crypto_larval_lookup() once the initial generic algorithm has been
loaded via request_module().

Signed-off-by: Nicholas A. Bellinger <nab@...ux-iscsi.org>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
---
 crypto/api.c           |    6 +++++-
 include/linux/crypto.h |    1 +
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/crypto/api.c b/crypto/api.c
index 033a714..4dcbef6 100644
--- a/crypto/api.c
+++ b/crypto/api.c
@@ -226,8 +226,12 @@ struct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 mask)
 		alg = crypto_alg_lookup(name, type, mask);
 	}
 
-	if (alg)
+	if (alg) {
+		if (alg->cra_check_optimized)
+			alg->cra_check_optimized(alg);
+
 		return crypto_is_larval(alg) ? crypto_larval_wait(alg) : alg;
+	}
 
 	return crypto_larval_add(name, type, mask);
 }
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index a6a7a1c..ea7c426 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -295,6 +295,7 @@ struct crypto_alg {
 
 	int (*cra_init)(struct crypto_tfm *tfm);
 	void (*cra_exit)(struct crypto_tfm *tfm);
+	void (*cra_check_optimized)(struct crypto_alg *alg);
 	void (*cra_destroy)(struct crypto_alg *alg);
 	
 	struct module *cra_module;
-- 
1.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ