Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support compile with boringssl #2399

Merged
merged 8 commits into from
Oct 25, 2023
Merged

Support compile with boringssl #2399

merged 8 commits into from
Oct 25, 2023

Conversation

ehds
Copy link
Contributor

@ehds ehds commented Sep 27, 2023

What problem does this PR solve?

Issue Number: #1255 #2167

Problem Summary: Support bRPC compile with boringssl

What is changed and the side effects?

Changed:
增加兼容函数:

  • AddBIOBuffer, boringssl 没有 BIO_f_buffer 函数, 使用 BIO_s_mem 代替
  • boringssl 未提供 get_rfc2409_prime_xxx 等一些函数,需要使用 sssl_compat.h 中提供的。
  • boringssl 未提供 BIO_fd_non_fatal_error ,需要加入 ssl_compat.h 中。

目前仅支持 CMake/Bazel 的编译方式
支持的 boringssl 版本 fips-20210429

Side effects:

  • Performance effects(性能影响):
  • Breaking backward compatibility(向后兼容性):

Check List:

  • Please make sure your changes are compilable(请确保你的更改可以通过编译).
  • When providing us with a new feature, it is best to add related tests(如果你向我们增加一个新的功能, 请添加相关测试).
  • Please follow Contributor Covenant Code of Conduct.(请遵循贡献者准则).

@ehds ehds changed the title Support boringssl Support compile with boringssl Sep 27, 2023
@ehds ehds force-pushed the support-boringssl branch 2 times, most recently from a4a51af to 3306106 Compare September 27, 2023 17:12
@ehds ehds force-pushed the support-boringssl branch from 3306106 to 20a619d Compare September 27, 2023 17:26
@ehds ehds force-pushed the support-boringssl branch from 80810b9 to 56a90ad Compare September 28, 2023 02:19
@@ -95,7 +95,9 @@ jobs:
run: |
export CC=gcc && export CXX=g++
bazel build -j 12 -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...

- name: compile-with-boringssl
run: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加上这个step之后,gcc-compile-with-bazel-all-options的运行时间达到了1个小时
可否拆成两个并行的任务?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 新增 gcc-compile-with-boringssl 任务

@@ -178,6 +180,9 @@ jobs:
run: |
export CC=clang && export CXX=clang++
bazel build -j ${{env.proc_num}} -c opt --define with_mesalink=false --define with_glog=true --define with_thrift=true --copt -DHAVE_ZLIB=1 //...
- name: compile-with-boringssl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done 新增 clang-compile-with-boringssl 任务

@ehds ehds requested a review from wwbmmm October 13, 2023 07:42
@wwbmmm
Copy link
Contributor

wwbmmm commented Oct 14, 2023

LGTM

@wwbmmm wwbmmm merged commit 761b399 into apache:master Oct 25, 2023
amosbird pushed a commit to amosbird/brpc that referenced this pull request Dec 28, 2023
* support boringssl

* add CMakeLists

* fix

* suopport boring ssl bazel

* fix AddBioBuffer code

* fix compile

* add boringssl compile bazel ci

* set compile with boringssl as a dependent job

---------

Co-authored-by: Dongsheng He <hds@dipeak.com>
@yyweii
Copy link
Contributor

yyweii commented Nov 9, 2024

@ehds 我尝试了下用boringssl,打开http_verbose,有打印发送请求的信息,但是收不到回复。如果把AddBIOBuffer去掉,能够正常运作。可能BIO_s_mem并不能代替BIO_f_buffer

auto m1 = BIO_new(BIO_s_mem());
auto m2 = BIO_new(BIO_s_mem());
auto m3 = BIO_push(m1, m2);
string buf = "123";
int nw = BIO_write(m3, buf.data(), buf.size());
cout << "write nw=" << nw << endl;
BIO_flush(m3);
char rd_buf[16] = {0};
int nr = BIO_read(m2, rd_buf, 16);
cout << "read nr=" << nr << endl;

输出:
write nw=3
read nr=-1

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants