From 24ec0886eada05b870e6c8e45546863fb5c974cd Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Tue, 4 Jan 2022 11:51:01 -0500 Subject: ffs 11.16 rc1 --- freefilesync/debian/patches/ffs_curl.patch | 12 +- .../debian/patches/ffs_desktop_notifications.patch | 8 +- .../debian/patches/ffs_no_check_updates.patch | 118 +++++++++--------- freefilesync/debian/patches/ffs_openssl.patch | 137 +++++++-------------- 4 files changed, 114 insertions(+), 161 deletions(-) (limited to 'freefilesync/debian/patches') diff --git a/freefilesync/debian/patches/ffs_curl.patch b/freefilesync/debian/patches/ffs_curl.patch index 2dd5974..2b93756 100644 --- a/freefilesync/debian/patches/ffs_curl.patch +++ b/freefilesync/debian/patches/ffs_curl.patch @@ -1,7 +1,7 @@ Author: Brulhart, bgstack15 Date: 2021-06-12 10:54:15 -0400 Message: remove assertion for libcurl version >1.71 -Version: FreeFileSync 11.13 +Version: FreeFileSync 11.16 Message: We have to omit checking for certain definitions. On Fedora 33, file /usr/include/curl/curl.h from libcurl-devel 7.71 stops with CURLE_QUIC_CONNECT_ERROR 96 On Devuan Ceres file /usr/include/x86_64-linux-gnu/curl/curl.h from libcurl 4-openssl-dev stops with CURLE_PROXY 97 @@ -18,10 +18,10 @@ diff -r -u 10.17-0/FreeFileSync/Source/afs/ftp.cpp 10.17-1/FreeFileSync/Source/a /* 1. CURLFTPMETHOD_NOCWD requires absolute paths to unconditionally skip CWDs: https://github.com/curl/curl/pull/4382 2. CURLFTPMETHOD_SINGLECWD requires absolute paths to skip one needless "CWD entry path": https://github.com/curl/curl/pull/4332 => https://curl.haxx.se/docs/faq.html#How_do_I_list_the_root_dir_of_an -diff -x '*.orig' -x '*.rej' -aur 11.3-0/libcurl/curl_wrap.h 11.3-1/libcurl/curl_wrap.h ---- 11.11-0/libcurl/curl_wrap.h 2021-06-12 10:44:25.062468759 -0400 -+++ 11.11-1/libcurl/curl_wrap.h 2021-06-12 10:50:24.350613680 -0400 -@@ -89,7 +89,7 @@ +diff -x '*.orig' -x '*.rej' -aur 11.16-0/libcurl/curl_wrap.cpp 11.16-1/libcurl/curl_wrap.cpp +--- 11.16-0/libcurl/curl_wrap.cpp 2022-01-04 08:52:19.603430247 -0500 ++++ 11.16-1/libcurl/curl_wrap.cpp 2022-01-04 09:18:42.877140030 -0500 +@@ -330,7 +330,7 @@ ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE46); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_TOO_MANY_REDIRECTS); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_UNKNOWN_OPTION); @@ -30,7 +30,7 @@ diff -x '*.orig' -x '*.rej' -aur 11.3-0/libcurl/curl_wrap.h 11.3-1/libcurl/curl_ ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE50); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_OBSOLETE51); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_GOT_NOTHING); -@@ -137,11 +137,8 @@ +@@ -378,11 +378,8 @@ ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_AUTH_ERROR); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_HTTP3); ZEN_CHECK_CASE_FOR_CONSTANT(CURLE_QUIC_CONNECT_ERROR); diff --git a/freefilesync/debian/patches/ffs_desktop_notifications.patch b/freefilesync/debian/patches/ffs_desktop_notifications.patch index 5610fd1..121616a 100644 --- a/freefilesync/debian/patches/ffs_desktop_notifications.patch +++ b/freefilesync/debian/patches/ffs_desktop_notifications.patch @@ -1,3 +1,7 @@ +Version: 11.16 +Date: 2022-01-04 +Author: bgstack15 +Message: Add support for building with desktop notification support. diff -aur 11.9-1/FreeFileSync/Source/Makefile 11.9-2/FreeFileSync/Source/Makefile --- 11.9-1/FreeFileSync/Source/Makefile 2021-05-06 16:24:53.987902373 -0400 +++ 11.9-2/FreeFileSync/Source/Makefile 2021-05-06 17:09:31.512474440 -0400 @@ -28,8 +32,8 @@ diff -aur 11.9-1/FreeFileSync/Source/ui/progress_indicator.cpp 11.9-2/FreeFileSy using namespace zen; using namespace fff; -@@ -1359,6 +1362,22 @@ - pnl_.m_staticTextPhase->SetLabel(getSyncResultLabel(syncResult)); +@@ -1358,6 +1361,22 @@ + pnl_.m_staticTextPhase->SetLabelText(getSyncResultLabel(syncResult)); //pnl_.m_bitmapStatus->SetToolTip(); -> redundant +#ifdef with_notifications diff --git a/freefilesync/debian/patches/ffs_no_check_updates.patch b/freefilesync/debian/patches/ffs_no_check_updates.patch index 6524a1b..0b360f2 100644 --- a/freefilesync/debian/patches/ffs_no_check_updates.patch +++ b/freefilesync/debian/patches/ffs_no_check_updates.patch @@ -1,62 +1,62 @@ -Version: 11.13 +Version: 11.16 Message: This is a major rewrite of the ffs_no_check_updates patch from before 11.10 which disabled only a few technical www interactions. This current version completely deletes all logic associated with checking the version of the program. -Date: 2021-05-10 +Date: 2022-01-04 Author: bgstack15 diff -aur 11.10-1/FreeFileSync/Source/ui/gui_generated.cpp 11.12-1/FreeFileSync/Source/ui/gui_generated.cpp ---- 11.13-0/FreeFileSync/Source/ui/gui_generated.cpp 2021-08-17 19:18:02.043992470 -0400 -+++ 11.13-1/FreeFileSync/Source/ui/gui_generated.cpp 2021-08-17 19:29:06.794700840 -0400 +--- 11.16-0/FreeFileSync/Source/ui/gui_generated.cpp 2021-08-17 19:18:02.043992470 -0400 ++++ 11.16-1/FreeFileSync/Source/ui/gui_generated.cpp 2021-08-17 19:29:06.794700840 -0400 @@ -108,17 +108,6 @@ - m_menuItemHelp = new wxMenuItem( m_menuHelp, wxID_HELP, wxString( _("&View help") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemHelp ); + m_menuItemHelp = new wxMenuItem( m_menuHelp, wxID_HELP, wxString( _("&View help") ) + wxT('\t') + wxT("F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemHelp ); -- m_menuHelp->AppendSeparator(); +- m_menuHelp->AppendSeparator(); - -- m_menuItemCheckVersionNow = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Check for updates now") ), wxEmptyString, wxITEM_NORMAL ); -- m_menuHelp->Append( m_menuItemCheckVersionNow ); +- m_menuItemCheckVersionNow = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("&Check for updates now") ) , wxEmptyString, wxITEM_NORMAL ); +- m_menuHelp->Append( m_menuItemCheckVersionNow ); - -- m_menuItemCheckVersionAuto = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("Check &automatically once a week") ), wxEmptyString, wxITEM_CHECK ); -- m_menuHelp->Append( m_menuItemCheckVersionAuto ); -- m_menuItemCheckVersionAuto->Check( true ); +- m_menuItemCheckVersionAuto = new wxMenuItem( m_menuHelp, wxID_ANY, wxString( _("Check &automatically once a week") ) , wxEmptyString, wxITEM_CHECK ); +- m_menuHelp->Append( m_menuItemCheckVersionAuto ); +- m_menuItemCheckVersionAuto->Check( true ); - -- m_menuHelp->AppendSeparator(); +- m_menuHelp->AppendSeparator(); - - m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("Shift+F1"), wxEmptyString, wxITEM_NORMAL ); - m_menuHelp->Append( m_menuItemAbout ); + m_menuItemAbout = new wxMenuItem( m_menuHelp, wxID_ABOUT, wxString( _("&About") ) + wxT('\t') + wxT("Shift+F1"), wxEmptyString, wxITEM_NORMAL ); + m_menuHelp->Append( m_menuItemAbout ); -@@ -1133,8 +1122,6 @@ - m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuExportFileList ), this, m_menuItemExportList->GetId()); - m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuResetLayout ), this, m_menuItemResetLayout->GetId()); - m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onShowHelp ), this, m_menuItemHelp->GetId()); -- m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuCheckVersion ), this, m_menuItemCheckVersionNow->GetId()); -- m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuCheckVersionAutomatically ), this, m_menuItemCheckVersionAuto->GetId()); - m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuAbout ), this, m_menuItemAbout->GetId()); - m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::onCmpSettings ), NULL, this ); - m_bpButtonCmpConfig->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::onCompSettingsContextMouse ), NULL, this ); +@@ -1131,8 +1120,6 @@ + m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuExportFileList ), this, m_menuItemExportList->GetId()); + m_menuTools->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuResetLayout ), this, m_menuItemResetLayout->GetId()); + m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onShowHelp ), this, m_menuItemHelp->GetId()); +- m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuCheckVersion ), this, m_menuItemCheckVersionNow->GetId()); +- m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuCheckVersionAutomatically ), this, m_menuItemCheckVersionAuto->GetId()); + m_menuHelp->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainDialogGenerated::onMenuAbout ), this, m_menuItemAbout->GetId()); + m_bpButtonCmpConfig->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainDialogGenerated::onCmpSettings ), NULL, this ); + m_bpButtonCmpConfig->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( MainDialogGenerated::onCompSettingsContextMouse ), NULL, this ); diff -aur 11.10-1/FreeFileSync/Source/ui/gui_generated.h 11.10-2/FreeFileSync/Source/ui/gui_generated.h ---- 11.13-0/FreeFileSync/Source/ui/gui_generated.h 2021-08-17 19:18:02.063992671 -0400 -+++ 11.13-1/FreeFileSync/Source/ui/gui_generated.h 2021-08-17 19:29:21.978854111 -0400 -@@ -93,8 +93,6 @@ - wxMenuItem* m_menuItemShowOverview; - wxMenu* m_menuHelp; - wxMenuItem* m_menuItemHelp; -- wxMenuItem* m_menuItemCheckVersionNow; -- wxMenuItem* m_menuItemCheckVersionAuto; - wxMenuItem* m_menuItemAbout; - wxBoxSizer* bSizerPanelHolder; - wxPanel* m_panelTopButtons; -@@ -229,8 +227,6 @@ - virtual void onMenuExportFileList( wxCommandEvent& event ) { event.Skip(); } - virtual void onMenuResetLayout( wxCommandEvent& event ) { event.Skip(); } - virtual void onShowHelp( wxCommandEvent& event ) { event.Skip(); } -- virtual void onMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); } -- virtual void onMenuCheckVersionAutomatically( wxCommandEvent& event ) { event.Skip(); } - virtual void onMenuAbout( wxCommandEvent& event ) { event.Skip(); } - virtual void onCompSettingsContextMouse( wxMouseEvent& event ) { event.Skip(); } - virtual void onCompSettingsContext( wxCommandEvent& event ) { event.Skip(); } +--- 11.16-0/FreeFileSync/Source/ui/gui_generated.h 2021-08-17 19:18:02.063992671 -0400 ++++ 11.16-1/FreeFileSync/Source/ui/gui_generated.h 2021-08-17 19:29:21.978854111 -0400 +@@ -95,8 +95,6 @@ + wxMenuItem* m_menuItemShowOverview; + wxMenu* m_menuHelp; + wxMenuItem* m_menuItemHelp; +- wxMenuItem* m_menuItemCheckVersionNow; +- wxMenuItem* m_menuItemCheckVersionAuto; + wxMenuItem* m_menuItemAbout; + wxBoxSizer* bSizerPanelHolder; + wxPanel* m_panelTopButtons; +@@ -231,8 +229,6 @@ + virtual void onMenuExportFileList( wxCommandEvent& event ) { event.Skip(); } + virtual void onMenuResetLayout( wxCommandEvent& event ) { event.Skip(); } + virtual void onShowHelp( wxCommandEvent& event ) { event.Skip(); } +- virtual void onMenuCheckVersion( wxCommandEvent& event ) { event.Skip(); } +- virtual void onMenuCheckVersionAutomatically( wxCommandEvent& event ) { event.Skip(); } + virtual void onMenuAbout( wxCommandEvent& event ) { event.Skip(); } + virtual void onCompSettingsContextMouse( wxMouseEvent& event ) { event.Skip(); } + virtual void onCompSettingsContext( wxCommandEvent& event ) { event.Skip(); } diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Source/ui/main_dlg.cpp ---- 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 2021-05-10 10:43:26.103497095 -0400 -+++ 11.10-2/FreeFileSync/Source/ui/main_dlg.cpp 2021-05-10 10:52:37.904763378 -0400 -@@ -706,7 +706,6 @@ +--- 11.16-0/FreeFileSync/Source/ui/main_dlg.cpp 2022-01-04 08:52:19.811432573 -0500 ++++ 11.16-1/FreeFileSync/Source/ui/main_dlg.cpp 2022-01-04 08:57:14.506728896 -0500 +@@ -735,7 +735,6 @@ m_menuItemHelp ->SetBitmap(loadImage("help_sicon")); m_menuItemAbout->SetBitmap(loadImage("about_sicon")); @@ -64,7 +64,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Sourc auto fixMenuIcons = [](wxMenu& menu) //GTK: image must be set *before* adding wxMenuItem to menu or it won't show { -@@ -825,9 +824,6 @@ +@@ -854,9 +853,6 @@ //mainly to update row label sizes... updateGui(); @@ -74,7 +74,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Sourc //asynchronous call to wxWindow::Layout(): fix superfluous frame on right and bottom when FFS is started in fullscreen mode Bind(wxEVT_IDLE, &MainDialog::onLayoutWindowAsync, this); wxCommandEvent evtDummy; //call once before onLayoutWindowAsync() -@@ -1078,8 +1074,6 @@ +@@ -1108,8 +1104,6 @@ auiMgr_.GetPane(m_panelSearch).Hide(); //no need to show it on startup auiMgr_.GetPane(m_panelLog ).Hide(); // @@ -83,7 +83,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Sourc auiMgr_.Update(); } -@@ -5601,72 +5595,6 @@ +@@ -5680,72 +5674,6 @@ } } @@ -107,7 +107,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Sourc - { - flashStatusInformation(_("Searching for program updates...")); - //synchronous update check is sufficient here: -- automaticUpdateCheckEval(this, globalCfg_.lastUpdateCheck, globalCfg_.lastOnlineVersion, +- automaticUpdateCheckEval(*this, globalCfg_.lastUpdateCheck, globalCfg_.lastOnlineVersion, - automaticUpdateCheckRunAsync(automaticUpdateCheckPrepare(*this).get()).get()); - } -} @@ -143,7 +143,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.cpp 11.10-2/FreeFileSync/Sourc - guiQueue_.processAsync([resultPrep] { return automaticUpdateCheckRunAsync(resultPrep.get()); }, //run on worker thread: (long-running part of the check) - [this, showNewVersionReminder] (std::shared_ptr&& resultAsync) - { -- automaticUpdateCheckEval(this, globalCfg_.lastUpdateCheck, globalCfg_.lastOnlineVersion, +- automaticUpdateCheckEval(*this, globalCfg_.lastUpdateCheck, globalCfg_.lastOnlineVersion, - resultAsync.get()); //run on main thread: - showNewVersionReminder(); - }); @@ -169,8 +169,8 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/main_dlg.h 11.10-2/FreeFileSync/Source/ void onShowHelp (wxCommandEvent& event) override { wxLaunchDefaultBrowser(L"https://freefilesync.org/manual.php?topic=freefilesync"); } void onMenuQuit (wxCommandEvent& event) override { Close(); } diff -aur 11.10-1/FreeFileSync/Source/ui/version_check.cpp 11.10-2/FreeFileSync/Source/ui/version_check.cpp ---- 11.10-1/FreeFileSync/Source/ui/version_check.cpp 2021-05-10 08:10:14.751776629 -0400 -+++ 11.10-2/FreeFileSync/Source/ui/version_check.cpp 2021-05-10 10:50:08.595338399 -0400 +--- 11.16-1/FreeFileSync/Source/ui/version_check.cpp 2021-05-10 08:10:14.751776629 -0400 ++++ 11.16-2/FreeFileSync/Source/ui/version_check.cpp 2021-05-10 10:50:08.595338399 -0400 @@ -73,6 +73,8 @@ bool fff::shouldRunAutomaticUpdateCheck(time_t lastUpdateCheck) @@ -185,7 +185,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/version_check.cpp 11.10-2/FreeFileSync/ try { - updateDetailsMsg = utfTo(sendHttpGet(utfTo("https://api.freefilesync.org/latest_changes?" + xWwwFormUrlEncode({{"since", ffsVersion}})), -- ffsUpdateCheckUserAgent, nullptr /*caCertFilePath*/, nullptr /*notifyUnbufferedIO*/).readAll()); //throw SysError +- ffsUpdateCheckUserAgent, Zstring() /*caCertFilePath*/, nullptr /*notifyUnbufferedIO*/).readAll()); //throw SysError + updateDetailsMsg = utfTo(""); } catch (const SysError& e) { updateDetailsMsg = _("Failed to retrieve update information.") + + L"\n\n" + e.toString(); } @@ -195,7 +195,7 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/version_check.cpp 11.10-2/FreeFileSync/ std::string getOnlineVersion(const std::vector>& postParams) //throw SysError { - const std::string response = sendHttpPost(Zstr("https://api.freefilesync.org/latest_version"), postParams, -- ffsUpdateCheckUserAgent, nullptr /*caCertFilePath*/, nullptr /*notifyUnbufferedIO*/).readAll(); //throw SysError +- ffsUpdateCheckUserAgent, Zstring() /*caCertFilePath*/, nullptr /*notifyUnbufferedIO*/).readAll(); //throw SysError + const std::string response = ""; + return trimCpy(response); @@ -261,10 +261,10 @@ diff -aur 11.10-1/FreeFileSync/Source/ui/version_check.cpp 11.10-2/FreeFileSync/ { std::vector> postParameters; diff -aur 11.10-1/FreeFileSync/Source/ui/version_check.h 11.10-2/FreeFileSync/Source/ui/version_check.h ---- 11.10-1/FreeFileSync/Source/ui/version_check.h 2021-05-10 08:02:46.067494474 -0400 -+++ 11.10-2/FreeFileSync/Source/ui/version_check.h 2021-05-10 10:50:22.035466671 -0400 +--- 11.16-0/FreeFileSync/Source/ui/version_check.h 2021-05-10 08:02:46.067494474 -0400 ++++ 11.16-1/FreeFileSync/Source/ui/version_check.h 2021-05-10 10:50:22.035466671 -0400 @@ -32,9 +32,6 @@ - void automaticUpdateCheckEval(wxWindow* parent, time_t& lastUpdateCheck, std::string& lastOnlineVersion, + void automaticUpdateCheckEval(wxWindow& parent, time_t& lastUpdateCheck, std::string& lastOnlineVersion, const UpdateCheckResult* asyncResult); //---------------------------------------------------------------------------- -//call from main thread: diff --git a/freefilesync/debian/patches/ffs_openssl.patch b/freefilesync/debian/patches/ffs_openssl.patch index 47fd5cc..7097d33 100644 --- a/freefilesync/debian/patches/ffs_openssl.patch +++ b/freefilesync/debian/patches/ffs_openssl.patch @@ -1,103 +1,52 @@ -Summary: Revert 11.14 openssl 3.0.0 usage +Summary: Compile for libss-dev 1.1.1m Author: bgstack15 -Date: 2021-09-22 -Version: 11.14 -Message: Zenju updated FreeFileSync 11.14 to use openssl 3.0.0 but my distros are not ready for that. By reverting to the 11.13 logic, the application can compile against openssl 1.1.1l as before. +Date: 2022-01-04 +Version: 11.16 +Message: Compile on Devuan Ceres with libssl-dev_1.1.1m-1 diff -aur 11.13/zen/open_ssl.cpp 11.14/zen/open_ssl.cpp ---- 11.13/zen/open_ssl.cpp -+++ 11.14/zen/open_ssl.cpp -@@ -179,9 +179,9 @@ std::shared_ptr streamToKey(const std::string& keyStream, RsaStreamTyp +--- 11.16-0/zen/open_ssl.cpp 2022-01-04 10:04:34.135914294 -0500 ++++ 11.16-1/zen/open_ssl.cpp 2022-01-04 10:29:12.544451067 -0500 +@@ -201,7 +201,7 @@ //================================================================================ --using EvpToBioFunc = int (*)(BIO* bio, const EVP_PKEY* evp); -+using EvpToBioFunc = int (*)(BIO* bio, EVP_PKEY* evp); - --std::string evpKeyToStream(const EVP_PKEY* evp, EvpToBioFunc evpToBio, const char* functionName) //throw SysError -+std::string evpKeyToStream(EVP_PKEY* evp, EvpToBioFunc evpToBio, const char* functionName) //throw SysError - { - BIO* bio = ::BIO_new(BIO_s_mem()); - if (!bio) -@@ -205,16 +205,16 @@ std::string evpKeyToStream(const EVP_PKEY* evp, EvpToBioFunc evpToBio, const cha - } - - --using RsaToBioFunc = int (*)(BIO* bp, const RSA* x); -+using RsaToBioFunc = int (*)(BIO* bp, RSA* x); - --std::string evpKeyToStream(const EVP_PKEY* evp, RsaToBioFunc rsaToBio, const char* functionName) //throw SysError -+std::string evpKeyToStream(EVP_PKEY* evp, RsaToBioFunc rsaToBio, const char* functionName) //throw SysError - { - BIO* bio = ::BIO_new(BIO_s_mem()); - if (!bio) - throw SysError(formatLastOpenSSLError("BIO_new")); - ZEN_ON_SCOPE_EXIT(::BIO_free_all(bio)); - -- const RSA* rsa = ::EVP_PKEY_get0_RSA(evp); //unowned reference! -+ RSA* rsa = ::EVP_PKEY_get0_RSA(evp); //unowned reference! - if (!rsa) - throw SysError(formatLastOpenSSLError("EVP_PKEY_get0_RSA")); - -@@ -236,33 +236,33 @@ std::string evpKeyToStream(const EVP_PKEY* evp, RsaToBioFunc rsaToBio, const cha - - - //fix OpenSSL API inconsistencies: --int PEM_write_bio_PrivateKey2(BIO* bio, const EVP_PKEY* key) -+int PEM_write_bio_PrivateKey2(BIO* bio, EVP_PKEY* key) - { - return ::PEM_write_bio_PrivateKey(bio, //BIO* bp -- key, //const EVP_PKEY* x -+ key, //EVP_PKEY* x - nullptr, //const EVP_CIPHER* enc -- nullptr, //const unsigned char* kstr -+ nullptr, //unsigned char* kstr - 0, //int klen - nullptr, //pem_password_cb* cb - nullptr); //void* u - } - --int PEM_write_bio_RSAPrivateKey2(BIO* bio, const RSA* rsa) -+int PEM_write_bio_RSAPrivateKey2(BIO* bio, RSA* rsa) - { - return ::PEM_write_bio_RSAPrivateKey(bio, //BIO* bp -- rsa, //const RSA* x -+ rsa, //RSA* x - nullptr, //const EVP_CIPHER* enc -- nullptr, //const unsigned char* kstr -+ nullptr, //unsigned char* kstr - 0, //int klen - nullptr, //pem_password_cb* cb - nullptr); //void* u - } - --int PEM_write_bio_RSAPublicKey2(BIO* bio, const RSA* rsa) { return ::PEM_write_bio_RSAPublicKey(bio, rsa); } -+int PEM_write_bio_RSAPublicKey2(BIO* bio, RSA* rsa) { return ::PEM_write_bio_RSAPublicKey(bio, rsa); } - - //-------------------------------------------------------------------------------- - -std::string keyToStream(const EVP_PKEY* evp, RsaStreamType streamType, bool publicKey) //throw SysError +std::string keyToStream(EVP_PKEY* evp, RsaStreamType streamType, bool publicKey) //throw SysError { - switch (streamType) - { -@@ -571,15 +571,15 @@ public: - if (sslError == SSL_ERROR_ZERO_RETURN) - return 0; //EOF + close_notify alert + //assert(::EVP_PKEY_get_base_id(evp) == EVP_PKEY_RSA); + +@@ -210,7 +210,7 @@ + case RsaStreamType::pkix: + { + //fix OpenSSL API inconsistencies: +- auto PEM_write_bio_PrivateKey2 = [](BIO* bio, const EVP_PKEY* key) ++ auto PEM_write_bio_PrivateKey2 = [](BIO* bio, EVP_PKEY* key) + { + return ::PEM_write_bio_PrivateKey(bio, //BIO* bp + key, //const EVP_PKEY* x +@@ -269,7 +269,7 @@ + return {reinterpret_cast(keyBuf), keyLen}; + #else + //fix OpenSSL API inconsistencies: +- auto PEM_write_bio_RSAPrivateKey2 = [](BIO* bio, const RSA* rsa) ++ auto PEM_write_bio_RSAPrivateKey2 = [](BIO* bio, RSA* rsa) + { + return ::PEM_write_bio_RSAPrivateKey(bio, //BIO* bp + rsa, //const RSA* x +@@ -279,14 +279,14 @@ + nullptr, //pem_password_cb* cb + nullptr); //void* u + }; +- auto PEM_write_bio_RSAPublicKey2 = [](BIO* bio, const RSA* rsa) { return ::PEM_write_bio_RSAPublicKey(bio, rsa); }; ++ auto PEM_write_bio_RSAPublicKey2 = [](BIO* bio, RSA* rsa) { return ::PEM_write_bio_RSAPublicKey(bio, rsa); }; + + BIO* bio = ::BIO_new(BIO_s_mem()); + if (!bio) + throw SysError(formatLastOpenSSLError("BIO_new")); + ZEN_ON_SCOPE_EXIT(::BIO_free_all(bio)); + +- const RSA* rsa = ::EVP_PKEY_get0_RSA(evp); //unowned reference! ++ RSA* rsa = ::EVP_PKEY_get0_RSA(evp); //unowned reference! + if (!rsa) + throw SysError(formatLastOpenSSLError("EVP_PKEY_get0_RSA")); --#if OPENSSL_VERSION_NUMBER >= 0x30000000L /*OpenSSL 3.0.0*/ || \ -- OPENSSL_VERSION_NUMBER == 0x1010105fL /*OpenSSL 1.1.1e*/ -+#if OPENSSL_VERSION_NUMBER == 0x1010105fL //OpenSSL 1.1.1e - const auto ec = ::ERR_peek_last_error(); - if (sslError == SSL_ERROR_SSL && ERR_GET_REASON(ec) == SSL_R_UNEXPECTED_EOF_WHILE_READING) //EOF: only expected for HTTP/1.0 --#else //obsolete handling: https://github.com/openssl/openssl/issues/10880#issuecomment-575746226 -+ return 0; -+#else //obsolete handling, at least in OpenSSL 1.1.1e (but valid again with OpenSSL 1.1.1f!) -+ //https://github.com/openssl/openssl/issues/10880#issuecomment-575746226 - if ((sslError == SSL_ERROR_SYSCALL && ::ERR_peek_last_error() == 0)) //EOF: only expected for HTTP/1.0 --#endif - return 0; -- -+#endif - throw SysError(formatLastOpenSSLError("SSL_read_ex") + L' ' + getSslErrorLiteral(sslError)); - } - assert(bytesReceived > 0); //SSL_read_ex() considers EOF an error! -- cgit