Home | History | Annotate | Download | only in opencrypto
History log of /src/sys/opencrypto/files.opencrypto
RevisionDateAuthorComments
 1.30  29-Jun-2020  riastradh opencrypto: Switch from legacy rijndael API to new aes API.

While here, apply various rijndael->aes renames, reduce the size
of aesxcbc_ctx by 480 bytes, and convert some malloc->kmem.

Leave in the symbol enc_xform_rijndael128 for now, though, so this
doesn't break any kernel ABI.
 1.29  22-Apr-2020  rin Make crypto/rijindael optional again as cprng_strong does no longer
depend on it. Dependency is explicitly declared in files.foo if a
component requires it.
 1.28  27-Jan-2020  pgoyette branches: 1.28.4;
Split the module glue out from the rest of opencrypto/ocryptodev to
make rump happy.

Rump doesn't have compat modules (the compat code is included in the
relevant librump*.so), so there's no module compat_50 listed in
link_set_modules, and thus ocryptodev's MODULE(...) can't "require"
it.

This fixes the problem of "built-in module compat_50 not found" when
starting up rump_allserver (or rump_server with -l rumpdev_opencrypto).

XXX This does not resolve the long-standing "crypto: unable to
XXX register devsw, error 17" message noted at line 78 of
XXX sys/rump/dev/lib/libopencrypto/opencrypto_component.c
 1.27  27-Jan-2019  pgoyette branches: 1.27.6;
Merge the [pgoyette-compat] branch
 1.26  24-May-2017  knakahara branches: 1.26.8; 1.26.10;
make the default values of q_maxlen build parameters.
 1.25  19-Nov-2011  tls branches: 1.25.8; 1.25.26;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.24  26-May-2011  drochner branches: 1.24.4;
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  05-May-2011  drochner support camellia-cbc by swcrypt
 1.21  19-Feb-2011  drochner make the compatibility code conditional on COMPAT_50
 1.20  25-Mar-2009  darran branches: 1.20.4; 1.20.6; 1.20.8;
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.19  04-Feb-2008  tls branches: 1.19.10; 1.19.18; 1.19.20; 1.19.24; 1.19.28;
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.18  27-Oct-2006  christos branches: 1.18.24; 1.18.30;
Merge kernel and userland rmd160 and sha2 implementation.
XXX: We still install rmd160.h and sha2.h in /usr/include/crypto, unlike
the other hash functions which get installed in /usr/include for compatibility.
 1.17  25-Nov-2005  thorpej branches: 1.17.20; 1.17.22;
swcr -> swcrypto
 1.16  25-Nov-2005  thorpej - 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.15  26-Feb-2005  perry branches: 1.15.4; 1.15.10;
nuke trailing whitespace
 1.14  31-Dec-2003  jonathan branches: 1.14.4; 1.14.10; 1.14.12;
Split opencrypto configuration into an attribute, usable by inkernel
clients, and a pseudo-device for userspace access.

