/* Convert IP addresses both IPv4 and IPv6 into an OCTET STRING compatible with RFC3280.  */
ASN1_OCTET_STRING* a2i_IPADDRESS(const char *ipasc)
/* Convert IP addresses both IPv4 and IPv6 into an OCTET STRING compatible with RFC3280.  */
ASN1_OCTET_STRING* a2i_IPADDRESS(const char *ipasc)
{
    unsigned char ipout[16];
    ASN1_OCTET_STRING *ret;
    int iplen;
    iplen = a2i_ipadd(ipout, ipasc);
    if (!iplen)
        return NULL;
    ret = ASN1_OCTET_STRING_new();
    if (!ret)
        return NULL;
    if (!ASN1_OCTET_STRING_set(ret, ipout, iplen)) {
        ASN1_OCTET_STRING_free(ret);
        return NULL;
    }
    return ret;
}