Skip to content

Commit

Permalink
merge branch 'master' into kazuho/pacer
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuho committed Oct 20, 2023
2 parents 32b6ebb + aae8e57 commit 95f6f52
Show file tree
Hide file tree
Showing 43 changed files with 3,762 additions and 744 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on: [push, pull_request]

jobs:
build:
name: "${{ matrix.name }}"
runs-on: [ubuntu-latest]

# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository

strategy:
fail-fast: false
matrix:
include:
- name: default
command: make -f misc/docker-ci.mk
- name: openssl-3.0
command: make -f misc/docker-ci.mk CONTAINER_NAME=h2oserver/h2o-ci:ubuntu2204
- name: boringssl
command: make -f misc/docker-ci.mk CONTAINER_NAME=h2oserver/h2o-ci:ubuntu2204 CMAKE_ARGS='-DOPENSSL_ROOT_DIR=/opt/boringssl'
- name: asan
command: make -f misc/docker-ci.mk CONTAINER_NAME=h2oserver/h2o-ci:ubuntu2204 CMAKE_ARGS='-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_CXX_FLAGS=-fsanitize=address' CHECK_ENVS='ASAN_OPTIONS=detect_leaks=0'

timeout-minutes: 10
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Run with Docker
shell: 'script -q -e -c "bash -xe {0}"'
run: |
chmod -R ugo+w .
${{ matrix.command }}
58 changes: 36 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
CMAKE_POLICY(SET CMP0003 NEW)

PROJECT(quicly)

INCLUDE(CMakePushCheckState)
INCLUDE(CheckCSourceCompiles)
INCLUDE(deps/picotls/cmake/boringssl-adjust.cmake)
INCLUDE(deps/picotls/cmake/dtrace-utils.cmake)

FIND_PACKAGE(OpenSSL REQUIRED)
BORINGSSL_ADJUST()
IF (OPENSSL_FOUND AND (OPENSSL_VERSION VERSION_LESS "1.0.2"))
MESSAGE(FATAL "OpenSSL 1.0.2 or above is missing")
ENDIF ()
Expand All @@ -16,10 +20,11 @@ IF (WITH_DTRACE)
MESSAGE(STATUS "Enabling USDT support")
ENDIF ()

IF ((CMAKE_SIZEOF_VOID_P EQUAL 8) AND
(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") OR
(CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64") OR
(CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"))
CMAKE_PUSH_CHECK_STATE()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mavx2 -maes -mpclmul -mvaes -mvpclmulqdq")
CHECK_C_SOURCE_COMPILES("int main(void) {}" CC_HAS_AESNI256)
CMAKE_POP_CHECK_STATE()
IF (CC_HAS_AESNI256)
SET(WITH_FUSION_DEFAULT "ON")
ELSE ()
SET(WITH_FUSION_DEFAULT "OFF")
Expand All @@ -30,7 +35,7 @@ OPTION(WITH_FUSION "whether or not to use the Fusion AES-GCM engine in the cli b
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_C_FLAGS "-std=c99 -Wall -g ${CC_WARNING_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS "-std=c99 -Wall -g -DQUICLY_USE_TRACER=1 ${CC_WARNING_FLAGS} ${CMAKE_C_FLAGS}")
SET(CMAKE_C_FLAGS_DEBUG "-O0")
SET(CMAKE_C_FLAGS_RELEASE "-O2")

Expand All @@ -43,6 +48,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR})

SET(PICOTLS_OPENSSL_FILES
deps/picotls/lib/hpke.c
deps/picotls/lib/openssl.c
deps/picotls/lib/pembase64.c
deps/picotls/lib/picotls.c)
Expand All @@ -51,17 +57,20 @@ SET(QUICLY_LIBRARY_FILES
lib/frame.c
lib/cc-reno.c
lib/cc-cubic.c
lib/cc-pico.c
lib/defaults.c
lib/local_cid.c
lib/loss.c
lib/quicly.c
lib/ranges.c
lib/rate.c
lib/recvstate.c
lib/remote_cid.c
lib/retire_cid.c
lib/sendstate.c
lib/sentmap.c
lib/streambuf.c)
lib/streambuf.c
${CMAKE_CURRENT_BINARY_DIR}/quicly-tracer.h)

SET(UNITTEST_SOURCE_FILES
deps/picotest/picotest.c
Expand All @@ -72,6 +81,7 @@ SET(UNITTEST_SOURCE_FILES
t/maxsender.c
t/pacer.c
t/ranges.c
t/rate.c
t/remote_cid.c
t/retire_cid.c
t/sentmap.c
Expand All @@ -93,29 +103,33 @@ IF (WITH_DTRACE)
ENDIF ()
ENDIF ()

ADD_LIBRARY(quicly ${QUICLY_LIBRARY_FILES})
TARGET_LINK_LIBRARIES(quicly LINK_PUBLIC m)

ADD_CUSTOM_COMMAND(
OUTPUT embedded-probes.h
COMMAND ${CMAKE_SOURCE_DIR}/misc/probe2trace.pl -a embedded < ${CMAKE_SOURCE_DIR}/quicly-probes.d > ${CMAKE_CURRENT_BINARY_DIR}/embedded-probes.h
OUTPUT quicly-tracer.h
COMMAND ${PROJECT_SOURCE_DIR}/misc/probe2trace.pl -a tracer < ${PROJECT_SOURCE_DIR}/quicly-probes.d > ${CMAKE_CURRENT_BINARY_DIR}/quicly-tracer.h
DEPENDS quicly-probes.d misc/probe2trace.pl
VERBATIM)
SET(CLI_FILES ${PICOTLS_OPENSSL_FILES} ${QUICLY_LIBRARY_FILES} src/cli.c embedded-probes.h)
SET(CLI_COMPILE_FLAGS "-DQUICLY_USE_EMBEDDED_PROBES=1")

ADD_LIBRARY(quicly ${QUICLY_LIBRARY_FILES})
TARGET_LINK_LIBRARIES(quicly LINK_PUBLIC m)

SET(CLI_FILES ${PICOTLS_OPENSSL_FILES} ${QUICLY_LIBRARY_FILES} src/cli.c)
SET(CLI_COMPILE_FLAGS "")
IF (WITH_FUSION)
LIST(APPEND CLI_FILES deps/picotls/lib/fusion.c)
SET(CLI_COMPILE_FLAGS "-mavx2 -maes -mpclmul -DQUICLY_HAVE_FUSION=1 ${CLI_COMPILE_FLAGS}")
SET(CLI_COMPILE_FLAGS "-mavx2 -maes -mpclmul -mvaes -mvpclmulqdq -DQUICLY_HAVE_FUSION=1 ${CLI_COMPILE_FLAGS}")
ENDIF ()
ADD_EXECUTABLE(cli ${CLI_FILES})
SET_TARGET_PROPERTIES(cli PROPERTIES COMPILE_FLAGS ${CLI_COMPILE_FLAGS})
TARGET_LINK_LIBRARIES(cli ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} m)
SET_TARGET_PROPERTIES(cli PROPERTIES COMPILE_FLAGS "${CLI_COMPILE_FLAGS}")
TARGET_LINK_LIBRARIES(cli ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS} m)

ADD_EXECUTABLE(test.t ${PICOTLS_OPENSSL_FILES} ${UNITTEST_SOURCE_FILES})
TARGET_LINK_LIBRARIES(test.t quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(test.t quicly ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS})

ADD_EXECUTABLE(simulator ${PICOTLS_OPENSSL_FILES} ${QUICLY_LIBRARY_FILES} t/simulator.c)
TARGET_LINK_LIBRARIES(simulator ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS} m)

ADD_EXECUTABLE(examples-echo ${PICOTLS_OPENSSL_FILES} examples/echo.c)
TARGET_LINK_LIBRARIES(examples-echo quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(examples-echo quicly ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS})

ADD_EXECUTABLE(udpfw t/udpfw.c)

Expand All @@ -141,17 +155,17 @@ IF (BUILD_FUZZER)
SET(LIB_FUZZER FuzzingEngine)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS})
ELSEIF (USE_CLANG_RT)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=fuzzer,address,undefined -fsanitize-coverage=edge,indirect-calls")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=fuzzer,address,undefined -fsanitize-coverage=edge,indirect-calls")
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS})
ELSE()
SET(LIB_FUZZER "${CMAKE_CURRENT_BINARY_DIR}/libFuzzer.a")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-omit-frame-pointer -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=fuzzer-no-link")
ADD_CUSTOM_TARGET(libFuzzer ${CMAKE_CURRENT_SOURCE_DIR}/misc/build_libFuzzer.sh WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
ADD_DEPENDENCIES(quicly-fuzzer-packet libFuzzer)
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} ${LIB_FUZZER})
TARGET_LINK_LIBRARIES(quicly-fuzzer-packet quicly ${OPENSSL_CRYPTO_LIBRARIES} ${CMAKE_DL_LIBS} ${LIB_FUZZER})
ENDIF(OSS_FUZZ)
ENDIF()
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
quicly [![Build Status](https://travis-ci.org/h2o/quicly.svg?branch=master)](https://travis-ci.org/h2o/quicly)
quicly [![CI](https://github.com/h2o/quicly/actions/workflows/ci.yml/badge.svg)](https://github.com/h2o/quicly/actions/workflows/ci.yml)
===

Quicly is a QUIC implementation, written from the ground up to be used within the H2O HTTP server.
Quicly is an IETF [QUIC](https://quicwg.github.io/) protocol implementation, written from the ground up to be used primarily within the H2O HTTP server.

The software is licensed under the MIT License.

Expand Down
2 changes: 1 addition & 1 deletion deps/picotls
Submodule picotls updated 58 files
+9 −0 .github/ISSUE_TEMPLATE/custom.md
+80 −0 .github/workflows/ci.yml
+26 −0 .github/workflows/cifuzz.yml
+1 −0 .gitignore
+0 −71 .travis.yml
+40 −18 CMakeLists.txt
+7 −3 README.md
+7 −0 SECURITY.md
+16 −0 cmake/boringssl-adjust.cmake
+8 −8 deps/cifra/src/bitops.h
+4 −4 deps/cifra/src/curve25519.tweetnacl.c
+5 −5 deps/cifra/src/gf128.c
+2 −2 deps/micro-ecc/README.md
+2 −2 deps/micro-ecc/asm_arm.inc
+106 −106 deps/micro-ecc/asm_avr.inc
+18 −13 deps/micro-ecc/emk_project.py
+0 −5 deps/micro-ecc/examples/ecc_test/ecc_test.ino
+9 −0 deps/micro-ecc/library.properties
+27 −0 deps/micro-ecc/platform-specific.inc
+128 −0 deps/micro-ecc/test/ecdsa_test_vectors.c
+338 −0 deps/micro-ecc/test/public_key_test_vectors.c
+139 −104 deps/micro-ecc/uECC.c
+11 −6 deps/micro-ecc/uECC.h
+460 −95 include/picotls.h
+19 −3 include/picotls/fusion.h
+76 −5 include/picotls/openssl.h
+202 −0 lib/chacha20poly1305.h
+14 −5 lib/cifra/aes-common.h
+4 −1 lib/cifra/aes128.c
+4 −1 lib/cifra/aes256.c
+28 −142 lib/cifra/chacha20.c
+1,340 −150 lib/fusion.c
+258 −0 lib/hpke.c
+645 −72 lib/openssl.c
+2,279 −1,244 lib/picotls.c
+23 −8 lib/ptlsbcrypt.c
+5 −2 lib/uecc.c
+24 −0 misc/docker-ci.mk
+1 −0 picotls-probes.d
+46 −126 picotls.xcodeproj/project.pbxproj
+79 −0 picotlsvs/bcrypt-test/bcrypt-test.c
+1 −0 picotlsvs/picotls-core/picotls-core.vcxproj
+3 −0 picotlsvs/picotls-core/picotls-core.vcxproj.filters
+0 −16 picotlsvs/picotlsvs.sln
+1 −0 picotlsvs/testopenssl/testopenssl.vcxproj
+3 −0 picotlsvs/testopenssl/testopenssl.vcxproj.filters
+0 −240 src/esni.c
+45 −41 t/cli.c
+18 −13 t/e2e.t
+46 −0 t/ech-live.t
+278 −37 t/fusion.c
+179 −0 t/hpke.c
+2 −2 t/minicrypto.c
+307 −34 t/openssl.c
+411 −101 t/picotls.c
+3 −1 t/ptlsbench.c
+20 −13 t/test.h
+165 −74 t/util.h
6 changes: 3 additions & 3 deletions examples/echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void process_msg(int is_client, quicly_conn_t **conns, struct msghdr *msg
quicly_receive(conns[i], NULL, msg->msg_name, &decoded);
} else if (!is_client) {
/* assume that the packet is a new connection */
quicly_accept(conns + i, &ctx, NULL, msg->msg_name, &decoded, NULL, &next_cid, NULL);
quicly_accept(conns + i, &ctx, NULL, msg->msg_name, &decoded, NULL, &next_cid, NULL, NULL);
}
}
}
Expand Down Expand Up @@ -215,7 +215,7 @@ static int run_loop(int fd, quicly_conn_t *client)
tv.tv_sec = delta / 1000;
tv.tv_usec = (delta % 1000) * 1000;
} else {
tv.tv_sec = 1000;
tv.tv_sec = 0;
tv.tv_usec = 0;
}
FD_ZERO(&readfds);
Expand Down Expand Up @@ -386,7 +386,7 @@ int main(int argc, char **argv)
/* initiate a connection, and open a stream */
int ret;
if ((ret = quicly_connect(&client, &ctx, host, (struct sockaddr *)&sa, NULL, &next_cid, ptls_iovec_init(NULL, 0), NULL,
NULL)) != 0) {
NULL, NULL)) != 0) {
fprintf(stderr, "quicly_connect failed:%d\n", ret);
exit(1);
}
Expand Down
Loading

0 comments on commit 95f6f52

Please sign in to comment.