From b52a2738d4cd20d8cf4cf88943bee2b6789eeaf1 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Tue, 8 Dec 2009 13:42:32 +0000 Subject: [PATCH] Add ctrl and macro so we can determine if peer support secure renegotiation. --- CHANGES | 5 +++++ apps/s_client.c | 2 ++ apps/s_server.c | 2 ++ ssl/ssl.h | 4 ++++ ssl/ssl_lib.c | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/CHANGES b/CHANGES index ab93ce4248..427444a9ce 100644 --- a/CHANGES +++ b/CHANGES @@ -828,6 +828,11 @@ Changes between 0.9.8l (?) and 0.9.8m (?) [xx XXX xxxx] + *) Add ctrl macro SSL_get_secure_renegotiation_support() which returns 1 if + peer supports secure renegotiation and 0 otherwise. Print out peer + renegotiation support in s_client/s_server. + [Steve Henson] + *) Replace the highly broken and deprecated SPKAC certification method with the updated NID creation version. This should correctly handle UTF8. [Steve Henson] diff --git a/apps/s_client.c b/apps/s_client.c index a4be63a114..a3db16dfb0 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1725,6 +1725,8 @@ static void print_stuff(BIO *bio, SSL *s, int full) EVP_PKEY_bits(pktmp)); EVP_PKEY_free(pktmp); } + BIO_printf(bio, "Secure Renegotiation IS%s supported\n", + SSL_get_secure_renegotiation_support(s) ? "" : " NOT"); #ifndef OPENSSL_NO_COMP comp=SSL_get_current_compression(s); expansion=SSL_get_current_expansion(s); diff --git a/apps/s_server.c b/apps/s_server.c index 8a08a30695..1a06d19bb1 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2209,6 +2209,8 @@ static int init_ssl_connection(SSL *con) con->kssl_ctx->client_princ); } #endif /* OPENSSL_NO_KRB5 */ + BIO_printf(bio_s_out, "Secure Renegotiation IS%s supported\n", + SSL_get_secure_renegotiation_support(con) ? "" : " NOT"); return(1); } diff --git a/ssl/ssl.h b/ssl/ssl.h index 1d82a6df62..260403885c 100644 --- a/ssl/ssl.h +++ b/ssl/ssl.h @@ -623,6 +623,8 @@ typedef struct ssl_session_st #define SSL_set_mtu(ssl, mtu) \ SSL_ctrl((ssl),SSL_CTRL_SET_MTU,(mtu),NULL) +#define SSL_get_secure_renegotiation_support(ssl) \ + SSL_ctrl((ssl), SSL_CTRL_GET_RI_SUPPORT, 0, NULL) void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); @@ -1372,6 +1374,8 @@ DECLARE_PEM_rw(SSL_SESSION, SSL_SESSION) #define SSL_CTRL_SET_MAX_SEND_FRAGMENT 52 +#define SSL_CTRL_GET_RI_SUPPORT 53 + /* see tls1.h for macros based on these */ #ifndef OPENSSL_NO_TLSEXT #define SSL_CTRL_SET_TLSEXT_SERVERNAME_CB 53 diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index f46e302f57..8c26e8f220 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1062,6 +1062,10 @@ long SSL_ctrl(SSL *s,int cmd,long larg,void *parg) return 0; s->max_send_fragment = larg; return 1; + case SSL_CTRL_GET_RI_SUPPORT: + if (s->s3) + return s->s3->send_connection_binding; + else return 0; default: return(s->method->ssl_ctrl(s,cmd,larg,parg)); } -- 2.39.5