static int test_rand_add(void)
{
    RAND_DRBG *master = RAND_DRBG_get0_master();
    RAND_DRBG_get_entropy_fn old_get_entropy = master->get_entropy;
    RAND_DRBG_cleanup_entropy_fn old_cleanup_entropy = master->cleanup_entropy;
    int rv = 0;
    unsigned char rand_add_buf[256];

    master->get_entropy = get_pool_entropy;
    master->cleanup_entropy = cleanup_pool_entropy;
    master->reseed_prop_counter++;
    RAND_DRBG_uninstantiate(master);
    memset(rand_add_buf, 0xCD, sizeof(rand_add_buf));
    RAND_add(rand_add_buf, sizeof(rand_add_buf), sizeof(rand_add_buf));
    if (!TEST_true(RAND_DRBG_instantiate(master, NULL, 0)))
        goto error;

    rv = 1;

error:
    master->get_entropy = old_get_entropy;
    master->cleanup_entropy = old_cleanup_entropy;
    return rv;
}