OpenSSL is an encryption library used in many open source projects to provide stuff like HTTPS, ...
There is a prebuilt package available from the mingw-w64 downloads section, no need to build it yourself.
in the source directory from the MSYS shell:
configure mingw64 [zlib[-shared]] [--prefix=/some/prefix]
type
make
make check
make install
Wiki2: GeneralUsageInstructions
Wiki2: MSYS
Wiki2: ProjectSpecificInstructions