comparison OrthancFramework/Sources/DicomNetworking/Internals/DicomTls.cpp @ 5622:335e2079de1f tls-ignore-unexpected-tls

testing OpenSSL ignore_unexpected_eof option
author Alain Mazy <am@orthanc.team>
date Mon, 13 May 2024 12:13:50 +0200
parents 317850cd46bc
children 56e1e7d0f92a
comparison
equal deleted inserted replaced
5611:1a995c6f9dae 5622:335e2079de1f
25 #include "DicomTls.h" 25 #include "DicomTls.h"
26 26
27 #include "../../Logging.h" 27 #include "../../Logging.h"
28 #include "../../OrthancException.h" 28 #include "../../OrthancException.h"
29 #include "../../SystemToolbox.h" 29 #include "../../SystemToolbox.h"
30 30 #include <openssl/ssl.h>
31 31
32 #if DCMTK_VERSION_NUMBER < 364 32 #if DCMTK_VERSION_NUMBER < 364
33 # define DCF_Filetype_PEM SSL_FILETYPE_PEM 33 # define DCF_Filetype_PEM SSL_FILETYPE_PEM
34 # if OPENSSL_VERSION_NUMBER >= 0x0090700fL 34 # if OPENSSL_VERSION_NUMBER >= 0x0090700fL
35 // This seems to correspond to TSP_Profile_AES: https://support.dcmtk.org/docs/tlsciphr_8h.html 35 // This seems to correspond to TSP_Profile_AES: https://support.dcmtk.org/docs/tlsciphr_8h.html
163 163
164 if (IsFailure(tls->activateCipherSuites())) 164 if (IsFailure(tls->activateCipherSuites()))
165 { 165 {
166 throw OrthancException(ErrorCode_InternalError, "Cannot activate the cipher suites for DICOM TLS"); 166 throw OrthancException(ErrorCode_InternalError, "Cannot activate the cipher suites for DICOM TLS");
167 } 167 }
168
169 DcmTLSTransportLayer::native_handle_type sslNativeHandle = tls->getNativeHandle();
170 SSL_CTX_set_options(sslNativeHandle, SSL_OP_IGNORE_UNEXPECTED_EOF);
168 #else 171 #else
169 CLOG(INFO, DICOM) << "Using the following cipher suites for DICOM TLS: " << opt_ciphersuites; 172 CLOG(INFO, DICOM) << "Using the following cipher suites for DICOM TLS: " << opt_ciphersuites;
170 if (IsFailure(tls->setCipherSuites(opt_ciphersuites.c_str()))) 173 if (IsFailure(tls->setCipherSuites(opt_ciphersuites.c_str())))
171 { 174 {
172 throw OrthancException(ErrorCode_InternalError, "Unable to set cipher suites to: " + opt_ciphersuites); 175 throw OrthancException(ErrorCode_InternalError, "Unable to set cipher suites to: " + opt_ciphersuites);