bcrypt: Add semi-stub implementation of BCryptGenRandom (try 2)

Alexandre Julliard julliard at winehq.org
Mon Feb 10 08:53:06 CST 2014


Bruno Jesus <00cpxxx at gmail.com> writes:

> +
> +    /* Zero sized buffer should work too */
> +    ret = pBCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
> +    ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
> +
> +    /* Test random number generation - It's impossible for a sane RNG to return 8 zeros */
> +    rnd[0] = 0;
> +    rnd[1] = 0;
> +    ret = pBCryptGenRandom(NULL, buffer, sizeof(DWORD) * 2, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
> +    ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
> +    ok(rnd[0] || rnd[1], "Expected a random number, got 0\n");
> +    trace("BCryptGenRandom : %08X%08X\n", rnd[0], rnd[1]);

There's no reason to work with DWORDs, the function returns bytes, just
use that directly.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list