stef / libopaque

c implementation of the OPAQUE protocol with bindings for python, php, ruby, lua, zig, java, erlang, golang, js and SASL.
GNU Lesser General Public License v3.0
69 stars 10 forks source link

Compiling on Windows (MinGW) #23

Closed tibotix closed 2 years ago

tibotix commented 2 years ago

To compile libopaque on windows with MinGW, the following steps had to be done:

Things that do not compile under Windows are:

Note that iam not very familiar with the linker options provided by MinGW and which one is responsible for extra security features. However, this is the output of winchecksec against the compiled libopaque.dll lib:

Warn: No load config in the PE
Results for: ./libopaque.dll
Dynamic Base    : "Present"
ASLR            : "Present"
High Entropy VA : "Present"
Force Integrity : "NotPresent"
Isolation       : "Present"
NX              : "Present"
SEH             : "Present"
CFG             : "NotPresent"
RFG             : "NotPresent"
SafeSEH         : "NotApplicable"
GS              : "NotPresent"
Authenticode    : "NotPresent"
.NET            : "NotPresent"
stef commented 2 years ago

awesome. instead of a seperate makefile you can have a look at how we handle different archs/os in a sister projects makefile: https://github.com/stef/libsphinx/blob/master/src/makefile

and maybe call the target mingw instead of windows, maybe someone comes along and adds a visualc port or so...

stef commented 2 years ago

btw the fcntls are used for checking if a filedescriptor is open/exists, if you know a replacement for that in mingw perhaps?

tibotix commented 2 years ago

As far as I know, MinGW has a _fstat function that expects an open file descriptor and some buffer and returns -1 if the file status information could not be obtained and 0 if it could be obtained. maybe this is useful...

tibotix commented 2 years ago

I changed utils/main.c to use the _fstat function. It now compiles under MinGW and runs. However i have not checked the functionality of the WindowsAPI call yet.

stef commented 2 years ago

love it! are you sure you're only 18?

stef commented 2 years ago

btw also added a note to the main readme about your dart binding...

tibotix commented 2 years ago

Ah Perfect , thanks. I also plan to publish the dart bindings on pub.dev btw . And yeah haha I am sure I’m only 18 :) started really early with programming and stuff …