minidriver: correct where cardmod.h comes from - #3818
spurglegooge wants to merge 1 commit into
Conversation
The header ships only in the Cryptographic Provider Development Kit, not in the Windows SDK or WDK. win32/Make.rules.mak already points at the CPDK include directory.
frankmorgner
left a comment
There was a problem hiding this comment.
My hint regarding WSL was not a suggestion for a general fix, but rather a suggestion on how to test building a cross compiled minidriver in CI. via GH actions, we have the option to copy cardmod.h into WSL, and then to compile here with MINGW.
Anyway, codewise the change looks good. Improvements for CI may be suggested in a seperate PR.
|
Thanks both. @metsma — useful link, the wiki Build requirements page is a better landing spot for this @frankmorgner — I misread the WSL hint, and I will correct the "On WSL" section of the |
In #3814 you mentioned:
We went looking for the same thing and found a chain that works on plain Linux with no
Windows machine involved, which should suit CI better than WSL. The one-line comment fix in this PR
records the source; the full procedure is below in case it is useful for CI.
What this PR changes
minidriver.csaid the header comes "from CNG SDK or platform SDK". That is not correctand it costs time, so this corrects it to name the CPDK and point at the
CPDK_INCL_DIRline inwin32/Make.rules.makthat already encodes the real location.Where it is not
Not in the Windows SDK, the WDK, the EWDK, or the
Microsoft.Windows.SDK.CPP/Microsoft.Windows.WDK.*nuget packages. We downloaded and searched all four, including a1.8 GB EWDK ISO with a complete 1,612-header Kits tree. We couldn't find it.
win32/Make.rules.makalready pointsCPDK_INCL_DIRat the right directory, so the buildsystem knows even if the comment did not.
Where it is
Only in the Cryptographic Provider Development Kit (CPDK). The installer is a WiX Burn
bundle, so the payload has to be extracted rather than run. Tools on Debian:
p7zip-full cabextract msitools.Landing page (check for a newer version first):
https://www.microsoft.com/en-us/download/details.aspx?id=30688
Bootstrapper:
List the Burn payloads (
7ztreats the bundle as an archive; file0is the manifest):7z x cpdksetup.exe -oburn grep -oE 'FilePath="Installers\\[^"]+"' burn/0Payloads sit beside the bootstrapper under
.../CPDK_RELEASE_UPDATE/Installers/(URL-encode the spaces):
Cab entries have hashed names, so map them through the MSI
Filetable:Result:
The same cab also carries
bcrypt.h,bcrypt_provider.h,cspdk.h,msclmd.h,ncrypt.h,ncrypt_provider.handsslprovider.h.One trap worth documenting
mingw-w64 ships its own
cardmod.hat/usr/share/mingw-w64/include/cardmod.h. It is anolder partial subset, roughly 10 KB, and the minidriver fails against it with 103
undefined identifiers. Because a header of the right name is present, this reads as a
source problem rather than a missing dependency. A quick discriminator:
On WSL
To be clear about scope: the above is only about obtaining the header. It does not
compete with using WSL in a GitHub Actions job to run the MinGW build — the two fit
together, since a runner still needs the header from somewhere before it can compile.
What we are not attaching
We are deliberately not attaching the header. Our own reading of the CPDK licence terms is
that internal use is unlimited but redistribution is not, so we are sharing the procedure
and the hashes rather than the file. That is our reading of our own obligations only —
whether OpenSC can vendor or ship it is a question for the project.