Check-in [58cfb962c2]
Overview
Comment:Better win32 support
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 58cfb962c2d7876cd9af4de74f8cb74467204ee01ee709e8b9c244c3bc8e56df
User & Date: rkeene on 2019-01-23 07:21:27.171
Other Links: manifest | tags
Context
2019-01-23
07:21
Use the SQLite3 way to generate a temporary DB check-in: 2b25880b82 user: rkeene tags: trunk
07:21
Better win32 support check-in: 58cfb962c2 user: rkeene tags: trunk
07:06
Hard code file extension for static targets to ".a" check-in: 92769ff244 user: rkeene tags: trunk
Changes
76
77
78
79
80
81
82


83



84
85
86
87
88
89
90
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
92
93
94







+
+
-
+
+
+







#elif defined(HAVE_CRYPTGENRANDOM)
#  include <windows.h>
#  include <wincrypt.h>
static long getrandom_impl(void *buf, unsigned int buflen) {
	HCRYPTPROV provider;
	BOOL cac_ret, cgr_ret;

	cac_ret = CryptAcquireContextA(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT);
	if (cac_ret == FALSE) {
	cac_ret = CryptAcquireContextA(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT);
		cac_ret = CryptAcquireContextA(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_SILENT | CRYPT_VERIFYCONTEXT | CRYPT_NEWKEYSET);
	}

	if (cac_ret == FALSE) {
		return(-1);
	}

	cgr_ret = CryptGenRandom(provider, buflen, (BYTE *) buf);

	CryptReleaseContext(provider, 0);