The attribute is named `opencrypto'. The pseudo-device is renamed to
"crypto", which has a dependency on "opencrypto". The sys/conf/majors
entry and pseudo-device attach entrypoint are updated to match the
new pseudo-device name.

Fast IPsec (sys/netipsec/files.ipsec) now lists a dependency on the
"opencrypto" attribute. Drivers for crypto accelerators (ubsec,
hifn775x) also pull in opencrypto, as providers of opencrypto transforms.
 1.13  16-Nov-2003  tls Move the Skipjack algorithm from sys/opencrypto to sys/crypto/skipjack.
There are now no cryptographic algorithms in sys/opencrypto, which,
according to the comment formerly in files.opencrypto, was the original
intent.
 1.12  27-Aug-2003  thorpej Use the Blowfish in crypto/blowfish, which has hooks for using tuned
assembly for the transform.
 1.11  26-Aug-2003  thorpej Move the opencrypto CAST-128 implementation to crypto/cast128, removing
the old one. Rename the functions/structures from cast_* to cast128_*.
Adapt the KAME IPsec to use the new CAST-128 code, which has a simpler
API and smaller footprint.
 1.10  26-Aug-2003  thorpej G/C opencrypto's local copy of rijndael. Adapt the extant rijndael
code for opencrypto's use by adding the simplified API that opencrypto
expects.
 1.9  24-Aug-2003  thorpej crypto_mbuf.c is unused; remove it.
 1.8  24-Aug-2003  thorpej G/C some unused config definitions.
 1.7  24-Aug-2003  thorpej Make opencrypto depend on the "ripemd160" and "sha2" attributes, rather
than polluting the crypto algorithm config info with opencrypto knowledge.
 1.6  24-Aug-2003  thorpej Move the opencrypto defpseudo into files.opencrypto.
 1.5  30-Jul-2003  jonathan Add ``needs-flag'' to opencrypto/crypto.c, so that init_main() can do
a feature-test and if present, initialize the crypto framework before
configuring hardware devices, so the crypto framework is ready to accept
attachment requests when crypto hardware are auto-configured and
try to register themselves with the framework.

Thanks to Quentin Garnier who, given a heads-up about the problem,
tested the same basic fix with a hardware device.
 1.4  28-Jul-2003  jonathan Clean up dependencies between opencrypto framework and sys/crypto,
by making the sys/crypto transforms depend on
(per-transform-config-keyword|opencrypto)

Thanks to Martin Husemann for double-checking the changes.
 1.3  27-Jul-2003  jonathan Cleanup traces of previous standalone m_apply()/m_getptr().
 1.2  26-Jul-2003  he Don't declare the sha2.c file twice, instead add opencrypto flag to
existing declaration, and leave behind a comment in files.opencrypto.
 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.14.12.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.10.1  29-Apr-2005  kent sync with -current
 1.14.4.6  11-Dec-2005  christos Sync with head.
 1.14.4.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.4.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.4.3  18-Sep-2004  skrll Sync with HEAD.
 1.14.4.2  03-Aug-2004  skrll Sync with HEAD
 1.14.4.1  31-Dec-2003  skrll file files.opencrypto was added on branch ktrace-lwp on 2004-08-03 10:56:25 +0000
 1.15.10.1  29-Nov-2005  yamt sync with head.
 1.15.4.3  04-Feb-2008  yamt sync with head.
 1.15.4.2  30-Dec-2006  yamt sync with head.
 1.15.4.1  21-Jun-2006  yamt sync with head.
 1.17.22.1  10-Dec-2006  yamt sync with head.
 1.17.20.1  18-Nov-2006  ad Sync with head.
 1.18.30.1  18-Feb-2008  mjf Sync with HEAD.
 1.18.24.1  23-Mar-2008  matt sync with HEAD
 1.19.28.1  20-May-2011  matt bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE (except compat).
 1.19.24.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.20.1  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.19.18.1  28-Apr-2009  skrll Sync with HEAD.
 1.19.10.1  04-May-2009  yamt sync with head.
 1.20.8.1  05-Mar-2011  bouyer Sync with HEAD
 1.20.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.20.4.2  31-May-2011  rmind sync with head
 1.20.4.1  05-Mar-2011  rmind sync with head
 1.24.4.1  17-Apr-2012  yamt sync with head
 1.25.26.1  28-Aug-2017  skrll Sync with HEAD
 1.25.8.1  03-Dec-2017  jdolecek update from HEAD
 1.26.10.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.26.10.1  10-Jun-2019  christos Sync with HEAD
 1.26.8.2  23-Sep-2018  pgoyette Split the compat_crypto_50 from the rest of the crypto module

Cleanup some stuff left over from similar changes to raid modules.
 1.26.8.1  22-Sep-2018  pgoyette Include the compat code whether or not the calling device or filesystem
exists.
 1.27.6.1  29-Feb-2020  ad Sync with head.
 1.28.4.1  25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)

RSS XML Feed