static int check_bn(const char *name, const BIGNUM *bn, const char *hexbn)
{
    BIGNUM *tmp = NULL;

    if (!TEST_true(BN_hex2bn(&tmp, hexbn)))
        return 0;

    if (!TEST_int_eq(BN_cmp(bn, tmp), 0)) {
        TEST_info("Unexpected %s value", name);
        showbn("expecting", tmp);
        showbn("received", bn);
        BN_free(tmp);
        return 0;
    }
    BN_free(tmp);
    return 1;
}