[openssl] master update
Matt Caswell
matt at openssl.org
Fri Aug 9 08:45:38 UTC 2019
The branch master has been updated
via c8edb04fac976e653ee441fae66842b4a33ad5b6 (commit)
from 861335001b99cfd665030c50ad37a663536a5c0f (commit)
- Log -----------------------------------------------------------------
commit c8edb04fac976e653ee441fae66842b4a33ad5b6
Author: raja-ashok <rashok.svks at gmail.com>
Date: Sat Jul 6 21:57:53 2019 +0530
Restrict usage of bio_dgram_sctp_data only to DGRAM SCTP methods
Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
Reviewed-by: Matt Caswell <matt at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9216)
-----------------------------------------------------------------------
Summary of changes:
crypto/bio/bss_dgram.c | 25 +++++++++++++++++++------
include/openssl/bio.h | 12 ++++++++----
2 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 941429a398..c52b0f047f 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -53,6 +53,8 @@ static int dgram_sctp_puts(BIO *h, const char *str);
static long dgram_sctp_ctrl(BIO *h, int cmd, long arg1, void *arg2);
static int dgram_sctp_new(BIO *h);
static int dgram_sctp_free(BIO *data);
+static int dgram_sctp_wait_for_dry(BIO *b);
+static int dgram_sctp_msg_waiting(BIO *b);
# ifdef SCTP_AUTHENTICATION_EVENT
static void dgram_sctp_handle_auth_free_key_event(BIO *b, union sctp_notification
*snp);
@@ -124,7 +126,7 @@ typedef struct bio_dgram_sctp_data_st {
struct bio_dgram_sctp_sndinfo sndinfo;
struct bio_dgram_sctp_rcvinfo rcvinfo;
struct bio_dgram_sctp_prinfo prinfo;
- void (*handle_notifications) (BIO *bio, void *context, void *buf);
+ BIO_dgram_sctp_notification_handler_fn handle_notifications;
void *notification_context;
int in_handshake;
int ccs_rcvd;
@@ -1562,6 +1564,10 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
else
data->save_shutdown = 0;
break;
+ case BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY:
+ return dgram_sctp_wait_for_dry(b);
+ case BIO_CTRL_DGRAM_SCTP_MSG_WAITING:
+ return dgram_sctp_msg_waiting(b);
default:
/*
@@ -1574,11 +1580,8 @@ static long dgram_sctp_ctrl(BIO *b, int cmd, long num, void *ptr)
}
int BIO_dgram_sctp_notification_cb(BIO *b,
- void (*handle_notifications) (BIO *bio,
- void
- *context,
- void *buf),
- void *context)
+ BIO_dgram_sctp_notification_handler_fn handle_notifications,
+ void *context)
{
bio_dgram_sctp_data *data = (bio_dgram_sctp_data *) b->ptr;
@@ -1605,6 +1608,11 @@ int BIO_dgram_sctp_notification_cb(BIO *b,
* 1 when dry
*/
int BIO_dgram_sctp_wait_for_dry(BIO *b)
+{
+ return (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY, 0, NULL);
+}
+
+static int dgram_sctp_wait_for_dry(BIO *b)
{
int is_dry = 0;
int sockflags = 0;
@@ -1763,6 +1771,11 @@ int BIO_dgram_sctp_wait_for_dry(BIO *b)
}
int BIO_dgram_sctp_msg_waiting(BIO *b)
+{
+ return (int)BIO_ctrl(b, BIO_CTRL_DGRAM_SCTP_MSG_WAITING, 0, NULL);
+}
+
+static int dgram_sctp_msg_waiting(BIO *b)
{
int n, sockflags;
union sctp_notification snp;
diff --git a/include/openssl/bio.h b/include/openssl/bio.h
index 17b2c0e27c..2312ca647c 100644
--- a/include/openssl/bio.h
+++ b/include/openssl/bio.h
@@ -151,6 +151,9 @@ extern "C" {
# define BIO_CTRL_GET_KTLS_SEND 73
# define BIO_CTRL_GET_KTLS_RECV 76
+# define BIO_CTRL_DGRAM_SCTP_WAIT_FOR_DRY 77
+# define BIO_CTRL_DGRAM_SCTP_MSG_WAITING 78
+
# ifndef OPENSSL_NO_KTLS
# define BIO_get_ktls_send(b) \
(BIO_method_type(b) == BIO_TYPE_SOCKET \
@@ -279,6 +282,9 @@ DEFINE_STACK_OF(BIO)
typedef int asn1_ps_func (BIO *b, unsigned char **pbuf, int *plen,
void *parg);
+typedef void (*BIO_dgram_sctp_notification_handler_fn) (BIO *b,
+ void *context,
+ void *buf);
# ifndef OPENSSL_NO_SCTP
/* SCTP parameter structs */
struct bio_dgram_sctp_sndinfo {
@@ -629,10 +635,8 @@ const BIO_METHOD *BIO_s_datagram_sctp(void);
BIO *BIO_new_dgram_sctp(int fd, int close_flag);
int BIO_dgram_is_sctp(BIO *bio);
int BIO_dgram_sctp_notification_cb(BIO *b,
- void (*handle_notifications) (BIO *bio,
- void *context,
- void *buf),
- void *context);
+ BIO_dgram_sctp_notification_handler_fn handle_notifications,
+ void *context);
int BIO_dgram_sctp_wait_for_dry(BIO *b);
int BIO_dgram_sctp_msg_waiting(BIO *b);
# endif
More information about the openssl-commits
mailing list