tpm2-software / tpm2-tss-engine

OpenSSL Engine for TPM2 devices
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
149 stars 99 forks source link

Compile for windows #154

Open naaeef opened 4 years ago

naaeef commented 4 years ago

Hello, is it possible to compile this project for windows? I tried it with cygwin with no success.

Thank you for your help.

AndreasFuchsTPM commented 4 years ago

You will probably have to create a VS project and include all the files, I assume. Sorry, but I'm not an expert here; i.e. no Windows compile box.

paulduongemail commented 4 years ago

@naaeef Any update?

naaeef commented 4 years ago

We managed to get the project running on windows on an experimental basis. For compiling the tmp2-tss-engine we created a new Visual Studio Solution using Visual Studio 2019. In the solution, we created two projects with different build targets. One for the genkey Tool (for generating private keys in the TPM) with an executable file as a target and one with a DLL as a target. Furthermore, we had to replace the function calls to sscanf with calls to sscanf_s. Also, we removed the header getopt.h and parsed the command line arguments manually. In some header files, we also had to change the initialization of structs from {} to 0, because the syntax was not accepted by the compiler.

AndreasFuchsTPM commented 4 years ago

@naaeef Pretty cool. Would you mind turning this into a PR ?

paulduongemail commented 4 years ago

@naaeef Yes, if you'd like to create PR it will be very helpful and meaningful! Thanks!

naaeef commented 4 years ago

I can't create a pull request because we did it on a very experimental base, and I currently do not have enough time to convert the code to a stable version.

williamcroberts commented 4 years ago

I can't create a pull request because we did it on a very experimental base, and I currently do not have enough time to convert the code to a stable version.

Just upload it so its available, and then someone else can run with this.

paulduongemail commented 4 years ago

@naaeef Yes, please. Even though you just upload it, it could be a great reference for me. I was stuck for weeks.

madaster97 commented 2 years ago

Wanted to pitch an alternative engine for windows for reference, openssl-cng-engine. It uses the Windows Cryptography API: Next Generation (CNG)

I am planning to try and compile the tpm2 version on windows as well.