Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fuzz/*: fuzz rats-tls APIs in sgx mode #184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Ben-cpy
Copy link
Contributor

@Ben-cpy Ben-cpy commented Sep 26, 2023

use libfuzzer to fuzz rats-tls API rats_tls_init(), rats_tls_negotiate(),rats_tls_transmit() and
rats_tls_receive() in sgx mode

@Ben-cpy Ben-cpy force-pushed the fuzz_sgx branch 4 times, most recently from 673d835 to f13edd0 Compare October 14, 2023 08:43
@Ben-cpy Ben-cpy force-pushed the fuzz_sgx branch 2 times, most recently from 83bc27e to 897b012 Compare October 17, 2023 08:42
@Ben-cpy Ben-cpy force-pushed the fuzz_sgx branch 2 times, most recently from 1f27728 to 3fbcf16 Compare October 30, 2023 14:49
@haosanzi haosanzi marked this pull request as ready for review October 31, 2023 08:15
set(SGX_COMMON_CXXFLAGS "${SGX_COMMON_FLAGS} -Wnon-virtual-dtor -std=c++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -fPIC -Werror=implicit-function-declaration")
endif()

Copy link
Contributor

Choose a reason for hiding this comment

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

if((BUILD_FUZZ) AND (SGX))

string(REPLACE "-std=gnu11" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
string(REPLACE "-std=c11" "" SGX_COMMON_FLAGS "${SGX_COMMON_FLAGS}")
string(REPLACE "-std=c++11" "" SGX_COMMON_CXXFLAGS "${SGX_COMMON_CXXFLAGS}")

fuzz/README.md Outdated Show resolved Hide resolved
char verifier_types[10][25] = { "nullverifier", "", "sgx_la",
"csv", "sev", "sev_snp",
"tdx_ecdsa", "tdx_ecdsa", "sgx_ecdsa_qve" };
strcpy(verifier_types[9], fuzzed_data.ConsumeBytesWithTerminator(20, '\0').data());
Copy link
Contributor

Choose a reason for hiding this comment

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

Did not use verifier_types in the following code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I just comment this line 95-98 ?

uint16_t s_port = htons((uint16_t)FUZZ_PORT);

char * attester_type = (char *)malloc(20);
if(attester_type == NULL){
Copy link
Contributor

Choose a reason for hiding this comment

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

char * attester_type to char *attester_type . please check the other code

use libfuzzer to fuzz rats-tls API `rats_tls_init()`, `rats_tls_negotiate()`, `rats_tls_transmit()`, `rats_tls_receive()`, `rats_tls_cleanup()` in sgx mode.

Signed-off-by: Pengyu Chen <chenpengyu_1024@163.com>
@@ -58,6 +62,11 @@ if(SGX)

set(SGX_COMMON_CFLAGS "${SGX_COMMON_FLAGS} -Wstrict-prototypes -Wunsuffixed-float-constants -Wno-implicit-function-declaration -std=c11")
set(SGX_COMMON_CXXFLAGS "${SGX_COMMON_FLAGS} -Wnon-virtual-dtor -std=c++11")
if((BUILD_FUZZ) AND (SGX))
Copy link
Contributor

Choose a reason for hiding this comment

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

remove AND (SGX) ,since if(SGX) is in line 21,

@@ -12,6 +12,10 @@ else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
endif()

if((BUILD_FUZZ) AND (SGX))
string(REPLACE "-std=gnu11" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
endif()
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove this code to line 65

@Ben-cpy Ben-cpy force-pushed the fuzz_sgx branch 2 times, most recently from cf1d777 to 2f6f25f Compare November 20, 2023 03:29
@Ben-cpy Ben-cpy force-pushed the fuzz_sgx branch 2 times, most recently from 9898753 to fb8ba10 Compare December 11, 2023 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants