diff --git a/CMakeLists.txt b/CMakeLists.txt index 75b87b994..b5f271194 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -221,7 +221,9 @@ endif() OPTION(WITH_OPENSSL "build with OpenSSL" ON) -if(WITH_OPENSSL) +if (OPENSSL_FOUND) + message(STATUS "OpenSSL already found: ${OPENSSL_ROOT_DIR}") +elseif (WITH_OPENSSL) find_package(OpenSSL REQUIRED) message(STATUS "root: ${OPENSSL_ROOT_DIR}") message(STATUS "OpenSSL_VERSION: ${OPENSSL_VERSION}") @@ -233,6 +235,7 @@ else() message(STATUS "Building without picotls-openssl") list(APPEND PICOQUIC_COMPILE_DEFINITIONS PTLS_WITHOUT_OPENSSL) endif() + # set_picoquic_compile_settings(TARGET) makes is easy to consistently # assign compiler build options to each of the following targets macro(set_picoquic_compile_settings) @@ -387,6 +390,8 @@ add_custom_target( # Specify Install targets install(TARGETS picoquicdemo picolog_t picoquic-core picoquic-log picohttp-core RUNTIME DESTINATION bin + BUNDLE DESTINATION bin + FRAMEWORK DESTINATION lib LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/cmake/FindPTLS.cmake b/cmake/FindPTLS.cmake index 2571fb65a..0aa3c319d 100644 --- a/cmake/FindPTLS.cmake +++ b/cmake/FindPTLS.cmake @@ -1,6 +1,6 @@ # - Try to find Picotls -if (PICOQUIC_FETCH_PTLS) +if (PICOQUIC_FETCH_PTLS OR PICOQUIC_PTLS_SUBMODULE) set(PTLS_CORE_LIBRARY picotls-core) set(PTLS_OPENSSL_LIBRARY picotls-openssl) set(PTLS_MINICRYPTO_LIBRARY picotls-minicrypto) @@ -14,7 +14,7 @@ if (PICOQUIC_FETCH_PTLS) unset(PTLS_FUSION_LIBRARY) endif() set(PTLS_INCLUDE_DIRS ${picotls_SOURCE_DIR}/include) -else(PICOQUIC_FETCH_PTLS) +else() find_path(PTLS_INCLUDE_DIR NAMES picotls/openssl.h HINTS ${PTLS_PREFIX}/include/picotls @@ -60,6 +60,6 @@ else(PICOQUIC_FETCH_PTLS) set(PTLS_WITH_FUSION_DEFAULT ON) endif() endif() -endif(PICOQUIC_FETCH_PTLS) +endif() mark_as_advanced(PTLS_LIBRARIES PTLS_INCLUDE_DIRS) diff --git a/picoquic/picosplay.c b/picoquic/picosplay.c index 01d481714..dcc9e2254 100644 --- a/picoquic/picosplay.c +++ b/picoquic/picosplay.c @@ -32,7 +32,6 @@ static void rotate(picosplay_node_t *child); static picosplay_node_t* leftmost(picosplay_node_t *node); static picosplay_node_t* rightmost(picosplay_node_t *node); - /* The meat: splay the node x. */ static void zig(picosplay_node_t *x); static void zigzig(picosplay_node_t *x, picosplay_node_t *p); @@ -130,10 +129,12 @@ picosplay_node_t* picosplay_insert(picosplay_tree_t *tree, void *value) { else parent->right = new; } + splay(tree, new); tree->size++; } + return new; } @@ -158,6 +159,7 @@ picosplay_node_t* picosplay_find(picosplay_tree_t *tree, void *value) * perform measurements with and without it and keep the best alternative. */ if(curr != NULL) splay(tree, curr); + return curr; } @@ -195,6 +197,7 @@ void picosplay_delete(picosplay_tree_t *tree, void *value) { void picosplay_delete_hint(picosplay_tree_t *tree, picosplay_node_t *node) { if(node == NULL) return; + splay(tree, node); /* Now node is tree's root. */ if(node->left == NULL) { tree->root = node->right; @@ -287,6 +290,7 @@ static void mark_gp(picosplay_node_t *child); /* Rotate to make the given child take its parent's place in the tree. */ static void rotate(picosplay_node_t *child) { + picosplay_node_t *parent = child->parent; assert(parent != NULL); if(parent->left == child) { /* A left child given. */ diff --git a/picoquic/quicctx.c b/picoquic/quicctx.c index 2a2bee86c..798233b18 100644 --- a/picoquic/quicctx.c +++ b/picoquic/quicctx.c @@ -32,7 +32,6 @@ #include #endif - /* * Supported versions. Specific versions may mandate different processing of different * formats. diff --git a/sample/README.md b/sample/README.md index 4d405b29e..3d90b801a 100644 --- a/sample/README.md +++ b/sample/README.md @@ -20,8 +20,8 @@ Example Generate the certificates: ``` -openssl req -x509 -newkey rsa:2048 -days 365 -keyout ca-key.pem -out ca-cert.pem -openssl req -newkey rsa:2048 -keyout server-key.pem -out server-req.pem +openssl req -nodes -x509 -newkey rsa:2048 -days 365 -keyout ca-key.pem -out ca-cert.pem +openssl req -nodes -newkey rsa:2048 -keyout server-key.pem -out server-req.pem ``` These commands will prompt a few questions, you don't need to put actual data for this simple test.