]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
OpenCrypto: Convert sessions to opaque handles instead of integers
authorcem <cem@FreeBSD.org>
Wed, 18 Jul 2018 00:56:25 +0000 (00:56 +0000)
committercem <cem@FreeBSD.org>
Wed, 18 Jul 2018 00:56:25 +0000 (00:56 +0000)
commit99ba792d73cb1765bd7271160d3d81500308a2c6
treeb9c915e7d2ca9312b6f83308f05040a78875b6d7
parentc5c20e2a791389e70183c9652be5b8655c8f6b32
OpenCrypto: Convert sessions to opaque handles instead of integers

Track session objects in the framework, and pass handles between the
framework (OCF), consumers, and drivers.  Avoid redundancy and complexity in
individual drivers by allocating session memory in the framework and
providing it to drivers in ::newsession().

Session handles are no longer integers with information encoded in various
high bits.  Use of the CRYPTO_SESID2FOO() macros should be replaced with the
appropriate crypto_ses2foo() function on the opaque session handle.

Convert OCF drivers (in particular, cryptosoft, as well as myriad others) to
the opaque handle interface.  Discard existing session tracking as much as
possible (quick pass).  There may be additional code ripe for deletion.

Convert OCF consumers (ipsec, geom_eli, krb5, cryptodev) to handle-style
interface.  The conversion is largely mechnical.

The change is documented in crypto.9.

Inspired by
https://lists.freebsd.org/pipermail/freebsd-arch/2018-January/018835.html .

No objection from: ae (ipsec portion)
Reported by: jhb
43 files changed:
share/man/man9/crypto.9
sys/crypto/aesni/aesni.c
sys/crypto/aesni/aesni.h
sys/crypto/armv8/armv8_crypto.c
sys/crypto/armv8/armv8_crypto.h
sys/crypto/blake2/blake2_cryptodev.c
sys/crypto/ccp/ccp.c
sys/crypto/ccp/ccp.h
sys/crypto/via/padlock.c
sys/crypto/via/padlock.h
sys/dev/cesa/cesa.c
sys/dev/cesa/cesa.h
sys/dev/cxgbe/crypto/t4_crypto.c
sys/dev/hifn/hifn7751.c
sys/dev/hifn/hifn7751var.h
sys/dev/safe/safe.c
sys/dev/safe/safevar.h
sys/dev/sec/sec.c
sys/dev/sec/sec.h
sys/dev/ubsec/ubsec.c
sys/dev/ubsec/ubsecvar.h
sys/geom/eli/g_eli.c
sys/geom/eli/g_eli_crypto.c
sys/geom/eli/g_eli_integrity.c
sys/geom/eli/g_eli_privacy.c
sys/kgssapi/krb5/kcrypto_aes.c
sys/kgssapi/krb5/kcrypto_des.c
sys/kgssapi/krb5/kcrypto_des3.c
sys/mips/cavium/cryptocteon/cryptocteon.c
sys/mips/nlm/dev/sec/nlmrsa.c
sys/mips/nlm/dev/sec/nlmrsalib.h
sys/mips/nlm/dev/sec/nlmsec.c
sys/mips/nlm/dev/sec/nlmseclib.h
sys/netipsec/ipsec.c
sys/netipsec/xform_ah.c
sys/netipsec/xform_esp.c
sys/netipsec/xform_ipcomp.c
sys/opencrypto/_cryptodev.h
sys/opencrypto/crypto.c
sys/opencrypto/cryptodev.c
sys/opencrypto/cryptodev.h
sys/opencrypto/cryptodev_if.m
sys/opencrypto/cryptosoft.c