DH *DSA_dup_DH(const DSA *r)
{
    DH *ret = NULL;
    if (r == NULL)
        goto err;
    ret = DH_new();
    if (ret == NULL)
        goto err;
    if (r->p != NULL)
        if ((ret->p = BN_dup(r->p)) == NULL)
            goto err;
    if (r->q != NULL) {
        ret->length = BN_num_bits(r->q);
        if ((ret->q = BN_dup(r->q)) == NULL)
            goto err;
    }
    if (r->g != NULL)
        if ((ret->g = BN_dup(r->g)) == NULL)
            goto err;
    if (r->pub_key != NULL)
        if ((ret->pub_key = BN_dup(r->pub_key)) == NULL)
            goto err;
    if (r->priv_key != NULL)
        if ((ret->priv_key = BN_dup(r->priv_key)) == NULL)
            goto err;
    return ret;
 err:
    DH_free(ret);
    return NULL;
}
['DH *DSA_dup_DH(const DSA *r)\n{\n    DH *ret = NULL;\n    if (r == NULL)\n        goto err;\n    ret = DH_new();\n    if (ret == NULL)\n        goto err;\n    if (r->p != NULL)\n        if ((ret->p = BN_dup(r->p)) == NULL)\n            goto err;\n    if (r->q != NULL) {\n        ret->length = BN_num_bits(r->q);\n        if ((ret->q = BN_dup(r->q)) == NULL)\n            goto err;\n    }\n    if (r->g != NULL)\n        if ((ret->g = BN_dup(r->g)) == NULL)\n            goto err;\n    if (r->pub_key != NULL)\n        if ((ret->pub_key = BN_dup(r->pub_key)) == NULL)\n            goto err;\n    if (r->priv_key != NULL)\n        if ((ret->priv_key = BN_dup(r->priv_key)) == NULL)\n            goto err;\n    return ret;\n err:\n    DH_free(ret);\n    return NULL;\n}', 'DH *DH_new(void)\n{\n    return DH_new_method(NULL);\n}']