aboutsummaryrefslogtreecommitdiff
path: root/tests/sys/opencrypto/cryptotest.py
Commit message (Collapse)AuthorAgeFilesLines
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* ossl: Add support for AES-CBC cipherKornel Duleba2021-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | AES-CBC OpenSSL assembly is used underneath. The glue layer(ossl_aes.c) is based on CHACHA20 implementation. Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic does not have a fallback implementation in case CPU doesn't support required instructions. Because of that CPU caps are checked during initialization and AES support is advertised only if available. The feature is available on all architectures that ossl supports: i386, amd64, arm64. The biggest advantage of this patch over existing solutions (aesni(4) and armv8crypto(4)) is that it supports SHA, allowing for ETA operations. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: jhb (previous version) Differential revision: https://reviews.freebsd.org/D32099
* Revert "ossl: Add support for AES-CBC cipher"Wojciech Macek2021-11-061-1/+1
| | | | This reverts commit 849faf4e0ba9a8b8f24ff34da93a0fd46c14eda9.
* ossl: Add support for AES-CBC cipherKornel Duleba2021-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | AES-CBC OpenSSL assembly is used underneath. The glue layer(ossl_aes.c) is based on CHACHA20 implementation. Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic does not have a fallback implementation in case CPU doesn't support required instructions. Because of that CPU caps are checked during initialization and AES support is advertised only if available. The feature is available on all architectures that ossl supports: i386, amd64, arm64. The biggest advantage of this patch over existing solutions (aesni(4) and armv8crypto(4)) is that it supports SHA, allowing for ETA operations. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: jhb Differential revision: https://reviews.freebsd.org/D32099
* crypto: Test all of the AES-CCM KAT vectors.John Baldwin2021-10-061-24/+17
| | | | | | | | | | | | | | | | | | | Previously, only test vectors which used the default nonce and tag sizes (12 and 16, respectively) were tested. This now tests all of the vectors. This exposed some additional issues around requests with an empty payload (which wasn't supported) and an empty AAD (which falls back to CIOCCRYPT instead of CIOCCRYPTAEAD). - Make use of the 'ivlen' and 'maclen' fields for CIOGSESSION2 to test AES-CCM vectors with non-default nonce and tag lengths. - Permit requests with an empty payload. - Permit an input MAC for requests without AAD. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32121
* cryptotest: Add qat(4) coverageMark Johnston2020-11-051-2/+3
| | | | | | | | MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=367388
* Add ossl(4) to cryptotest.Jung-uk Kim2020-10-301-1/+2
| | | | Notes: svn path=/head/; revision=367185
* tests/sys/opencrypto: use python3Alan Somers2020-07-201-2/+2
| | | | | | | | | | | | python2 will be EOL soon Reviewed by: lwhsu, jmg MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D25682 Notes: svn path=/head/; revision=363361
* Add safexcel(4) to cryptotest.Mark Johnston2020-07-141-2/+3
| | | | | | | | MFC after: 1 week Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=363181
* Remove support for the algorithms deprecated in r348876.John Baldwin2020-05-021-41/+0
| | | | | | | | | | | | | | | | | | | | | | This removes support for the following algorithms: - ARC4 - Blowfish - CAST128 - DES - 3DES - MD5-HMAC - Skipjack Since /dev/crypto no longer supports 3DES, stop testing the 3DES KAT vectors in cryptotest.py. Reviewed by: cem (previous version) Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D24346 Notes: svn path=/head/; revision=360562
* Refactor driver and consumer interfaces for OCF (in-kernel crypto).John Baldwin2020-03-271-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The linked list of cryptoini structures used in session initialization is replaced with a new flat structure: struct crypto_session_params. This session includes a new mode to define how the other fields should be interpreted. Available modes include: - COMPRESS (for compression/decompression) - CIPHER (for simply encryption/decryption) - DIGEST (computing and verifying digests) - AEAD (combined auth and encryption such as AES-GCM and AES-CCM) - ETA (combined auth and encryption using encrypt-then-authenticate) Additional modes could be added in the future (e.g. if we wanted to support TLS MtE for AES-CBC in the kernel we could add a new mode for that. TLS modes might also affect how AAD is interpreted, etc.) The flat structure also includes the key lengths and algorithms as before. However, code doesn't have to walk the linked list and switch on the algorithm to determine which key is the auth key vs encryption key. The 'csp_auth_*' fields are always used for auth keys and settings and 'csp_cipher_*' for cipher. (Compression algorithms are stored in csp_cipher_alg.) - Drivers no longer register a list of supported algorithms. This doesn't quite work when you factor in modes (e.g. a driver might support both AES-CBC and SHA2-256-HMAC separately but not combined for ETA). Instead, a new 'crypto_probesession' method has been added to the kobj interface for symmteric crypto drivers. This method returns a negative value on success (similar to how device_probe works) and the crypto framework uses this value to pick the "best" driver. There are three constants for hardware (e.g. ccr), accelerated software (e.g. aesni), and plain software (cryptosoft) that give preference in that order. One effect of this is that if you request only hardware when creating a new session, you will no longer get a session using accelerated software. Another effect is that the default setting to disallow software crypto via /dev/crypto now disables accelerated software. Once a driver is chosen, 'crypto_newsession' is invoked as before. - Crypto operations are now solely described by the flat 'cryptop' structure. The linked list of descriptors has been removed. A separate enum has been added to describe the type of data buffer in use instead of using CRYPTO_F_* flags to make it easier to add more types in the future if needed (e.g. wired userspace buffers for zero-copy). It will also make it easier to re-introduce separate input and output buffers (in-kernel TLS would benefit from this). Try to make the flags related to IV handling less insane: - CRYPTO_F_IV_SEPARATE means that the IV is stored in the 'crp_iv' member of the operation structure. If this flag is not set, the IV is stored in the data buffer at the 'crp_iv_start' offset. - CRYPTO_F_IV_GENERATE means that a random IV should be generated and stored into the data buffer. This cannot be used with CRYPTO_F_IV_SEPARATE. If a consumer wants to deal with explicit vs implicit IVs, etc. it can always generate the IV however it needs and store partial IVs in the buffer and the full IV/nonce in crp_iv and set CRYPTO_F_IV_SEPARATE. The layout of the buffer is now described via fields in cryptop. crp_aad_start and crp_aad_length define the boundaries of any AAD. Previously with GCM and CCM you defined an auth crd with this range, but for ETA your auth crd had to span both the AAD and plaintext (and they had to be adjacent). crp_payload_start and crp_payload_length define the boundaries of the plaintext/ciphertext. Modes that only do a single operation (COMPRESS, CIPHER, DIGEST) should only use this region and leave the AAD region empty. If a digest is present (or should be generated), it's starting location is marked by crp_digest_start. Instead of using the CRD_F_ENCRYPT flag to determine the direction of the operation, cryptop now includes an 'op' field defining the operation to perform. For digests I've added a new VERIFY digest mode which assumes a digest is present in the input and fails the request with EBADMSG if it doesn't match the internally-computed digest. GCM and CCM already assumed this, and the new AEAD mode requires this for decryption. The new ETA mode now also requires this for decryption, so IPsec and GELI no longer do their own authentication verification. Simple DIGEST operations can also do this, though there are no in-tree consumers. To eventually support some refcounting to close races, the session cookie is now passed to crypto_getop() and clients should no longer set crp_sesssion directly. - Assymteric crypto operation structures should be allocated via crypto_getkreq() and freed via crypto_freekreq(). This permits the crypto layer to track open asym requests and close races with a driver trying to unregister while asym requests are in flight. - crypto_copyback, crypto_copydata, crypto_apply, and crypto_contiguous_subsegment now accept the 'crp' object as the first parameter instead of individual members. This makes it easier to deal with different buffer types in the future as well as separate input and output buffers. It's also simpler for driver writers to use. - bus_dmamap_load_crp() loads a DMA mapping for a crypto buffer. This understands the various types of buffers so that drivers that use DMA do not have to be aware of different buffer types. - Helper routines now exist to build an auth context for HMAC IPAD and OPAD. This reduces some duplicated work among drivers. - Key buffers are now treated as const throughout the framework and in device drivers. However, session key buffers provided when a session is created are expected to remain alive for the duration of the session. - GCM and CCM sessions now only specify a cipher algorithm and a cipher key. The redundant auth information is not needed or used. - For cryptosoft, split up the code a bit such that the 'process' callback now invokes a function pointer in the session. This function pointer is set based on the mode (in effect) though it simplifies a few edge cases that would otherwise be in the switch in 'process'. It does split up GCM vs CCM which I think is more readable even if there is some duplication. - I changed /dev/crypto to support GMAC requests using CRYPTO_AES_NIST_GMAC as an auth algorithm and updated cryptocheck to work with it. - Combined cipher and auth sessions via /dev/crypto now always use ETA mode. The COP_F_CIPHER_FIRST flag is now a no-op that is ignored. This was actually documented as being true in crypto(4) before, but the code had not implemented this before I added the CIPHER_FIRST flag. - I have not yet updated /dev/crypto to be aware of explicit modes for sessions. I will probably do that at some point in the future as well as teach it about IV/nonce and tag lengths for AEAD so we can support all of the NIST KAT tests for GCM and CCM. - I've split up the exising crypto.9 manpage into several pages of which many are written from scratch. - I have converted all drivers and consumers in the tree and verified that they compile, but I have not tested all of them. I have tested the following drivers: - cryptosoft - aesni (AES only) - blake2 - ccr and the following consumers: - cryptodev - IPsec - ktls_ocf - GELI (lightly) I have not tested the following: - ccp - aesni with sha - hifn - kgssapi_krb5 - ubsec - padlock - safe - armv8_crypto (aarch64) - glxsb (i386) - sec (ppc) - cesa (armv7) - cryptocteon (mips64) - nlmsec (mips64) Discussed with: cem Relnotes: yes Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D23677 Notes: svn path=/head/; revision=359374
* tests/sys/opencrypto: enable armv8crypto on aarch64Enji Cooper2019-08-101-2/+3
| | | | | | | | | | | | | | This change makes required modifications in runtests to also only require the aesni module on Intel (i386/amd64) platforms, as it is an Intel specific module. MFC after: 1 month MFC to: ^/stable/12 (support not present on ^/stable/11) Submitted by: Greg V <greg@unrelenting.technology> Differential Revision: https://reviews.freebsd.org/D21018 Notes: svn path=/head/; revision=350837
* Add my name to the copyrightEnji Cooper2019-05-211-0/+1
| | | | | | | | | | | I have contributed a number of changes to these tests over the past few hundred revisions, and believe I deserve credit for the changes I have made (plus, the copyright hadn't been updated since 2014). MFC after: 1 week Notes: svn path=/head/; revision=348047
* Fix `KAT(CCM)?Parser` file descriptor leaksEnji Cooper2019-05-211-15/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `KAT(CCM)?Parser` into a context suite-capable object by implementing `__enter__` and `__exit__` methods which manage opening up the file descriptors and closing them on context exit. This implementation was decided over adding destructor logic to a `__del__` method, as there are a number of issues around object lifetimes when dealing with threading cleanup, atexit handlers, and a number of other less obvious edgecases. Plus, the architected solution is more pythonic and clean. Complete the iterator implementation by implementing a `__next__` method for both classes which handles iterating over the data using a generator pattern, and by changing `__iter__` to return the object instead of the data which it would iterate over. Alias the `__next__` method to `next` when working with python 2.x in order to maintain functional compatibility between the two major versions. As part of this work and to ensure readability, push the initialization of the parser objects up one layer and pass it down to a helper function. This could have been done via a decorator, but I was trying to keep it simple for other developers to make it easier to modify in the future. This fixes ResourceWarnings with python 3. PR: 237403 MFC after: 1 week Tested with: python 2.7.16 (amd64), python 3.6.8 (amd64) Notes: svn path=/head/; revision=348032
* Followup to r347996Enji Cooper2019-05-211-4/+4
| | | | | | | | | | | Replace uses of `foo.encode("hex")` with `binascii.hexlify(foo)` for forwards compatibility between python 2.x and python 3. PR: 237403 MFC after: 1 week Notes: svn path=/head/; revision=348024
* Replace uses of `foo.(de|en)code('hex')` with `binascii.(un)?hexlify(foo)`Enji Cooper2019-05-201-36/+38
| | | | | | | | | | | | | | | | | | | | Python 3 no longer doesn't support encoding/decoding hexadecimal numbers using the `str.format` method. The backwards compatible new method (using the binascii module/methods) is a comparable means of converting to/from hexadecimal format. In short, the functional change is the following: * `foo.decode('hex')` -> `binascii.unhexlify(foo)` * `foo.encode('hex')` -> `binascii.hexlify(foo)` While here, move the dpkt import in `cryptodev.py` down per PEP8, so it comes after the standard library provided imports. PR: 237403 MFC after: 1 week Notes: svn path=/head/; revision=347996
* Fix typo: `Plen` should be `plen`Enji Cooper2019-04-241-1/+1
| | | | | | | | | MFC after: 1 month MFC with: r346617 Reported by: pylint -E Notes: svn path=/head/; revision=346626
* Chase PEP-3110Enji Cooper2019-04-241-9/+9
| | | | | | | | | | | | | Replace `except Environment, e:` with `except Environment as e` for compatibility between python 2.x and python 3.x. While here, fix a bad indentation change from r346620 by reindenting the code properly. MFC after: 2 months Notes: svn path=/head/; revision=346623
* Reapply whitespace style changes from r346443 after recent changes to ↵Enji Cooper2019-04-241-370/+370
| | | | | | | | | | | | | | | | | | | | | tests/sys/opencrypto From r346443: """ Replace hard tabs with four-character indentations, per PEP8. This is being done to separate stylistic changes from the tests from functional ones, as I accidentally introduced a bug to the tests when I used four-space indentation locally. No functional change. """ MFC after: 2 months Discussed with: jhb Notes: svn path=/head/; revision=346620
* Test the AES-CCM test vectors from the NIST Known Answer Tests.John Baldwin2019-04-241-0/+95
| | | | | | | | | | | | | | | | | | | | | | The CCM test vectors use a slightly different file format in that there are global key-value pairs as well as section key-value pairs that need to be used in each test. In addition, the sections can set multiple key-value pairs in the section name. The CCM KAT parser class is an iterator that returns a dictionary once per test where the dictionary contains all of the relevant key-value pairs for a given test (global, section name, section, test-specific). Note that all of the CCM decrypt tests use nonce and tag lengths that are not supported by OCF (OCF only supports a 12 byte nonce and 16 byte tag), so none of the decryption vectors are actually tested. Reviewed by: ngie MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D19978 Notes: svn path=/head/; revision=346617
* Run the plain SHA digest tests from NIST.John Baldwin2019-04-241-13/+53
| | | | | | | | | | | | | | | Pass in an explicit digest length to the Crypto constructor since it was assuming only sessions with a MAC key would have a MAC. Passing an explicit size allows us to test the full digest in HMAC tests as well. Reviewed by: cem MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D19884 Notes: svn path=/head/; revision=346616
* Use more descriptive algorithm names in skip messages.John Baldwin2019-04-241-4/+4
| | | | | | | | | | Reviewed by: cem, ngie MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D19977 Notes: svn path=/head/; revision=346615
* Skip tests with missing test vectors instead of failing.John Baldwin2019-04-241-1/+3
| | | | | | | | | | | | | | | | | This copes more gracefully when older version of the nist-kat package are intalled that don't have newer test vectors such as CCM or plain SHA. If the nist-kat package is not installed at all, this still fails with an error. Reviewed by: cem MFC after: 1 month Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D20034 Notes: svn path=/head/; revision=346614
* Revert r346443Enji Cooper2019-04-201-250/+250
| | | | | | | | | | | | | | | My wide sweeping stylistic change (while well intended) is impeding others from working on `tests/sys/opencrypto`. The plan is to revert the change in ^/head, then reintroduce the changes after the other changes get merged into ^/head . Approved by: emaste (mentor; implicit) Requested by: jhb MFC after: 2 months Notes: svn path=/head/; revision=346452
* tests/sys/opencrypto: fix whitespace per PEP8Enji Cooper2019-04-201-250/+250
| | | | | | | | | | | | | | | | Replace hard tabs with four-character indentations, per PEP8. This is being done to separate stylistic changes from the tests from functional ones, as I accidentally introduced a bug to the tests when I used four-space indentation locally. No functional change. MFC after: 2 months Approved by: emaste (mentor: implicit blanket approval for trivial fixes) Notes: svn path=/head/; revision=346443
* Specify using Python2, these .py files have not been converted to use Python3Li-Wen Hsu2019-04-201-1/+1
| | | | | | | | | yet, but the default Python version in ports has been switched to 3. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=346431
* Test SHA2-224-HMAC now that OCF supports it.John Baldwin2019-04-191-5/+2
| | | | | | | | | | Reviewed by: cem MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D19882 Notes: svn path=/head/; revision=346421
* Add ccp(4): experimental driver for AMD Crypto Co-ProcessorConrad Meyer2018-01-181-10/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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 Notes: svn path=/head/; revision=328150
* aesni(4): Add support for x86 SHA intrinsicsConrad Meyer2017-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some x86 class CPUs have accelerated intrinsics for SHA1 and SHA256. Provide this functionality on CPUs that support it. This implements CRYPTO_SHA1, CRYPTO_SHA1_HMAC, and CRYPTO_SHA2_256_HMAC. Correctness: The cryptotest.py suite in tests/sys/opencrypto has been enhanced to verify SHA1 and SHA256 HMAC using standard NIST test vectors. The test passes on this driver. Additionally, jhb's cryptocheck tool has been used to compare various random inputs against OpenSSL. This test also passes. Rough performance averages on AMD Ryzen 1950X (4kB buffer): aesni: SHA1: ~8300 Mb/s SHA256: ~8000 Mb/s cryptosoft: ~1800 Mb/s SHA256: ~1800 Mb/s So ~4.4-4.6x speedup depending on algorithm choice. This is consistent with the results the Linux folks saw for 4kB buffers. The driver borrows SHA update code from sys/crypto sha1 and sha256. The intrinsic step function comes from Intel under a 3-clause BSDL.[0] The intel_sha_extensions_sha<foo>_intrinsic.c files were renamed and lightly modified (added const, resolved a warning or two; included the sha_sse header to declare the functions). [0]: https://software.intel.com/en-us/articles/intel-sha-extensions-implementations Reviewed by: jhb Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12452 Notes: svn path=/head/; revision=324037
* crypto(9): Use a more specific error code when a capable driver is not foundConrad Meyer2017-09-261-2/+9
| | | | | | | | | | | | | | | When crypto_newsession() is given a request for an unsupported capability, raise a more specific error than EINVAL. This allows cryptotest.py to skip some HMAC tests that a driver does not support. Reviewed by: jhb, rlibby Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D12451 Notes: svn path=/head/; revision=323999
* Convert some idioms over to py3k-compatible idiomsEnji Cooper2017-09-241-13/+14
| | | | | | | | | | | | | - Import print_function from __future__ and use print(..) instead of `print ..`. - Use repr instead of backticks when the object needs to be dumped, unless print(..) can do it lazily. Use str instead of backticks as appropriate for simplification reasons. This doesn't fully convert these modules over py3k. It just gets over some of the trivial compatibility hurdles. Notes: svn path=/head/; revision=323960
* cryptotest.py: Like r323869, skip SHA HMAC tests on non-SHA driversConrad Meyer2017-09-221-0/+1
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323899
* cryptotest.py: Fix whitespace style errorsConrad Meyer2017-09-221-16/+16
| | | | | | | | | | | | I accidentally introduced different whitespace style in r323878. I'm not used to using tabs for indentation in Python scripts. Whitespace only; no functional change. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323898
* cryptotest.py: Actually use NIST-KAT HMAC test vectors and test the right hashesConrad Meyer2017-09-211-7/+43
| | | | | | | | | | | | | | | | | | | | Previously, this test was entirely a no-op as no vector in the NIST-KAT file has a precisely 20-byte key. Additionally, not every vector in the file is SHA1. The length field determines the hash under test, and is now decoded correctly. Finally, due to a limitation I didn't feel like fixing in cryptodev.py, MACs are truncated to 16 bytes in this test. With this change and the uncommitted D12437 (to allow key sizes other than those used in IPSec), the SHA tests in cryptotest.py actually test something and e.g. at least cryptosoft passes the test. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323878
* cryptotest.py: Do not run AES-CBC or AES-GCM tests on non-AES crypto(4) driversConrad Meyer2017-09-211-0/+2
| | | | | | | | | | | For some reason, we only skipped AES-XTS tests if a driver was not in the aesmodules list. Skip other AES modes as well to prevent spurious failures in non-AES drivers. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323869
* cryptotest.py: Add a seatbelt that we're actually testing anythingConrad Meyer2017-09-211-0/+1
| | | | | | | | | | Without nist-kat installed, cryptotest.py is a no-op. Showing 'success' in that case is unhelpful. Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=323843
* Add the ccr0 device to the opencrypto tests against the NIST KAT tests.John Baldwin2017-06-081-2/+3
| | | | | | | | | The ccr0 device supports both AES and SHA tests. Sponsored by: Chelsio Communications Notes: svn path=/head/; revision=319725
* Add some new modes to OpenCrypto. These modes are AES-ICM (can be usedJohn-Mark Gurney2014-12-121-0/+265
for counter mode), and AES-GCM. Both of these modes have been added to the aesni module. Included is a set of tests to validate that the software and aesni module calculate the correct values. These use the NIST KAT test vectors. To run the test, you will need to install a soon to be committed port, nist-kat that will install the vectors. Using a port is necessary as the test vectors are around 25MB. All the man pages were updated. I have added a new man page, crypto.7, which includes a description of how to use each mode. All the new modes and some other AES modes are present. It would be good for someone else to go through and document the other modes. A new ioctl was added to support AEAD modes which AES-GCM is one of them. Without this ioctl, it is not possible to test AEAD modes from userland. Add a timing safe bcmp for use to compare MACs. Previously we were using bcmp which could leak timing info and result in the ability to forge messages. Add a minor optimization to the aesni module so that single segment mbufs don't get copied and instead are updated in place. The aesni module needs to be updated to support blocked IO so segmented mbufs don't have to be copied. We require that the IV be specified for all calls for both GCM and ICM. This is to ensure proper use of these functions. Obtained from: p4: //depot/projects/opencrypto Relnotes: yes Sponsored by: FreeBSD Foundation Sponsored by: NetGate Notes: svn path=/head/; revision=275732