]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix sctp compile errors
authorslontis <shane.lontis@oracle.com>
Wed, 12 Oct 2022 06:03:08 +0000 (16:03 +1000)
committerHugo Landau <hlandau@openssl.org>
Tue, 18 Oct 2022 11:19:23 +0000 (12:19 +0100)
Fixes #19371

running config with 'enable-sctp' gave compiler errors.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19398)

.github/workflows/run-checker-daily.yml
ssl/record/rec_layer_d1.c
ssl/statem/statem.c
ssl/statem/statem.h
ssl/statem/statem_srvr.c

index da5105c8f35884471bd6a4eca6e457bb479f4170..b15ebfd9312be8ffd691b368656c79c222ad614d 100644 (file)
@@ -98,7 +98,7 @@ jobs:
           no-ripemd,
           no-rmd160,
           no-scrypt,
-          no-sctp,
+          enable-sctp,
           no-secure-memory,
           no-seed,
           no-shared,
@@ -137,6 +137,12 @@ jobs:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@v2
+    - name: Install Dependencies for sctp option
+      run:  |
+        sudo apt-get update
+        sudo apt-get -yq install lksctp-tools libsctp-dev
+        sudo sysctl -w net.sctp.auth_enable=1
+      if: matrix.opt == 'enable-sctp'
     - name: config
       run: CC=clang ./config --banner=Configured --strict-warnings ${{ matrix.opt }}
     - name: config dump
index 40a8ed4bc870eabf30624d9a3fd873a3dcb8ff16..ad024522546387c3cdaed6d0563bb85bb7361399 100644 (file)
@@ -137,10 +137,10 @@ int dtls_buffer_record(SSL_CONNECTION *s, TLS_RECORD *rec)
 
 #ifndef OPENSSL_NO_SCTP
     /* Store bio_dgram_sctp_rcvinfo struct */
-    if (BIO_dgram_is_sctp(SSL_get_rbio(ssl)) &&
-        (SSL_get_state(ssl) == TLS_ST_SR_FINISHED
-         || SSL_get_state(ssl) == TLS_ST_CR_FINISHED)) {
-        BIO_ctrl(SSL_get_rbio(ssl), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO,
+    if (BIO_dgram_is_sctp(s->rbio) &&
+        (ossl_statem_get_state(s) == TLS_ST_SR_FINISHED
+         || ossl_statem_get_state(s) == TLS_ST_CR_FINISHED)) {
+        BIO_ctrl(s->rbio, BIO_CTRL_DGRAM_SCTP_GET_RCVINFO,
                  sizeof(rdata->recordinfo), &rdata->recordinfo);
     }
 #endif
@@ -175,9 +175,9 @@ static void dtls_unbuffer_record(SSL_CONNECTION *s)
 
 #ifndef OPENSSL_NO_SCTP
         /* Restore bio_dgram_sctp_rcvinfo struct */
-        if (BIO_dgram_is_sctp(SSL_get_rbio(s))) {
-            BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO,
-                        sizeof(rdata->recordinfo), &rdata->recordinfo);
+        if (BIO_dgram_is_sctp(s->rbio)) {
+            BIO_ctrl(s->rbio, BIO_CTRL_DGRAM_SCTP_SET_RCVINFO,
+                     sizeof(rdata->recordinfo), &rdata->recordinfo);
         }
 #endif
 
index 138bca220cf87d08bd9129850f51aff4926dea99..448d655a17cf772b67b990e986d7d62a2d68daeb 100644 (file)
@@ -116,6 +116,11 @@ int SSL_in_before(const SSL *s)
         && (sc->statem.state == MSG_FLOW_UNINITED);
 }
 
+OSSL_HANDSHAKE_STATE ossl_statem_get_state(SSL_CONNECTION *s)
+{
+    return s != NULL ? s->statem.hand_state : TLS_ST_BEFORE;
+}
+
 /*
  * Clear the state machine state and reset back to MSG_FLOW_UNINITED
  */
index 167e8a12bfc1bec4150560a1bfb675b16d939bf1..2b73eba6f68f598065765539a54746d4e22a01c1 100644 (file)
@@ -118,6 +118,7 @@ typedef struct ossl_statem_st OSSL_STATEM;
 
 __owur int ossl_statem_accept(SSL *s);
 __owur int ossl_statem_connect(SSL *s);
+OSSL_HANDSHAKE_STATE ossl_statem_get_state(SSL_CONNECTION *s);
 void ossl_statem_clear(SSL_CONNECTION *s);
 void ossl_statem_set_renegotiate(SSL_CONNECTION *s);
 void ossl_statem_send_fatal(SSL_CONNECTION *s, int al);
index bc4a6a362fdc9307053521fa75521e0d6cecceeb..ab1574419e033184955f2b6a58af513d3b795def 100644 (file)
@@ -3411,7 +3411,7 @@ WORK_STATE tls_post_process_client_key_exchange(SSL_CONNECTION *s,
                 return WORK_ERROR;
             }
 
-            BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
+            BIO_ctrl(s->wbio, BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
                      sizeof(sctpauthkey), sctpauthkey);
         }
     }