forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: He Jie Xu <[email protected]>
- Loading branch information
Showing
6 changed files
with
160 additions
and
1 deletion.
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,31 @@ | ||
#pragma once | ||
|
||
#include "envoy/common/pure.h" | ||
|
||
#include "openssl/ssl.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
class IppCrypto { | ||
public: | ||
virtual ~IppCrypto() = default; | ||
|
||
virtual int mbxIsCryptoMbApplicable(uint64_t features) PURE; | ||
virtual uint32_t mbx_nistp256_ecdsa_verify_mb8(const uint8_t* const pa_sign_r[8], | ||
const uint8_t* const pa_sign_s[8], | ||
const uint8_t* const pa_msg[8], | ||
const uint64_t* const pa_pubx[8], | ||
const uint64_t* const pa_puby[8], | ||
const uint64_t* const pa_pubz[8], | ||
uint8_t* pBuffer) PURE; | ||
}; | ||
|
||
using IppCryptoSharedPtr = std::shared_ptr<IppCrypto>; | ||
|
||
} // Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // 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,33 @@ | ||
#pragma once | ||
|
||
#include "contrib/cryptomb/private_key_providers/source/ipp_crypto.h" | ||
#include "crypto_mb/cpu_features.h" | ||
#include "crypto_mb/ec_nistp256.h" | ||
#include "crypto_mb/rsa.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
class IppCryptoImpl : public virtual IppCrypto { | ||
public: | ||
int mbxIsCryptoMbApplicable(uint64_t features) override { | ||
return ::mbx_is_crypto_mb_applicable(features); | ||
} | ||
uint32_t mbx_nistp256_ecdsa_verify_mb8(const uint8_t* const pa_sign_r[8], | ||
const uint8_t* const pa_sign_s[8], | ||
const uint8_t* const pa_msg[8], | ||
const uint64_t* const pa_pubx[8], | ||
const uint64_t* const pa_puby[8], | ||
const uint64_t* const pa_pubz[8], | ||
uint8_t* pBuffer) override { | ||
return ::mbx_nistp256_ecdsa_verify_mb8(pa_sign_r, pa_sign_s, pa_msg, pa_pubx, | ||
pa_puby, pa_pubz, pBuffer); | ||
} | ||
}; | ||
|
||
} // Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // 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,25 @@ | ||
#include "verifier.h" | ||
|
||
#include "openssl/ssl.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
ValidationResults::ValidationStatus CryptoMBVerifier::verify(X509_STORE_CTX *ctx) { | ||
// int n = (int)sk_X509_num(ctx->chain); | ||
// n--; | ||
// X509 *xi = sk_X509_value(ctx->chain, n); | ||
// EVP_PKEY *pkey = X509_get_pubkey(xi); | ||
|
||
if (X509_verify_cert(ctx) == 1) { | ||
return ValidationResults::ValidationStatus::Successful; | ||
} | ||
return ValidationResults::ValidationStatus::Failed; | ||
} | ||
|
||
} // Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // 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,18 @@ | ||
#pragma once | ||
|
||
#include "source/common/tls/cert_validator/cert_validator.h" | ||
|
||
namespace Envoy { | ||
namespace Extensions { | ||
namespace TransportSockets { | ||
namespace Tls { | ||
|
||
class CryptoMBVerifier { | ||
public: | ||
ValidationResults::ValidationStatus verify(X509_STORE_CTX *ctx); | ||
}; | ||
|
||
} // Tls | ||
} // namespace TransportSockets | ||
} // namespace Extensions | ||
} // namespace Envoy |