Add CryptoMB private key provider to contrib.#17826
Conversation
Intel's IPP (Integrated Performance Primitives) crypto library has support for multi-buffer crypto operations. Briefly, multi-buffer cryptography is implemented with AVX-512 instructions using a SIMD (single instruction, multiple data) mechanism. Up to eight RSA or ECDSA operations are gathered together into a buffer and processed at the same time, providing potentially improved performance. The AVX-512 instructions are available on recently launched 3rd generation Xeon Scalable server processors (Ice Lake server) processors. This commit adds a private key provider to accelerate RSA and ECDSA crypto operations on recent Intel Xeon processors. Every worker thread has a queue of up-to-eight crypto operations. When the queue is full or when the timer is triggered, the queue is processed and all the pending handshakes are notified. The potential performance benefit depends on many factors: the size of the cpuset Envoy is running on, incoming traffic pattern, encryption type (RSA or ECDSA), and key size. In my own testing I saw the biggest performance increase when long RSA keys were used on an Envoy running in a fairly limited environment serving lots of new incoming TLS requests. One new dependency is introduced: Intel’s ipp-crypto library. The library has to be patched at the moment in order to make it compile against BoringSSL and Bazel build system. The ipp-crypto team has indicated that they will accept the patches and release them in future ipp-crypto versions. Basic end-to-end tests are provided, and a fake library interface is included for testing on systems without the required AVX512 instruction set. Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
|
Merged main branch to solve conflicts. |
ggreenway
left a comment
There was a problem hiding this comment.
This looks good overall.
Still trying to figure out some details of how contrib/ works with regards to changes in core (dependencies, docs, etc). Sorry for the delays.
/wait
contrib/cryptomb/private_key_providers/source/ipp_crypto_disabled_impl.h
Outdated
Show resolved
Hide resolved
contrib/cryptomb/private_key_providers/test/test_data/ecdsa-p256.pem
Outdated
Show resolved
Hide resolved
contrib/cryptomb/private_key_providers/source/cryptomb_private_key_provider.cc
Outdated
Show resolved
Hide resolved
contrib/cryptomb/private_key_providers/source/cryptomb_private_key_provider.cc
Show resolved
Hide resolved
bazel/foreign_cc/BUILD
Outdated
| }), | ||
| ) | ||
|
|
||
| envoy_cmake( |
There was a problem hiding this comment.
Can this rule be moved into the BUILD file in your extension directory?
There was a problem hiding this comment.
My bazel skills are somewhat limited, so please tell if I'm not understanding everything here, but is the idea that only the envoy_cmake rule would be moved? The source URL would still be in bazel/repository_locations.bzl and the python build rule in bazel/repositories.bzl? I was trying to see what the other contrib extensions are doing, and it seems that at least sqlparser BUILD file is in bazel/external directory.
| Envoy to support various key management schemes (such as TPM) and TLS | ||
| acceleration. This mechanism uses `BoringSSL private key method interface | ||
| <https://github.com/google/boringssl/blob/c0b4c72b6d4c6f4828a373ec454bd646390017d4/include/openssl/ssl.h#L1169>`_. | ||
| :ref:`CryptoMb private key provider |
There was a problem hiding this comment.
We don't want core docs to link to contrib extensions. However, I would encourage you to put a README.md in contrib/cryptomb.
There was a problem hiding this comment.
Hmm, is this rule only for new contrib extensions? It seems to me that core docs are linking to old contrib extensions such as mysql and squash. Or is it just that the .rst files are located within the docs directory, but the document TOC tree isn't linking to it? The contrib google doc says:
contrib/ extensions will have a new top level documentation section categorized by extension type. Extensions with documentation will put their documentation in that section. This will make it easy for users to see what extra extensions are available in the envoy-contrib images.
However, I don't seem to find that section, so maybe it's not there yet. Maybe in the interim just remove the docs and add them in another PR when the contrib doc section is there?
There was a problem hiding this comment.
I think that's because those filters existed before we had contrib, so their docs are still in core docs. That should get cleaned up at some point. But new contrib extensions shouldn't add core docs.
There was a problem hiding this comment.
Ok, I reverted the docs change. I think we can re-add the docs when the contrib doc section is there.
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
| #include "openssl/ssl.h" | ||
|
|
||
| // BoringSSL internal definitions, needed for calculating ECDSA ephemeral key. | ||
| // TODO(ipuustin): ask BoringSSL maintainers to expose these in the BoringSSL headers? |
There was a problem hiding this comment.
There was a problem hiding this comment.
I don't think we're likely to do that because we keep eyeing whether we can put a version-skew coupling around the FIPS module.
(And it goes without saying that copy-pasting bits of internal headers is invalid and this change cannot land while doing that.)
There was a problem hiding this comment.
In this case, do you think there could be some other way how BoringSSL could provide access to this functionality? It seems to me that the only non-trivial function needed for this is bn_rand_range_words() and the functions it calls. I would love to use ready-made functions rather than implementing it myself. OpenSSL has library access to ECDSA ephemeral key generation, and I think I can't be the only person needing this.
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
|
The ARM build is broken. It took me awhile to find the actual error in the logs, but it is:
I don't understand why the ipp-crypto library is being built in this case, because the dependency on it is selecting for linux-x86_64, and this is ARM64 here. If you can't figure out why this is being built either, try to find some help on slack in the bazel or envoy-dev channels. /wait |
|
But the doc fix looks good; thanks for taking care of that. |
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com>
|
/retest |
|
Retrying Azure Pipelines: |
So it turned out that do_ci.sh script is building |
|
@ggreenway: Please take another look. Do you think the bazel fixes for coverage targets are now right? |
|
/assign-from @envoyproxy/dependency-shepherds |
|
@envoyproxy/dependency-shepherds assignee is @moderation |
|
/lgtm deps |
Intel's IPP (Integrated Performance Primitives) crypto library has support for multi-buffer crypto operations. Briefly, multi-buffer cryptography is implemented with AVX-512 instructions using a SIMD (single instruction, multiple data) mechanism. Up to eight RSA or ECDSA operations are gathered together into a buffer and processed at the same time, providing potentially improved performance. The AVX-512 instructions are available on recently launched 3rd generation Xeon Scalable server processors (Ice Lake server) processors. This commit adds a private key provider to accelerate RSA and ECDSA crypto operations on recent Intel Xeon processors. Every worker thread has a queue of up-to-eight crypto operations. When the queue is full or when the timer is triggered, the queue is processed and all the pending handshakes are notified. The potential performance benefit depends on many factors: the size of the cpuset Envoy is running on, incoming traffic pattern, encryption type (RSA or ECDSA), and key size. In my own testing I saw the biggest performance increase when long RSA keys were used on an Envoy running in a fairly limited environment serving lots of new incoming TLS requests. For more details, see this Intel whitepaper which contains some more information about the AVX-512 instructions and potential performance increase: https://www.intel.com/content/www/us/en/architecture-and-technology/crypto-acceleration-in-xeon-scalable-processors-wp.html Additional Description: One new dependency is introduced: Intel’s ipp-crypto library. Currently the PR is using a development version of ipp-crypto because BoringSSL support is not yet part of any release. The ipp-crypto team has indicated that BoringSSL version will be included in future ipp-crypto releases. Basic tests are provided, and a fake library interface is included for testing on systems without the required AVX-512 instruction set. Risk Level: Medium (TLS security feature, not enabled by default) Testing: Unit tests Docs Changes: API interface is documented Release Notes: Added CryptoMB private key provider to contrib. Platform Specific Features: Requires Intel 3rd generation Xeon Scalable server processor for the AVX-512 IFMA instruction set. Fixes: envoyproxy#15871 Signed-off-by: Ismo Puustinen <ismo.puustinen@intel.com> Co-authored-by: Greg Greenway <ggreenway@apple.com>
Commit Message:
Intel's IPP (Integrated Performance Primitives) crypto library has support for multi-buffer crypto operations. Briefly, multi-buffer
cryptography is implemented with AVX-512 instructions using a SIMD (single instruction, multiple data) mechanism. Up to eight RSA or ECDSA operations are gathered together into a buffer and processed at the same time, providing potentially improved performance. The AVX-512 instructions are available on recently launched 3rd generation Xeon Scalable server processors (Ice Lake server) processors.
This commit adds a private key provider to accelerate RSA and ECDSA crypto operations on recent Intel Xeon processors. Every worker thread has a queue of up-to-eight crypto operations. When the queue is full or when the timer is triggered, the queue is processed and all the pending handshakes are notified.
The potential performance benefit depends on many factors: the size of the cpuset Envoy is running on, incoming traffic pattern, encryption type (RSA or ECDSA), and key size. In my own testing I saw the biggest performance increase when long RSA keys were used on an Envoy running in a fairly limited environment serving lots of new incoming TLS requests. For more details, see this Intel whitepaper which contains some more information about the AVX-512 instructions and potential performance increase: https://www.intel.com/content/www/us/en/architecture-and-technology/crypto-acceleration-in-xeon-scalable-processors-wp.html
Additional Description:
One new dependency is introduced: Intel’s ipp-crypto library. Currently the PR is using a development version of ipp-crypto because BoringSSL support is not yet part of any release. The ipp-crypto team has indicated that BoringSSL version will be included in future ipp-crypto releases.
Basic tests are provided, and a fake library interface is included for testing on systems without the required AVX-512 instruction set.
Risk Level: Medium (TLS security feature, not enabled by default)
Testing: Unit tests
Docs Changes: API interface is documented
Release Notes: Added CryptoMB private key provider to contrib.
Platform Specific Features: Requires Intel 3rd generation Xeon Scalable server processor for the AVX-512 IFMA instruction set.
Fixes: #15871