add wolfSSL_get0_peername() and SSL_set_mtu().

This commit is contained in:
Daniel Pouzzner
2024-04-19 01:20:08 -05:00
parent 0f3ebedba0
commit 685bfd1f9d
3 changed files with 30 additions and 0 deletions

View File

@ -10315,6 +10315,26 @@ int wolfSSL_check_domain_name(WOLFSSL* ssl, const char* dn)
} }
} }
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
const char *wolfSSL_get0_peername(WOLFSSL *ssl) {
if (ssl == NULL) {
ssl->error = BAD_FUNC_ARG;
return NULL;
}
if (ssl->buffers.domainName.buffer)
return (const char *)ssl->buffers.domainName.buffer;
else if (ssl->session && ssl->session->peer)
return ssl->session->peer->subjectCN;
else if (ssl->peerCert.subjectCN[0])
return ssl->peerCert.subjectCN;
else {
ssl->error = NO_PEER_CERT;
return NULL;
}
}
#endif /* SESSION_CERTS && OPENSSL_EXTRA */
/* turn on wolfSSL zlib compression /* turn on wolfSSL zlib compression
returns WOLFSSL_SUCCESS for success, else error (not built in) returns WOLFSSL_SUCCESS for success, else error (not built in)

View File

@ -1150,6 +1150,8 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_
#define DTLSv1_handle_timeout wolfSSL_DTLSv1_handle_timeout #define DTLSv1_handle_timeout wolfSSL_DTLSv1_handle_timeout
#define DTLSv1_set_initial_timeout_duration wolfSSL_DTLSv1_set_initial_timeout_duration #define DTLSv1_set_initial_timeout_duration wolfSSL_DTLSv1_set_initial_timeout_duration
#define SSL_set_mtu(ssl, mtu) ((wolfSSL_dtls_set_mtu(ssl, mtu) == 0) ? SSL_SUCCESS : SSL_FAILURE)
/* DTLS SRTP */ /* DTLS SRTP */
#ifdef WOLFSSL_SRTP #ifdef WOLFSSL_SRTP
typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE; typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE;
@ -1201,6 +1203,10 @@ typedef WOLFSSL_SRTP_PROTECTION_PROFILE SRTP_PROTECTION_PROFILE;
#define sk_SSL_CIPHER_free wolfSSL_sk_SSL_CIPHER_free #define sk_SSL_CIPHER_free wolfSSL_sk_SSL_CIPHER_free
#define sk_SSL_CIPHER_find wolfSSL_sk_SSL_CIPHER_find #define sk_SSL_CIPHER_find wolfSSL_sk_SSL_CIPHER_find
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
#define SSL_get0_peername wolfSSL_get0_peername
#endif
#if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY) \ #if defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || defined(WOLFSSL_HAPROXY) \
|| defined(WOLFSSL_NGINX) || defined(WOLFSSL_NGINX)
#include <wolfssl/openssl/pem.h> #include <wolfssl/openssl/pem.h>

View File

@ -2871,6 +2871,10 @@ WOLFSSL_API int wolfSSL_CTX_get_ex_new_index(long idx, void* arg,
date check and signature check */ date check and signature check */
WOLFSSL_ABI WOLFSSL_API int wolfSSL_check_domain_name(WOLFSSL* ssl, const char* dn); WOLFSSL_ABI WOLFSSL_API int wolfSSL_check_domain_name(WOLFSSL* ssl, const char* dn);
#if defined(SESSION_CERTS) && defined(OPENSSL_EXTRA)
WOLFSSL_API const char *wolfSSL_get0_peername(WOLFSSL *ssl);
#endif
/* need to call once to load library (session cache) */ /* need to call once to load library (session cache) */
WOLFSSL_ABI WOLFSSL_API int wolfSSL_Init(void); WOLFSSL_ABI WOLFSSL_API int wolfSSL_Init(void);
/* call when done to cleanup/free session cache mutex / resources */ /* call when done to cleanup/free session cache mutex / resources */