1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/sys/crypto
Conrad Meyer 844d9543dc Add ccp(4): experimental driver for AMD Crypto Co-Processor
* Registers TRNG source for random(4)
* Finds available queues, LSBs; allocates static objects
* Allocates a shared MSI-X for all queues.  The hardware does not have
  separate interrupts per queue.  Working interrupt mode driver.
* Computes SHA hashes, HMAC.  Passes cryptotest.py, cryptocheck tests.
* Does AES-CBC, CTR mode, and XTS.  cryptotest.py and cryptocheck pass.
* Support for "authenc" (AES + HMAC).  (SHA1 seems to result in
  "unaligned" cleartext inputs from cryptocheck -- which the engine
  cannot handle.  SHA2 seems to work fine.)
* GCM passes for block-multiple AAD, input lengths

Largely based on ccr(4), part of cxgbe(4).

Rough performance averages on AMD Ryzen 1950X (4kB buffer):
aesni:      SHA1: ~8300 Mb/s    SHA256: ~8000 Mb/s
ccp:               ~630 Mb/s    SHA256:  ~660 Mb/s  SHA512:  ~700 Mb/s
cryptosoft:       ~1800 Mb/s    SHA256: ~1800 Mb/s  SHA512: ~2700 Mb/s

As you can see, performance is poor in comparison to aesni(4) and even
cryptosoft (due to high setup cost).  At a larger buffer size (128kB),
throughput is a little better (but still worse than aesni(4)):

aesni:      SHA1:~10400 Mb/s    SHA256: ~9950 Mb/s
ccp:              ~2200 Mb/s    SHA256: ~2600 Mb/s  SHA512: ~3800 Mb/s
cryptosoft:       ~1750 Mb/s    SHA256: ~1800 Mb/s  SHA512: ~2700 Mb/s

AES performance has a similar story:

aesni:      4kB: ~11250 Mb/s    128kB: ~11250 Mb/s
ccp:               ~350 Mb/s    128kB:  ~4600 Mb/s
cryptosoft:       ~1750 Mb/s    128kB:  ~1700 Mb/s

This driver is EXPERIMENTAL.  You should verify cryptographic results on
typical and corner case inputs from your application against a known- good
implementation.

Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D12723
2018-01-18 22:01:30 +00:00
..
aesni aesni(4): Quiesce spurious GCC 6.3.0 -Wmaybe-uninitialized warnings 2018-01-12 06:40:58 +00:00
armv8 Add accelerated AES with using the ARMv8 crypto instructions. This is based 2016-11-21 11:18:00 +00:00
blowfish
camellia
ccp Add ccp(4): experimental driver for AMD Crypto Co-Processor 2018-01-18 22:01:30 +00:00
chacha20 Fix counter increment in Salsa and ChaCha. 2017-04-22 01:06:23 +00:00
des Remove register keyword from sys/ and ANSIfy prototypes 2017-05-17 00:34:34 +00:00
rc4 Revert previous commit... 2012-10-10 08:36:38 +00:00
rijndael Fix gcc build: preserve const qualifier when casting input values. 2014-11-11 13:37:28 +00:00
sha2 Fix C++ includability of crypto headers with static array sizes 2016-10-18 23:20:49 +00:00
siphash Fix C++ includability of crypto headers with static array sizes 2016-10-18 23:20:49 +00:00
skein libmd: add noexec stack annotation in skein_block_asm.s 2017-01-07 19:26:25 +00:00
via Revert r327340, as the workaround for rep prefixes followed by .byte 2018-01-17 17:14:19 +00:00
intake.h Implement boot-time encryption key passing (keybuf) 2017-04-01 05:05:22 +00:00
sha1.c sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00
sha1.h sys: further adoption of SPDX licensing ID tags. 2017-11-20 19:43:44 +00:00