From f96ba7ffdacde02e9c3e989c8f6e3e7539b74b46 Mon Sep 17 00:00:00 2001 From: sam Date: Wed, 21 Mar 2007 03:42:51 +0000 Subject: Overhaul driver/subsystem api's: o make all crypto drivers have a device_t; pseudo drivers like the s/w crypto driver synthesize one o change the api between the crypto subsystem and drivers to use kobj; cryptodev_if.m defines this api o use the fact that all crypto drivers now have a device_t to add support for specifying which of several potential devices to use when doing crypto operations o add new ioctls that allow user apps to select a specific crypto device to use (previous ioctls maintained for compatibility) o overhaul crypto subsystem code to eliminate lots of cruft and hide implementation details from drivers o bring in numerous fixes from Michale Richardson/hifn; mostly for 795x parts o add an optional mechanism for mmap'ing the hifn 795x public key h/w to user space for use by openssl (not enabled by default) o update crypto test tools to use new ioctl's and add cmd line options to specify a device to use for tests These changes will also enable much future work on improving the core crypto subsystem; including proper load balancing and interposing code between the core and drivers to dispatch small operations to the s/w driver as appropriate. These changes were instigated by the work of Michael Richardson. Reviewed by: pjd Approved by: re --- sys/geom/eli/g_eli.c | 6 ++++-- sys/geom/eli/g_eli_crypto.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'sys/geom') diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c index 5aefe7a..d324008 100644 --- a/sys/geom/eli/g_eli.c +++ b/sys/geom/eli/g_eli.c @@ -662,12 +662,14 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp, * Use software cryptography, if we cannot get it. */ if (LIST_EMPTY(&sc->sc_workers)) { - error = crypto_newsession(&wr->w_sid, &crie, 1); + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_HARDWARE); if (error == 0) sc->sc_crypto = G_ELI_CRYPTO_HW; } if (sc->sc_crypto == G_ELI_CRYPTO_SW) - error = crypto_newsession(&wr->w_sid, &crie, 0); + error = crypto_newsession(&wr->w_sid, &crie, + CRYPTOCAP_F_SOFTWARE); if (error != 0) { free(wr, M_ELI); if (req != NULL) { diff --git a/sys/geom/eli/g_eli_crypto.c b/sys/geom/eli/g_eli_crypto.c index 817ff72..b484f90 100644 --- a/sys/geom/eli/g_eli_crypto.c +++ b/sys/geom/eli/g_eli_crypto.c @@ -73,7 +73,7 @@ g_eli_crypto_cipher(u_int algo, int enc, u_char *data, size_t datasize, cri.cri_alg = algo; cri.cri_key = __DECONST(void *, key); cri.cri_klen = keysize; - error = crypto_newsession(&sid, &cri, 0); + error = crypto_newsession(&sid, &cri, CRYPTOCAP_F_SOFTWARE); if (error != 0) return (error); p = malloc(sizeof(*crp) + sizeof(*crd) + sizeof(*uio) + sizeof(*iov), -- cgit v1.1