forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move common/crypto impl to extensions for openssl (envoyproxy#7344)
Description: Move common/crypto impl (i.e. utility.cc) to extensions to make it clear that the impl is ssl-impl specific (e.g. boringgsl vs openssl) and easier to plug in an openssl impl. Risk Level: Low Testing: Passes all standard tests Docs Changes: None Release Notes: None Signed-off-by: William DeCoste <[email protected]>
- Loading branch information
Showing
19 changed files
with
223 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
load( | ||
"//bazel:envoy_build_system.bzl", | ||
"envoy_cc_library", | ||
"envoy_package", | ||
) | ||
|
||
envoy_package() | ||
|
||
envoy_cc_library( | ||
name = "crypto_interface", | ||
hdrs = ["crypto.h"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
namespace Envoy { | ||
namespace Common { | ||
namespace Crypto { | ||
|
||
class CryptoObject { | ||
public: | ||
virtual ~CryptoObject() = default; | ||
}; | ||
|
||
using CryptoObjectPtr = std::unique_ptr<CryptoObject>; | ||
|
||
namespace Access { | ||
|
||
template <class T> T* getTyped(CryptoObject& crypto) { return dynamic_cast<T*>(&crypto); } | ||
|
||
} // namespace Access | ||
|
||
} // namespace Crypto | ||
} // namespace Common | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
licenses(["notice"]) # Apache 2 | ||
|
||
load( | ||
"//bazel:envoy_build_system.bzl", | ||
"envoy_cc_library", | ||
"envoy_package", | ||
) | ||
|
||
envoy_package() | ||
|
||
envoy_cc_library( | ||
name = "utility_lib", | ||
srcs = [ | ||
"crypto_impl.cc", | ||
"utility.cc", | ||
], | ||
hdrs = [ | ||
"crypto_impl.h", | ||
], | ||
external_deps = [ | ||
"ssl", | ||
], | ||
deps = [ | ||
"//include/envoy/buffer:buffer_interface", | ||
"//source/common/common:assert_lib", | ||
"//source/common/common:stack_array", | ||
"//source/common/crypto:utility_lib", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "extensions/common/crypto/crypto_impl.h" | ||
|
||
namespace Envoy { | ||
namespace Common { | ||
namespace Crypto { | ||
|
||
EVP_PKEY* PublicKeyObject::getEVP_PKEY() const { return pkey_.get(); } | ||
|
||
void PublicKeyObject::setEVP_PKEY(EVP_PKEY* pkey) { pkey_.reset(pkey); } | ||
|
||
} // namespace Crypto | ||
} // namespace Common | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include "envoy/common/crypto/crypto.h" | ||
|
||
#include "openssl/base.h" | ||
#include "openssl/evp.h" | ||
|
||
namespace Envoy { | ||
namespace Common { | ||
namespace Crypto { | ||
|
||
class PublicKeyObject : public Envoy::Common::Crypto::CryptoObject { | ||
public: | ||
PublicKeyObject() = default; | ||
PublicKeyObject(EVP_PKEY* pkey) : pkey_(pkey) {} | ||
PublicKeyObject(const PublicKeyObject& pkey_wrapper); | ||
EVP_PKEY* getEVP_PKEY() const; | ||
void setEVP_PKEY(EVP_PKEY* pkey); | ||
|
||
private: | ||
bssl::UniquePtr<EVP_PKEY> pkey_; | ||
}; | ||
|
||
} // namespace Crypto | ||
} // namespace Common | ||
} // namespace Envoy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.