bss_dgram.c,d1_lib.c: make it compile with mingw.

Submitted by: Roumen Petrov
(cherry picked from commit 972b0dc3500a26edb178a5446a0cdfb8f450f853)
test/Makefile: allow emulated test (e.g. under wine) [from master].

Submitted by: Roumen Petrov
dh_check.c: check BN_CTX_get's return value.
(cherry picked from commit 53e5161231854d64fd89e993944609a329a92db4)