Browse Source

Hitch code review feedback.

Kareem 11 months ago
parent
commit
56328d845a
4 changed files with 21 additions and 34 deletions
  1. 14 9
      .github/workflows/hitch.yml
  2. 1 17
      src/bio.c
  3. 2 2
      src/ssl.c
  4. 4 6
      wolfssl/ssl.h

+ 14 - 9
.github/workflows/hitch.yml

@@ -28,7 +28,10 @@ jobs:
       fail-fast: false
       matrix:
         # List of releases to test
-        ref: [ 1.7.3 ]
+        include:
+          - ref: 1.7.3
+            ignore-tests: >-
+              test13-r82.sh test15-proxy-v2-npn.sh test39-client-cert-proxy.sh
     name: ${{ matrix.ref }}
     runs-on: ubuntu-latest
     needs: build_wolfssl
@@ -42,9 +45,7 @@ jobs:
       - name: Checkout OSP
         uses: actions/checkout@v3
         with:
-          # TODO: change to wolfssl repo once merged
-          repository: kareem-wolfssl/osp
-          ref: hitch
+          repository: wolfssl/osp
           path: osp
 
       - name: Install dependencies
@@ -60,6 +61,14 @@ jobs:
           ref: 1.7.3
           path: hitch
 
+      # Do this before configuring so that it only detects the updated list of
+      # tests
+      - if: ${{ matrix.ignore-tests }}
+        name: Remove tests that we want to ignore (13, 15, 39)
+        working-directory: ./hitch/src/tests
+        run: |
+          rm ${{ matrix.ignore-tests }}
+
       - name: Configure and build hitch
         run: |
             cd $GITHUB_WORKSPACE/hitch/
@@ -79,8 +88,4 @@ jobs:
         working-directory: ./hitch/src/tests
         run: |
           export TESTDIR=`pwd`/; export PATH=$PATH:`pwd`/../:`pwd`/../util/:`pwd`; export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
-          for test in ./test*.sh; do
-            if ! [[ "$test" = ./test13* ]] && ! [[ "$test" = ./test15* ]] && ! [[ "$test" = ./test39* ]]; then
-              $test && echo "PASS: $test" || (ret=$?; if [[ $ret != 77 ]]; then echo "FAIL: $test (exit status: $ret)" && exit $ret; else echo "SKIP: $test"; fi)
-            fi
-          done
+          make check

+ 1 - 17
src/bio.c

@@ -2360,7 +2360,6 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
         return WOLFSSL_SUCCESS;
     }
 
-#ifdef OPENSSL_ALL
     WOLFSSL_BIO* wolfSSL_BIO_new_ssl(WOLFSSL_CTX* ctx, int client)
     {
         WOLFSSL* ssl = NULL;
@@ -2407,11 +2406,9 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
 
         return sslBio;
     }
-#endif
 
     WOLFSSL_BIO* wolfSSL_BIO_new_ssl_connect(WOLFSSL_CTX* ctx)
     {
-        WOLFSSL* ssl = NULL;
         WOLFSSL_BIO* sslBio = NULL;
         WOLFSSL_BIO* connBio = NULL;
         int err = 0;
@@ -2424,24 +2421,12 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
         }
 
         if (err == 0) {
-            ssl = wolfSSL_new(ctx);
-            if (ssl == NULL) {
-                WOLFSSL_MSG("Failed to create SSL object from ctx.");
-                err = 1;
-            }
-        }
-        if (err == 0) {
-            sslBio = wolfSSL_BIO_new(wolfSSL_BIO_f_ssl());
+            sslBio = wolfSSL_BIO_new_ssl(ctx, 1);
             if (sslBio == NULL) {
                 WOLFSSL_MSG("Failed to create SSL BIO.");
                 err = 1;
             }
         }
-        if (err == 0 && wolfSSL_BIO_set_ssl(sslBio, ssl, BIO_CLOSE) !=
-            WOLFSSL_SUCCESS) {
-            WOLFSSL_MSG("Failed to set SSL pointer in BIO.");
-            err = 1;
-        }
         if (err == 0) {
             connBio = wolfSSL_BIO_new(wolfSSL_BIO_s_socket());
             if (connBio == NULL) {
@@ -2454,7 +2439,6 @@ int wolfSSL_BIO_flush(WOLFSSL_BIO* bio)
         }
 
         if (err == 1) {
-            wolfSSL_free(ssl);
             wolfSSL_BIO_free(sslBio);
             sslBio = NULL;
             wolfSSL_BIO_free(connBio);

+ 2 - 2
src/ssl.c

@@ -16811,7 +16811,7 @@ cleanup:
         return 0;
     }
 
-    void wolfSSL_set_locking_callback(void (*f)(int, int, const char*, int))
+    void wolfSSL_set_locking_callback(mutex_cb* f)
     {
         WOLFSSL_ENTER("wolfSSL_set_locking_callback");
 
@@ -16820,7 +16820,7 @@ cleanup:
         }
     }
 
-    void (*wolfSSL_get_locking_callback(void))(int, int, const char*, int)
+    mutex_cb* wolfSSL_get_locking_callback(void)
     {
         WOLFSSL_ENTER("wolfSSL_get_locking_callback");
 

+ 4 - 6
wolfssl/ssl.h

@@ -1777,9 +1777,7 @@ WOLFSSL_API long wolfSSL_BIO_set_conn_hostname(WOLFSSL_BIO* b, char* name);
 WOLFSSL_API long wolfSSL_BIO_set_conn_port(WOLFSSL_BIO *b, char* port);
 WOLFSSL_API long wolfSSL_BIO_do_connect(WOLFSSL_BIO *b);
 WOLFSSL_API int wolfSSL_BIO_do_accept(WOLFSSL_BIO *b);
-#ifdef OPENSSL_ALL
 WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_ssl(WOLFSSL_CTX* ctx, int client);
-#endif
 WOLFSSL_API WOLFSSL_BIO* wolfSSL_BIO_new_ssl_connect(WOLFSSL_CTX* ctx);
 
 WOLFSSL_API long wolfSSL_BIO_do_handshake(WOLFSSL_BIO *b);
@@ -1825,10 +1823,10 @@ WOLFSSL_API int wolfSSL_COMP_add_compression_method(int method, void* data);
 
 WOLFSSL_API unsigned long wolfSSL_thread_id(void);
 WOLFSSL_API void wolfSSL_set_id_callback(unsigned long (*f)(void));
-WOLFSSL_API void wolfSSL_set_locking_callback(void (*f)(int, int, const char*,
-                                                      int));
-WOLFSSL_API void (*wolfSSL_get_locking_callback(void))(int, int, const char*,
-                                                       int);
+#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
+WOLFSSL_API void wolfSSL_set_locking_callback(mutex_cb* f);
+WOLFSSL_API mutex_cb* wolfSSL_get_locking_callback(void);
+#endif
 WOLFSSL_API void wolfSSL_set_dynlock_create_callback(WOLFSSL_dynlock_value* (*f)
                                                    (const char*, int));
 WOLFSSL_API void wolfSSL_set_dynlock_lock_callback(void (*f)(int,