On 04/25/2017 08:42 AM, Daniel P. Berrange wrote: > On Mon, Apr 24, 2017 at 07:51:49PM +0200, Geert Martin Ijewski wrote: >> If no crypto library is included in the build QEMU uses >> qcrypto_random_bytes() to generate random data. That function tried to open >> /dev/urandom or /dev/random and if openeing neither file worked it errored >> out. >>
>> +int qcrypto_random_init(Error **errp)
>> +{
>> +#ifdef _WIN32
>> + if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL,
>> + CRYPT_SILENT | CRYPT_VERIFYCONTEXT)) {
>> + error_setg_errno(errp, GetLastError(),
>> + "Unable to create cryptographic provider");
>
> Unfortunately the return value of 'GetLastError()' isn't an errno
> so we can't use error_setg_errno here.
>
> Just use error_setg, and report the error value with a '(code=%u)'
> substitution at the end of the error message.
>
Or, use error_setg_win32(), which is designed for this purpose.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
