Diff

Differences From Artifact [8953776351]:

To Artifact [4cad5d7a27]:


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);