From: slontis Date: Wed, 12 Oct 2022 06:03:08 +0000 (+1000) Subject: Fix sctp compile errors X-Git-Tag: openssl-3.2.0-alpha1~1903 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=846975f367f75f3503b44c12e49d980dca181647;p=thirdparty%2Fopenssl.git Fix sctp compile errors Fixes #19371 running config with 'enable-sctp' gave compiler errors. Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/19398) --- diff --git a/.github/workflows/run-checker-daily.yml b/.github/workflows/run-checker-daily.yml index da5105c8f35..b15ebfd9312 100644 --- a/.github/workflows/run-checker-daily.yml +++ b/.github/workflows/run-checker-daily.yml @@ -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 diff --git a/ssl/record/rec_layer_d1.c b/ssl/record/rec_layer_d1.c index 40a8ed4bc87..ad024522546 100644 --- a/ssl/record/rec_layer_d1.c +++ b/ssl/record/rec_layer_d1.c @@ -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 diff --git a/ssl/statem/statem.c b/ssl/statem/statem.c index 138bca220cf..448d655a17c 100644 --- a/ssl/statem/statem.c +++ b/ssl/statem/statem.c @@ -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 */ diff --git a/ssl/statem/statem.h b/ssl/statem/statem.h index 167e8a12bfc..2b73eba6f68 100644 --- a/ssl/statem/statem.h +++ b/ssl/statem/statem.h @@ -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); diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index bc4a6a362fd..ab1574419e0 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -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); } }