Skip to content

Commit

Permalink
Fix missing return value checks in SCTP
Browse files Browse the repository at this point in the history
There are some missing return value checks in the SCTP code. In master this
was causing a compilation failure when config'd with
"--strict-warnings sctp".

Reviewed-by: Tim Hudson <tjh@openssl.org>
(cherry picked from commit d8e8590)
  • Loading branch information
mattcaswell committed Aug 11, 2015
1 parent 512368c commit b3a62dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
16 changes: 12 additions & 4 deletions ssl/d1_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,15 @@ int dtls1_connect(SSL *s)
sizeof(DTLS1_SCTP_AUTH_LABEL),
DTLS1_SCTP_AUTH_LABEL);

SSL_export_keying_material(s, sctpauthkey,
if (SSL_export_keying_material(s, sctpauthkey,
sizeof(sctpauthkey),
labelbuffer,
sizeof(labelbuffer), NULL, 0,
0);
0) <= 0) {
ret = -1;
s->state = SSL_ST_ERR;
goto end;
}

BIO_ctrl(SSL_get_wbio(s),
BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
Expand Down Expand Up @@ -500,9 +504,13 @@ int dtls1_connect(SSL *s)
snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
DTLS1_SCTP_AUTH_LABEL);

SSL_export_keying_material(s, sctpauthkey,
if (SSL_export_keying_material(s, sctpauthkey,
sizeof(sctpauthkey), labelbuffer,
sizeof(labelbuffer), NULL, 0, 0);
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
ret = -1;
s->state = SSL_ST_ERR;
goto end;
}

BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
sizeof(sctpauthkey), sctpauthkey);
Expand Down
18 changes: 13 additions & 5 deletions ssl/d1_srvr.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,13 @@ int dtls1_accept(SSL *s)
snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
DTLS1_SCTP_AUTH_LABEL);

SSL_export_keying_material(s, sctpauthkey,
sizeof(sctpauthkey), labelbuffer,
sizeof(labelbuffer), NULL, 0, 0);
if (SSL_export_keying_material(s, sctpauthkey,
sizeof(sctpauthkey), labelbuffer,
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
ret = -1;
s->state = SSL_ST_ERR;
goto end;
}

BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
sizeof(sctpauthkey), sctpauthkey);
Expand Down Expand Up @@ -635,9 +639,13 @@ int dtls1_accept(SSL *s)
snprintf((char *)labelbuffer, sizeof(DTLS1_SCTP_AUTH_LABEL),
DTLS1_SCTP_AUTH_LABEL);

SSL_export_keying_material(s, sctpauthkey,
if (SSL_export_keying_material(s, sctpauthkey,
sizeof(sctpauthkey), labelbuffer,
sizeof(labelbuffer), NULL, 0, 0);
sizeof(labelbuffer), NULL, 0, 0) <= 0) {
ret = -1;
s->state = SSL_ST_ERR;
goto end;
}

BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY,
sizeof(sctpauthkey), sctpauthkey);
Expand Down

0 comments on commit b3a62dc

Please sign in to comment.