libgcrypt 1.12.0 and 1.11.3 Windows LoadLibraryEx, CloseHandle/FreeLibrary mismatch

John Thacker via Gcrypt-devel <[email protected]> Sun, 10 May 2026 10:21:43 -0400
Newsgroups gmane.comp.encryption.gpg.libgcrypt.devel
Message-ID <CAP_QLgq=8W9YrpMO3Ep=15Lcqqo34Lzn9iBAqZNJgcddU1DpNw@mail.gmail.com>
--===============5492346511659180161==
Content-Type: multipart/alternative; boundary="0000000000001965f30651775a2f"

--0000000000001965f30651775a2f
Content-Type: text/plain; charset="UTF-8"

Hello,

In Wireshark we have noticed some issues with the recent libgcrypt releases
1.11.3 and 1.12.2, discussed here:
https://gitlab.com/wireshark/wireshark/-/work_items/21251

A recent commit opens Windows DLL "shell32.dll" with LoadLibraryEx, but
closes it with CloseHandle instead of FreeLibrary. FreeLibrary does
reference counting, but CloseHandle does not, which causes problems if an
application already has opened shell32.dll for other reasons:

https://github.com/gpg/libgcrypt/commit/d5e3cbfd8845a872d39f468da27a443cea4587e2
https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa

Separately, we have a more minor concern that it's more appropriate to
typedef Windows SSIZE_T to ssize_t rather than long, because long is 32-bit
on Windows even on 64-bit platforms whereas SSIZE_T is not.

Due to the GnuPG/libgcrypt bug system not accepting registration right now
due to scraping, none of the Wireshark core developers have memberships in
order to create bugs or post the patches. Please look at our discussion
linked above.

Thanks,
John Thacker

--0000000000001965f30651775a2f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,sa=
ns-serif">Hello,</div><div class=3D"gmail_default" style=3D"font-family:ari=
al,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-family:=
arial,sans-serif">In Wireshark we have noticed some issues with the recent =
libgcrypt releases 1.11.3 and 1.12.2, discussed=C2=A0here:</div><div class=
=3D"gmail_default" style=3D"font-family:arial,sans-serif"><a href=3D"https:=
//gitlab.com/wireshark/wireshark/-/work_items/21251">https://gitlab.com/wir=
eshark/wireshark/-/work_items/21251</a></div><div class=3D"gmail_default" s=
tyle=3D"font-family:arial,sans-serif"><br></div><div class=3D"gmail_default=
" style=3D"font-family:arial,sans-serif">A recent commit opens Windows DLL =
&quot;shell32.dll&quot; with LoadLibraryEx, but closes it with CloseHandle =
instead of FreeLibrary. FreeLibrary does reference counting, but CloseHandl=
e does not, which causes problems if an application already has opened shel=
l32.dll for other reasons:</div><div class=3D"gmail_default" style=3D"font-=
family:arial,sans-serif"><br></div><div class=3D"gmail_default" style=3D"fo=
nt-family:arial,sans-serif"><a href=3D"https://github.com/gpg/libgcrypt/com=
mit/d5e3cbfd8845a872d39f468da27a443cea4587e2">https://github.com/gpg/libgcr=
ypt/commit/d5e3cbfd8845a872d39f468da27a443cea4587e2</a></div><div class=3D"=
gmail_default" style=3D"font-family:arial,sans-serif"><a href=3D"https://le=
arn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-load=
libraryexa">https://learn.microsoft.com/en-us/windows/win32/api/libloaderap=
i/nf-libloaderapi-loadlibraryexa</a></div><div class=3D"gmail_default" styl=
e=3D"font-family:arial,sans-serif"><br></div><div class=3D"gmail_default" s=
tyle=3D"font-family:arial,sans-serif">Separately, we have a more minor conc=
ern that it&#39;s more appropriate to typedef Windows SSIZE_T to ssize_t ra=
ther than long, because long is 32-bit on Windows even on 64-bit platforms =
whereas SSIZE_T is not.</div><div class=3D"gmail_default" style=3D"font-fam=
ily:arial,sans-serif"><br></div><div class=3D"gmail_default" style=3D"font-=
family:arial,sans-serif">Due to the GnuPG/libgcrypt bug system not acceptin=
g registration right now due to scraping, none of the Wireshark core develo=
pers have memberships in order to create bugs or post the patches. Please l=
ook at our discussion linked above.</div><div class=3D"gmail_default" style=
=3D"font-family:arial,sans-serif"><br></div><div class=3D"gmail_default" st=
yle=3D"font-family:arial,sans-serif">Thanks,</div><div class=3D"gmail_defau=
lt" style=3D"font-family:arial,sans-serif">John Thacker</div></div>

--0000000000001965f30651775a2f--


--===============5492346511659180161==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Gcrypt-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gcrypt-devel

--===============5492346511659180161==--