History log of /src/sys/opencrypto/cryptodev.h |
Revision | | Date | Author | Comments |
1.51 |
| 11-Jul-2023 |
riastradh | opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL. - Add some other necessary includes and forward declarations. - Sort.
|
1.50 |
| 22-May-2022 |
riastradh | branches: 1.50.4; opencrypto: crypto_dispatch never fails now. Make it return void.
Same with crypto_kdispatch.
|
1.49 |
| 22-May-2022 |
riastradh | opencrypto: Rip out EAGAIN logic when unregistering crypto drivers.
I'm pretty sure this never worked reliably based on code inspection, and it's unlikely to have ever been tested because it only applies when unregistering a driver -- but we have no crypto drivers for removable devices, so it would only apply if we went out of our way to trigger detach with drvctl.
Instead, just make the operation fail with ENODEV, and remove all the callback logic to resubmit the request on EAGAIN. (Maybe this should be ENXIO, but crypto_kdispatch already does ENODEV.)
|
1.48 |
| 22-May-2022 |
riastradh | opencrypto: Make crypto_freesession return void.
No callers use the return value. It is not sensible to allow this to fail.
|
1.47 |
| 22-May-2022 |
riastradh | opencrypto: Make freesession callback return void.
No functional change intended: all drivers already return zero unconditionally.
|
1.46 |
| 22-May-2022 |
riastradh | opencrypto: Make crp_callback, krp_callback return void.
Nothing uses the return values inside opencrypto, so let's stop making users return them.
|
1.45 |
| 22-May-2022 |
riastradh | opencrypto: Nix CRYPTO_F_DONE.
Nothing uses it any more.
|
1.44 |
| 22-May-2022 |
riastradh | opencrypto: Make sid=0 always invalid, but OK to free.
Previously, crypto_newsession could sometimes return 0 as the driver-specific part of the session id, and 0 as the hid, for sid=0. But netipsec assumes that it is always safe to free sid=0 from zero-initialized memory even if crypto_newsession has never succeeded. So it was up to every driver in tree to gracefully handle sid=0, if it happened to get assigned hid=0. And, as long as the freesession callback was expected to just return an error code when given a bogus session id, that worked out fine...because nothing ever used the error code.
That was a terrible fragile system that should never have been invented. Instead, let's just ensure that valid session ids are nonzero, and make crypto_freesession with sid=0 be a no-op.
|
1.43 |
| 19-May-2022 |
riastradh | opencrypto: Nix CRYPTO_F_USER, CRYPTO_F_CBIMM, CRYPTO_F_CBIFSYNC.
CRYPTO_F_USER is no longer needed. It was introduced in 2008 by darran@ in crypto.c 1.30, cryptodev.c 1.45 in an attempt to avoid double-free between the issuing thread and asynchronous callback. But the `fix' didn't work. In 2017, knakahara@ fixed it properly in cryptodev.c 1.87 by distinguishing `the crypto operation has completed' (CRYPTO_F_DONE) from `the callback is done touching the crp object' (CRYPTO_F_DQRETQ, now renamed to CRYPTODEV_F_RET).
CRYPTO_F_CBIMM formerly served to invoke the callback synchronously from the driver's interrupt completion routine, to reduce contention on what was once a single cryptoret thread. Now, there is a per-CPU queue and softint for much cheaper processing, so there is less motivation for this in the first place. So let's remove the complicated logic. This means the callbacks never run in hard interrupt context, which means we don't need to worry about recursion into crypto_dispatch in hard interrupt context.
|
1.42 |
| 14-Aug-2021 |
andvar | fix typo in CRK_ALGORITHM_MIN definition to match CRK_ALGORITHM_MAX one. while here fix few typos in comments.
|
1.41 |
| 09-Aug-2021 |
andvar | fix typos in asymmetry, asymmetric(al), symmetrical.
|
1.40 |
| 29-Nov-2019 |
hikaru | HMAC-SHA-512 has 32 bytes MAC.
|
1.39 |
| 26-Jul-2017 |
knakahara | branches: 1.39.4; update locking notes of opencrypto(9)
|
1.38 |
| 18-Jul-2017 |
knakahara | branches: 1.38.2; make cryptoret() context softint to balance dequeuing crypto_ret_q with enqueuing it.
|
1.37 |
| 15-Jun-2017 |
knakahara | Divide crp_devflags from crp_flags to write exclusively.
CRYPTO_F_DQRETQ(new name is CRYPTODEV_F_RET) is used by cryptodev.c only. It should be divided to other member.
|
1.36 |
| 06-Jun-2017 |
knakahara | add locking notes.
|
1.35 |
| 06-Jun-2017 |
knakahara | restructure locks(1/2): make relation between lock and data explicit.
+ crypto_drv_mtx protects - whole crypto_drivers + crypto_drivers[i].cc_lock (new) protects - crypto_drivers[i] itself - member of crypto_drivers[i] + crypto_q_mtx protects - crp_q - crp_kq + crypto_ret_q_mtx protects - crp_ret_q - crp_ret_kq - crypto_exit_flag
I will add locking note later.
|
1.34 |
| 25-May-2017 |
knakahara | branches: 1.34.2; add cryptkop alloc/free KPI instead of manipulating cryptkop_pool directly.
|
1.33 |
| 25-May-2017 |
knakahara | remove obsoleted declarations.
|
1.32 |
| 17-May-2017 |
knakahara | opencrypto: cleanup debug messages.
|
1.31 |
| 24-Apr-2017 |
knakahara | branches: 1.31.2; separate crypto_drv_mtx from crypto_mtx.
crypto_mtx is used only for cryptodev.c and ocryptodev.c now.
|
1.30 |
| 07-Apr-2017 |
knakahara | fix race among crypto_done(), cryptoret(), and {cryptodev_op(), cryptodev_key()}.
crypto_op() waited to be set CRYPTO_F_DONE with crp->crp_cv. However, there is context switch chances between being set CRYPTO_F_DONE in crypto_done() and done cv_signal(crp->crp_cv) in cryptodev_cb(), that is, cryptodev_op() thread can run to cv_destroy(crp->crp_cv) before cryptoret() thread is waken up. As a result, cryptodev_cb() can call invalid(destroyed) cv_signal(crp->crp_cv).
Furthermore, below two implementations cause other races. - waiting CRYPTO_F_DONE with crp->crp_cv - context witch chances between set CRYPTO_F_DONE and cv_signal(crp->crp_cv)
So, use other flag(CRYPTO_F_DQRETQ) for cryptodev_op() and cryptodev_key(), and then call cv_signal(crp->crp_cv) immediately after set CRYPTO_F_DQRETQ.
Tested concurrent over 20 processes with software and hardware drivers.
|
1.29 |
| 06-Mar-2017 |
knakahara | add sysctl to select software/hardware encryption driver. can enable CRYPTO_DEBUG.
|
1.28 |
| 07-Jul-2016 |
msaitoh | branches: 1.28.2; 1.28.4; KNF. Remove extra spaces. No functional change.
|
1.27 |
| 22-Jan-2016 |
dholland | Needs sys/time.h for struct timespec.
|
1.26 |
| 28-Nov-2015 |
pgoyette | Re-work the module init and destroy code to allow it to be unloaded and then reloaded.
Should fix PR kern/49842
|
1.25 |
| 09-Jun-2011 |
drochner | branches: 1.25.12; 1.25.30; -if an opencrypto(9) session is allocated, the driver is refcounted and can not disappear -- no need to hold crypto_mtx to check the driver list (the whole check is questionable) -crp->crp_cv (the condition variable) is used by userland cryptodev exclusively -- move its initialization there, no need to waste cycles of in-kernel callers -add a comment which members of "struct cryptop" are used by opencrypto(9) and which by crypto(4) (this should be split, no need to waste memory for in-kernel callers)
|
1.24 |
| 26-May-2011 |
drochner | branches: 1.24.2; pull in AES-GCM/GMAC support from OpenBSD This is still somewhat experimental. Tested between 2 similar boxes so far. There is much potential for performance improvement. For now, I've changed the gmac code to accept any data alignment, as the "char *" pointer suggests. As the code is practically used, 32-bit alignment can be assumed, at the cost of data copies. I don't know whether bytewise access or copies are worse performance-wise. For efficient implementations using SSE2 instructions on x86, even stricter alignment requirements might arise.
|
1.23 |
| 24-May-2011 |
drochner | copy AES-XCBC-MAC support from KAME IPSEC to FAST_IPSEC For this to fit, an API change in cryptosoft was adopted from OpenBSD (addition of a "Setkey" method to hashes) which was done for GCM/GMAC support there, so it might be useful in the future anyway. tested against KAME IPSEC AFAICT, FAST_IPSEC now supports as much as KAME.
|
1.22 |
| 23-May-2011 |
drochner | add an AES-CTR xform, from OpenBSD
|
1.21 |
| 16-May-2011 |
drochner | remove redundant declarations
|
1.20 |
| 05-May-2011 |
drochner | make camellia-cbc known to the opencrypto framework
|
1.19 |
| 25-Feb-2011 |
drochner | make the use of SHA2-HMAC by FAST_IPSEC compliant to current standards: -RFC2104 says that the block size of the hash algorithm must be used for key/ipad/opad calculations. While formerly all ciphers used a block length of 64, SHA384 and SHA512 use 128 bytes. So we can't use the HMAC_BLOCK_LEN constant anymore. Add a new field to "struct auth_hash" for the per-cipher blocksize. -Due to this, there can't be a single "CRYPTO_SHA2_HMAC" external name anymore. Replace this by 3 for the 3 different keysizes. This was done by Open/FreeBSD before. -Also fix the number of authenticator bits used tor ESP and AH to conform to RFC4868, and remove uses of AH_HMAC_HASHLEN which did assume a fixed authenticator size of 12 bytes.
FAST_IPSEC will not interoperate with KAME IPSEC anymore if sha2 is used, because the latter doesn't implement these standards. It should interoperate with at least modern Free/OpenBSD now. (I've only tested with NetBSD-current/FAST_IPSEC on both ends.)
|
1.18 |
| 24-Feb-2011 |
drochner | small modifications in dealing with the unknown result size of compression/ decompression: -seperate the IPCOMP specific rule that compression must not grow the data from general compression semantics: Introduce a special name CRYPTO_DEFLATE_COMP_NOGROW/comp_algo_deflate_nogrow to describe the IPCOMP semantics and use it there. (being here, fix the check so that equal size is considered failure as well as required by RFC2393) Customers of CRYPTO_DEFLATE_COMP/comp_algo_deflate now always get deflated data back, even if they are not smaller than the original. -allow to pass a "size hint" to the DEFLATE decompression function which is used for the initial buffer allocation. Due to the changes done there, additional allocations and extra copies are avoided if the initial allocation is sufficient. Set the size hint to MCLBYTES (=2k) in IPCOMP which should be good for many use cases.
|
1.17 |
| 04-Sep-2009 |
he | branches: 1.17.4; 1.17.6; 1.17.8; It is best to explicitly include <sys/condvar.h> if we're going to use kcondvar_t.
|
1.16 |
| 25-Mar-2009 |
darran | Fixes PR kern/41069 and PR kern/41070.
Extends the Opencrypto API to allow the destination buffer size to be specified when its not the same size as the input buffer (i.e. for operations like compress and decompress). The crypto_op and crypt_n_op structures gain a u_int dst_len field. The session_op structure gains a comp_alg field to specify a compression algorithm. Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT, and CIOCNCRYPTM. Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION, OCIOCCRYPT, and OCIOCNCRYPTM.
Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which implement the original ioctls and set dst_len and comp_alg to 0.
Adds user-space access to compression features.
Adds software gzip support (CRYPTO_GZIP_COMP).
Adds the fast version of crc32 from zlib to libkern. This should be generally useful and provide a place to start normalizing the various crc32 routines in the kernel. The crc32 routine is used in this patch to support GZIP.
With input and support from tls@NetBSD.org.
|
1.15 |
| 18-Nov-2008 |
darran | branches: 1.15.4; Fix a race condition in opencrypto where the crypto request could be completed by the crypto device, queued on the retq, but freed by the ioctl lwp. The problem manifests as various panics relating to the condvar inside the request. The problem can occur whenever the crypto device completes the request immediately and the ioctl skips the cv_wait().
The problem can be reproduced by enabling cryptosoft and running an openssl speed test. E.g. sysctl -w kern.cryptodevallowsoft=-1 openssl speed -engine cryptodev -evp des-ede3-cbc -multi 64
Add a macro for TAILQ_FOREACH_REVERSE_SAFE() to queue.h, since this was missing and the opencrypto code removes requests from a list while iterating with TAILQ_FOREACH_REVERSE().
Add missing cv_destroy() calls for the key request cleanup.
Reviewed by Thor Lancelot Simon.
|
1.14 |
| 28-Apr-2008 |
martin | branches: 1.14.6; 1.14.8; 1.14.10; Remove clause 3 and 4 from TNF licenses
|
1.13 |
| 10-Apr-2008 |
tls | branches: 1.13.2; 1.13.4; Extend crypto.4 interface:
* Asynchronous operation with result retrieval via select/poll * Mutliple-request submit/retrieve ioctls * Mutliple-session create-destroy ioctls
Revise/rewrite crypto.4 manual page. It should now be much easier to write new applications to this API.
Measured performance for trivial requests: 84,000 very short modular math operations/sec, 120,000 very short md5 hashes per sec (with a hardware accellerator of moderate performance but very low latency, whose driver will be contributed at a later date).
Contributed to TNF by Coyote Point Systems, Inc.
|
1.12 |
| 04-Feb-2008 |
tls | branches: 1.12.6; Rework opencrypto to use a spin mutex (crypto_mtx) instead of "splcrypto" (actually splnet) and condvars instead of tsleep/wakeup. Fix a few miscellaneous problems and add some debugging printfs while there.
Restore set of CRYPTO_F_DONE in crypto_done() which was lost at some point after this code came from FreeBSD -- it made it impossible to wait properly for a condition.
Add flags analogous to the "crp" flags to the key operation's krp struct. Add a new flag, CRYPTO_F_ONRETQ which tells us a request finished before the kthread had a chance to dequeue it and call its callback -- this was letting requests stick on the queues before even though done and copied out.
Callers of crypto_newsession() or crypto_freesession() must now take the mutex. Change netipsec to do so. Dispatch takes the mutex itself as needed.
This was tested fairly extensively with the cryptosoft backend and lightly with a new hardware driver. It has not been tested with FAST_IPSEC; I am unable to ascertain whether FAST_IPSEC currently works at all in our tree.
pjd@FreeBSD.ORG, ad@NetBSD.ORG, and darran@snark.us pointed me in the right direction several times in the course of this. Remaining bugs are mine alone.
|
1.11 |
| 02-Feb-2008 |
tls | From Darran Hunt at Coyote Point: don't truncate HMAC to 96 bits unless actually asked to.
Fixed in FreeBSD a while ago, discussed on tech-kern and tech-crypto.
|
1.10 |
| 01-Feb-2008 |
tls | This code never worked on a released version of FreeBSD in the form it's been in in our tree, and certainly does not work on any version of FreeBSD now. Run through unifdef -D__NetBSD__ -U__FreeBSD__ yielding a small reduction of size and a dramatic improvement in readability.
No, this does not yield any meaningful decrease in patchability (unlike mechanical changes that touch live source lines) -- try it and see.
|
1.9 |
| 19-Jan-2008 |
tls | Add constants for modular arithmetic operations other than exponentiation -- there's hardware out there which can do them.
|
1.8 |
| 04-Mar-2007 |
christos | branches: 1.8.16; 1.8.22; 1.8.28; Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
|
1.7 |
| 25-Nov-2005 |
thorpej | branches: 1.7.26; - De-couple the software crypto implementation from the rest of the framework. There is no need to waste the space if you are only using algoritms provided by hardware accelerators. To get the software implementations, add "pseudo-device swcr" to your kernel config. - Lazily initialize the opencrypto framework when crypto drivers (either hardware or swcr) register themselves with the framework.
|
1.6 |
| 26-Feb-2005 |
perry | branches: 1.6.4; 1.6.10; nuke trailing whitespace
|
1.5 |
| 21-Aug-2003 |
jonathan | branches: 1.5.4; 1.5.10; 1.5.12; Pull in FreeBSD sys/opencrypto/cryptodev.h, revision 1.2.2.5 -> 1.2.2.6. Sam Leffler's FreeBSD commit message was ``to eliminate context switch when returning results from the software crypto driver'' but the patch also contains the CRYPTO_SESID*() macros used in newer ubsec and hifn drivers.
|
1.4 |
| 21-Aug-2003 |
jonathan | Pull up `done' flag for crypto operations from FreeBSD. FreeBSD deltas: cryptodev.c: 1.4.2.3 -> 1.4.2.4 cryptodev.h: 1.4.2.4 -> 1.4.2.5
|
1.3 |
| 30-Jul-2003 |
jonathan | Move the initialization of the crypto framework from the userland pseudo-device to init_main(), so the framework is ready for registration requests at autoconfiguration time.
Thanks to Quentin Garnier for confirming the change was required, and for testing a similar fix.
|
1.2 |
| 27-Jul-2003 |
jonathan | Cleanup traces of previous standalone m_apply()/m_getptr().
|
1.1 |
| 25-Jul-2003 |
jonathan | Commit initial NetBSD port of the OpenCrypto Framework (OCF). This code is derived from Sam Leffler's FreeBSD port of OCF, which is in turn a port of Angelos Keromytis's OpenBSD work. Credit to Sam and Angelos, any blame for the NetBSD port to me.
|
1.5.12.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.5.10.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.5.4.6 |
| 11-Dec-2005 |
christos | Sync with head.
|
1.5.4.5 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.5.4.4 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.5.4.3 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.5.4.2 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.5.4.1 |
| 21-Aug-2003 |
skrll | file cryptodev.h was added on branch ktrace-lwp on 2004-08-03 10:56:25 +0000
|
1.6.10.1 |
| 29-Nov-2005 |
yamt | sync with head.
|
1.6.4.4 |
| 04-Feb-2008 |
yamt | sync with head.
|
1.6.4.3 |
| 21-Jan-2008 |
yamt | sync with head
|
1.6.4.2 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.6.4.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.7.26.1 |
| 12-Mar-2007 |
rmind | Sync with HEAD.
|
1.8.28.1 |
| 19-Jan-2008 |
bouyer | Sync with HEAD
|
1.8.22.1 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.8.16.1 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.12.6.2 |
| 17-Jan-2009 |
mjf | Sync with HEAD.
|
1.12.6.1 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.13.4.3 |
| 16-Sep-2009 |
yamt | sync with head
|
1.13.4.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.13.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.13.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.14.10.2 |
| 03-May-2009 |
snj | Pull up following revision(s) (requested by tls in ticket #611): sys/lib/libkern/Makefile: patch sys/lib/libkern/crc32.c: revision 1.1 sys/lib/libkern/crc32.h: revision 1.1 sys/lib/libkern/libkern.h: revision 1.89 sys/lib/libkern/arch/i386/Makefile.inc: revision 1.28 sys/net/zlib.h: revision 1.14 via patch sys/opencrypto/crypto.c: revision 1.33 sys/opencrypto/cryptodev.c: revision 1.46 sys/opencrypto/cryptodev.h: revision 1.16 sys/opencrypto/cryptosoft.c: revision 1.24 sys/opencrypto/cryptosoft.h: revision 1.6 sys/opencrypto/deflate.h: revision 1.6 sys/opencrypto/cryptosoft_xform.c: revision 1.12 sys/opencrypto/deflate.c: revision 1.13 sys/opencrypto/files.opencrypto: revision 1.20 sys/opencrypto/ocryptodev.c: revision 1.1 sys/opencrypto/ocryptodev.h: revision 1.1 sys/opencrypto/xform.c: revision 1.18 sys/opencrypto/xform.h: revision 1.10 Fixes PR kern/41069 and PR kern/41070.
Extends the Opencrypto API to allow the destination buffer size to be specified when its not the same size as the input buffer (i.e. for operations like compress and decompress). The crypto_op and crypt_n_op structures gain a u_int dst_len field. The session_op structure gains a comp_alg field to specify a compression algorithm. Moved four ioctls to new ids; CIOCGSESSION, CIOCNGSESSION, CIOCCRYPT, and CIOCNCRYPTM. Added four backward compatible ioctls; OCIOCGSESSION, OCIOCNGSESSION, OCIOCCRYPT, and OCIOCNCRYPTM.
Backward compatibility is maintained in ocryptodev.h and ocryptodev.c which implement the original ioctls and set dst_len and comp_alg to 0.
Adds user-space access to compression features.
Adds software gzip support (CRYPTO_GZIP_COMP).
Adds the fast version of crc32 from zlib to libkern. This should be generally useful and provide a place to start normalizing the various crc32 routines in the kernel. The crc32 routine is used in this patch to support GZIP.
With input and support from tls@NetBSD.org.
|
1.14.10.1 |
| 20-Nov-2008 |
snj | branches: 1.14.10.1.4; Pull up following revision(s) (requested by darran in ticket #92): sys/opencrypto/cryptodev.c: revision 1.45 sys/sys/queue.h: revision 1.50 sys/opencrypto/cryptodev.h: revision 1.15 sys/opencrypto/crypto.c: revision 1.30 Fix a race condition in opencrypto where the crypto request could be completed by the crypto device, queued on the retq, but freed by the ioctl lwp. The problem manifests as various panics relating to the condvar inside the request. The problem can occur whenever the crypto device completes the request immediately and the ioctl skips the cv_wait(). The problem can be reproduced by enabling cryptosoft and running an openssl speed test. E.g. sysctl -w kern.cryptodevallowsoft=-1 openssl speed -engine cryptodev -evp des-ede3-cbc -multi 64 Add a macro for TAILQ_FOREACH_REVERSE_SAFE() to queue.h, since this was missing and the opencrypto code removes requests from a list while iterating with TAILQ_FOREACH_REVERSE(). Add missing cv_destroy() calls for the key request cleanup. Reviewed by Thor Lancelot Simon.
|
1.14.10.1.4.1 |
| 20-May-2011 |
matt | bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).
|
1.14.8.2 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.14.8.1 |
| 19-Jan-2009 |
skrll | Sync with HEAD.
|
1.14.6.1 |
| 13-Dec-2008 |
haad | Update haad-dm branch to haad-dm-base2.
|
1.15.4.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.17.8.1 |
| 05-Mar-2011 |
bouyer | Sync with HEAD
|
1.17.6.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.17.4.3 |
| 12-Jun-2011 |
rmind | sync with head
|
1.17.4.2 |
| 31-May-2011 |
rmind | sync with head
|
1.17.4.1 |
| 05-Mar-2011 |
rmind | sync with head
|
1.24.2.1 |
| 23-Jun-2011 |
cherry | Catchup with rmind-uvmplock merge.
|
1.25.30.4 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.25.30.3 |
| 09-Jul-2016 |
skrll | Sync with HEAD
|
1.25.30.2 |
| 19-Mar-2016 |
skrll | Sync with HEAD
|
1.25.30.1 |
| 27-Dec-2015 |
skrll | Sync with HEAD (as of 26th Dec)
|
1.25.12.1 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.28.4.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.28.2.2 |
| 26-Apr-2017 |
pgoyette | Sync with HEAD
|
1.28.2.1 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.31.2.1 |
| 19-May-2017 |
pgoyette | Resolve conflicts from previous merge (all resulting from $NetBSD keywork expansion)
|
1.34.2.3 |
| 05-Aug-2017 |
snj | Pull up following revision(s) (requested by knakahara in ticket #178): sys/opencrypto/crypto.c: 1.92-1.100 sys/opencrypto/cryptodev.h: 1.38-1.39 sys/opencrypto/ocryptodev.c: 1.9-1.11 sys/opencrypto/xform.c: revision 1.29 sys/opencrypto/xform.h: revision 1.20 KNF -- Apply C99-style struct initialization to enc_xform, auth_hash and comp_algo -- make cryptoret() context softint to balance dequeuing crypto_ret_q with enqueuing it. -- fix panic when using ecryption devices attached earlier than ipi_sysinit(). pointed out and tested by martin@n.o, thanks. -- fix typo -- make crp_{,k}q percpu to scale crypto_dispatch(). update locking note later. -- divide crp_ret_{,k}q by CPU to avoid reordering. update locking note later. -- update locking notes of opencrypto(9) -- Don't disclose uninitialized 32-bit word if cryptodev_session fails. From Ilja Van Sprundel. -- Avert userland-controlled integer overflow. From Ilja Van Sprundel. -- Avoid another userland-controlled integer overflow. From Ilja Van Sprundel. -- refactor: remove glue macros for FreeBSD code. -- pack crypto_drivers variables to struct and add cacheline_aligned qualifier. -- use kmem_alloc KPI instead of malloc KPI. -- use pool_cache(9) instead of pool(9) as they can be called concurrently.
|
1.34.2.2 |
| 05-Jul-2017 |
snj | Pull up following revision(s) (requested by knakahara in ticket #97): sys/opencrypto/crypto.c: 1.87-1.91 sys/opencrypto/cryptodev.c: 1.93-1.95 sys/opencrypto/cryptodev.h: 1.37 sys/opencrypto/cryptosoft.c: 1.52 sys/rump/dev/lib/libopencrypto/opencrypto_component.c: 1.5 sanitize count used for kmem_alloc size. Hmm, who uses CIOCNGSESSION, CIOCNFSESSION, CIOCNCRYPTM or CIOCNFKEYM? -- sanitize in CIOCNCRYPTM and initialize comp_alg in CIOCNGSESSION -- must release cap->cc_lock before calling cap->cc_newsession() because of spinlock. -- refactor crypto_newsession() like FreeBSD. -- support multiple encryption drivers (port from FreeBSD). -- Divide crp_devflags from crp_flags to write exclusively. CRYPTO_F_DQRETQ(new name is CRYPTODEV_F_RET) is used by cryptodev.c only. It should be divided to other member. -- Reduce crypto_ret_q_mtx lock regions. crypto.c does not access the members of crp when the crp is in crp_q or crp_ret_q. Furthermore, crp_q and crp_ret_q are protected by each mutex, so the members of crp is not shared. That means crp_flags is not required mutex in crypto.c. -- fix cryptosoft.c:r1.51 mistake. swcrypto_attach() must not be called from module_init_class(). swcrypto_attach() will call softint_establish(), it must be called after cpus attached. module_init_class() is too early to call softint_establish(). -- simplify mutex_enter/exit(crypto_q_mtx), and fix missing exit. -- reduce rump waring message. pointed out by ozaki-r@n.o, thanks.
|
1.34.2.1 |
| 22-Jun-2017 |
snj | Pull up following revision(s) (requested by christos/knakahara in ticket #37): sys/opencrypto/crypto.c: 1.79-1.86 sys/opencrypto/cryptodev.h: 1.35, 1.36 use crypto_checkdriver_uninit() when it may touch uninitialized crypto_drivers. -- fix reading crp_q without holding crypto_q_mtx -- restructure locks(1/2): make relation between lock and data explicit. + crypto_drv_mtx protects - whole crypto_drivers + crypto_drivers[i].cc_lock (new) protects - crypto_drivers[i] itself - member of crypto_drivers[i] + crypto_q_mtx protects - crp_q - crp_kq + crypto_ret_q_mtx protects - crp_ret_q - crp_ret_kq - crypto_exit_flag I will add locking note later. -- restructure locks(2/2): crypto_q_mtx can be adaptive now. -- add locking notes. -- avoid crp_q reordering as hardware interrupts. crypto_{,k}invoke() can be called with holding crp_q_mtx now. -- apply the same fix as crypto.c:r1.83 for crypto_dispatch to crypto_kdispatch. -- - acquire lock - use c99 loop indexes - initialize featp -- Put back crypto_checkdriver(); use it when we need to make sure that we get back a cryptocap that has been initialized.
|
1.38.2.2 |
| 18-Jul-2017 |
knakahara | 3212654
|
1.38.2.1 |
| 18-Jul-2017 |
knakahara | file cryptodev.h was added on branch perseant-stdc-iso10646 on 2017-07-18 06:01:37 +0000
|
1.39.4.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.50.4.1 |
| 09-Aug-2023 |
martin | Pull up following revision(s) (requested by maya in ticket #316):
sys/arch/m68k/include/mutex.h: revision 1.13 sys/arch/arm/include/cpu.h: revision 1.125 sys/arch/sun68k/include/intr.h: revision 1.21 sys/arch/arm/include/mutex.h: revision 1.28 sys/sys/rwlock.h: revision 1.18 sys/arch/powerpc/include/mutex.h: revision 1.7 sys/arch/arm/include/mutex.h: revision 1.29 sys/arch/powerpc/include/mutex.h: revision 1.8 sys/uvm/uvm_param.h: revision 1.42 sys/sys/ksem.h: revision 1.16 sys/arch/x86/include/mutex.h: revision 1.10 sys/sys/proc.h: revision 1.372 sys/sys/ksem.h: revision 1.17 sys/arch/ia64/include/mutex.h: revision 1.8 sys/arch/evbarm/include/intr.h: revision 1.29 sys/sys/lua.h: revision 1.9 sys/arch/next68k/include/intr.h: revision 1.23 sys/arch/ia64/include/mutex.h: revision 1.9 sys/arch/hp300/include/intr.h: revision 1.35 sys/arch/hp300/include/intr.h: revision 1.36 sys/arch/sparc/include/cpu.h: revision 1.111 sys/arch/hppa/include/mutex.h: revision 1.16 sys/arch/vax/include/intr.h: revision 1.31 sys/arch/hppa/include/mutex.h: revision 1.17 sys/arch/news68k/include/intr.h: revision 1.28 sys/arch/hppa/include/mutex.h: revision 1.18 sys/arch/hppa/include/intr.h: revision 1.3 sys/arch/hppa/include/mutex.h: revision 1.19 sys/arch/hppa/include/intr.h: revision 1.4 sys/sys/sched.h: revision 1.92 sys/opencrypto/cryptodev.h: revision 1.51 sys/arch/vax/include/mutex.h: revision 1.20 sys/arch/sparc64/include/mutex.h: revision 1.10 sys/arch/ia64/include/sapicvar.h: revision 1.2 sys/arch/riscv/include/mutex.h: revision 1.5 sys/arch/amiga/dev/grfabs_cc.c: revision 1.39 sys/external/bsd/drm2/include/linux/idr.h: revision 1.11 sys/arch/riscv/include/mutex.h: revision 1.6 sys/ddb/files.ddb: revision 1.16 sys/arch/mac68k/include/intr.h: revision 1.32 share/man/man4/ddb.4: revision 1.203 sys/ddb/db_command.c: revision 1.183 sys/arch/mips/include/mutex.h: revision 1.10 sys/ddb/db_command.c: revision 1.184 sys/arch/x68k/include/intr.h: revision 1.22 sys/arch/sparc/include/psl.h: revision 1.51 sys/arch/or1k/include/mutex.h: revision 1.4 sys/arch/mips/include/mutex.h: revision 1.11 sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16 sys/arch/sparc64/include/cpu.h: revision 1.134 sys/arch/sparc/include/psl.h: revision 1.52 sys/arch/or1k/include/mutex.h: revision 1.5 sys/arch/mvme68k/include/intr.h: revision 1.22 sys/arch/luna68k/include/intr.h: revision 1.16 external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6 sys/arch/sparc/include/mutex.h: revision 1.12 sys/arch/sparc/include/mutex.h: revision 1.13 sys/arch/usermode/include/mutex.h: revision 1.5 sys/arch/usermode/include/mutex.h: revision 1.6 sys/kern/kern_core.c: revision 1.38 usr.sbin/crash/Makefile: revision 1.49 sys/arch/amiga/include/intr.h: revision 1.23 sys/arch/alpha/include/mutex.h: revision 1.12 sys/arch/alpha/include/mutex.h: revision 1.13 sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16 sys/ddb/ddb.h: revision 1.6 sys/arch/sparc64/include/mutex.h: revision 1.8 sys/arch/sh3/include/mutex.h: revision 1.12 sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17 sys/ddb/db_syncobj.c: revision 1.1 sys/arch/vax/include/mutex.h: revision 1.18 sys/arch/sparc64/include/psl.h: revision 1.63 sys/arch/sparc64/include/mutex.h: revision 1.9 sys/arch/sh3/include/mutex.h: revision 1.13 sys/arch/evbarm/lubbock/obio.c: revision 1.13 sys/arch/atari/include/intr.h: revision 1.23 sys/ddb/db_syncobj.c: revision 1.2 sys/arch/vax/include/mutex.h: revision 1.19 sys/arch/evbarm/g42xxeb/obio.c: revision 1.14 sys/arch/evbarm/g42xxeb/obio.c: revision 1.15 sys/arch/cesfic/include/intr.h: revision 1.14 sys/ddb/db_syncobj.h: revision 1.1 sys/arch/x86/include/cpu.h: revision 1.134 sys/arch/evbarm/g42xxeb/obio.c: revision 1.16 sys/arch/cesfic/include/intr.h: revision 1.15 sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26 sys/sys/cpu_data.h: revision 1.54 sys/arch/m68k/include/mutex.h: revision 1.12 sys/arch/ia64/acpi/madt.c: revision 1.6
sys/rwlock.h: Make this more self-contained for bool.
machine/mutex.h: Sprinkle includes so this can be used by crash(8).
ddb: New `show all tstiles' command. Shows who's waiting for which locks and what the owner is up to.
Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE
sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.
And thus out of <sys/param.h>, which is exceedingly overused and fragile and delenda est.
Should fix (some) issues with the recent inclusion of machine/lock.h in various machine/mutex.h files.
arm/mutex.h: Need machine/intr.h, machine/lock.h.
For ipl_cookie_t and __cpu_simple_lock_t. evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.
Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which should really be fixed. opencrypto/cryptodev.h: Fix includes. - Move sys/condvar.h under #ifdef _KERNEL. - Add some other necessary includes and forward declarations. - Sort.
hp300/intr.h: Fix missing includes. linux/idr.h: Need <sys/mutex.h> for kmutex_t. amiga/intr.h: Don't define spl*() functions if !_KERNEL.
This is used by crash(8) now, and what's important is ipl_cookie_t. cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8). cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.
Probably not necessary but let's be a little more cautious about this.
atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).
arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.
Nix machine/param.h -- not meant to be used directly, pulled in by sys/param.h.
Move the definition of ipl_cookie_t out of the kernel-only sections, some _KMEMUSER applications need it.
ddb: Cast pointer to uintptr_t first before db_expr_t.
hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
news68k/intr.h: Fix includes. Put some definitions under _KERNEL.
next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.
sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.
Make ipl_cookie_t visible for _KMEMUSER userland applications.
fix editor mishap in previous
Explicitly include <sys/mutex.h> for kmutex_t.
Replace kmutex_t * (which may be undefined here) with struct kmutex *, suggested by Taylor.
hp300/intr.h: Put most of this under #ifdef _KERNEL. Only ipl_cookie_t really needs to be exposed now, for crash(8).
mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8). Make inclusion of sys/intr.h explicit for spl*.
fix hppa and vax builds.
machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in sys/types.h. avoids cpu_data.h vs sched.h include order issues.
move the hppa ipl_t typedef with the moved usage of it. machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.
Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which always comes from sys/types.h. And, really, sys/types.h (or at least sys/stdint.h) is needed for uintN_t and uintptr_t.
ddb: Cast pointer to uintptr_t, then to db_expr_t. Avoids warnings about conversion between pointer and integer of different size on some architectures.
re-fix hppa builds.
this file uses __cpu_simple_lock(), not just the underlying type, so it does need machine/lock.h.
Break cycle by using `struct kmutex *' instead of `kmutex_t *'. sys/sched.h included sys/mutex.h which includes sys/intr.h which includes machine/intr.h which on cats includes arm/footbridge/footbridge_intr.h which includes arm/cpu.h which includes sys/cpu_data.h which includes sys/sched.h
But there was never any real need for sys/mutex.h in sys/sched.h, because it only uses pointers to the opaque struct kmutex. Cycle broken by using `struct kmutex *' instead of pulling in sys/mutex.h for the definition of kmutex_t.
Side effect: This revealed that sys/cpu_data.h needed sys/intr.h (which was pulled in accidentally by sys/mutex.h via sys/sched.h) for SOFTINT_COUNT. Also revealed some other machine/cpu.h header files were missing includes of sys/mutex.h for kmutex_t.
ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.
explicitly include no longer implicitly included sys/mutex.h.
arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz. Sidesteps namespace collision with `#define bits ...' in net/zlib.c.
complete the previous - there were two calls to find_first_bit() to fix.
arm/xscale: Missed a spot with previous find_first_bit commit.
evbarm/g42xxeb: Fix off-by-one in previous.
The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x), which is equivalent to fls32(x) - 1, not to fls32(x).
Note that fls32 is 1-based and returns 0 for x=0.
|