Skip to content

Commit

Permalink
repo-sync-2024-11-08T15:48:58+0800 (#416)
Browse files Browse the repository at this point in the history
Co-authored-by: Jamie-Cui <shanzhu.cjm@antgroup.com>
  • Loading branch information
Jamie-Cui and Jamie-Cui authored Nov 19, 2024
1 parent 675147e commit e4efe96
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ def _org_interconnection():
http_archive,
name = "org_interconnection",
urls = [
"https://github.com/secretflow/interconnection/archive/30e4220b7444d0bb077a9040f1b428632124e31a.tar.gz",
"https://github.com/secretflow/interconnection/archive/16957915c16839503bd18f55aa536f475ab61856.tar.gz",
],
strip_prefix = "interconnection-30e4220b7444d0bb077a9040f1b428632124e31a",
sha256 = "341f6de0fa7dd618f9723009b9cb5b1da1788aacb9e12acfb0c9b19e5c5a7354",
strip_prefix = "interconnection-16957915c16839503bd18f55aa536f475ab61856",
sha256 = "fad6d278632361f3a79d05254feaec890da3d287e441feedbe7a4fe51521c439",
)

# Add homebrew openmp for macOS, somehow..homebrew installs to different location on Apple Silcon/Intel macs.. so we need two rules here
Expand Down
1 change: 1 addition & 0 deletions yacl/crypto/ossl_provider/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@ yacl_cc_test(
deps = [
":helper",
"//yacl/base:exception",
"@bazel_tools//tools/cpp/runfiles",
],
)
18 changes: 16 additions & 2 deletions yacl/crypto/ossl_provider/provider_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <stdlib.h>

#include <memory>

#include "gtest/gtest.h"
Expand All @@ -22,19 +24,31 @@
#include "openssl/proverr.h"
#include "openssl/rand.h"
#include "openssl/randerr.h"
#include "tools/cpp/runfiles/runfiles.h"

#include "yacl/crypto/openssl_wrappers.h"
#include "yacl/crypto/ossl_provider/helper.h"

using bazel::tools::cpp::runfiles::Runfiles;

namespace yacl::crypto {

TEST(OpensslTest, ShouldWork) {
auto libctx = openssl::UniqueLib(OSSL_LIB_CTX_new());

std::string error;
std::unique_ptr<Runfiles> runfiles(Runfiles::CreateForTest(&error));

ASSERT_TRUE(runfiles != nullptr) << error;

std::string provider_path =
runfiles->Rlocation("_main/yacl/crypto/ossl_provider");
setenv("OPENSSL_MODULES", provider_path.c_str(), 1);

// OSSL_PROVIDER_load() loads and initializes a provider. This may simply
// initialize a provider that was previously added with
auto prov = openssl::UniqueProv(
OSSL_PROVIDER_load(libctx.get(), GetProviderPath().c_str()));
auto prov =
openssl::UniqueProv(OSSL_PROVIDER_load(libctx.get(), "libprov_shared"));
YACL_ENFORCE(prov != nullptr, ERR_error_string(ERR_get_error(), nullptr));

// get provider's entropy source EVP_RAND* rand;
Expand Down

0 comments on commit e4efe96

Please sign in to comment.