ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)
{
    ASN1_INTEGER *izone;
    ASN1_OCTET_STRING *oct;
    if ((izone = ASN1_INTEGER_new()) == NULL
        || !ASN1_INTEGER_set(izone, lzone)) {
        X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
        ASN1_INTEGER_free(izone);
        return NULL;
    }
    oct = SXNET_get_id_INTEGER(sx, izone);
    ASN1_INTEGER_free(izone);
    return oct;
}
['ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)\n{\n    ASN1_INTEGER *izone;\n    ASN1_OCTET_STRING *oct;\n    if ((izone = ASN1_INTEGER_new()) == NULL\n        || !ASN1_INTEGER_set(izone, lzone)) {\n        X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);\n        ASN1_INTEGER_free(izone);\n        return NULL;\n    }\n    oct = SXNET_get_id_INTEGER(sx, izone);\n    ASN1_INTEGER_free(izone);\n    return oct;\n}', 'IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)', 'ASN1_STRING *ASN1_STRING_type_new(int type)\n{\n    ASN1_STRING *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->type = type;\n    return (ret);\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)\n{\n    return ASN1_INTEGER_set_int64(a, v);\n}', 'int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r)\n{\n    return asn1_string_set_int64(a, r, V_ASN1_INTEGER);\n}', 'static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype)\n{\n    unsigned char tbuf[sizeof(r)];\n    size_t l;\n    a->type = itype;\n    if (r < 0) {\n        l = asn1_put_uint64(tbuf, -r);\n        a->type |= V_ASN1_NEG;\n    } else {\n        l = asn1_put_uint64(tbuf, r);\n        a->type &= ~V_ASN1_NEG;\n    }\n    if (l == 0)\n        return 0;\n    return ASN1_STRING_set(a, tbuf, l);\n}', 'static size_t asn1_put_uint64(unsigned char *b, uint64_t r)\n{\n    if (r >= 0x100) {\n        unsigned char *p;\n        uint64_t rtmp = r;\n        size_t i = 0;\n        while (rtmp) {\n            rtmp >>= 8;\n            i++;\n        }\n        p = b + i - 1;\n        do {\n            *p-- = r & 0xFF;\n            r >>= 8;\n        } while (p >= b);\n        return i;\n    }\n    b[0] = (unsigned char)r;\n    return 1;\n}', "int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)\n{\n    unsigned char *c;\n    const char *data = _data;\n    if (len < 0) {\n        if (data == NULL)\n            return (0);\n        else\n            len = strlen(data);\n    }\n    if ((str->length < len) || (str->data == NULL)) {\n        c = str->data;\n        str->data = OPENSSL_realloc(c, len + 1);\n        if (str->data == NULL) {\n            ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);\n            str->data = c;\n            return (0);\n        }\n    }\n    str->length = len;\n    if (data != NULL) {\n        memcpy(str->data, data, len);\n        str->data[len] = '\\0';\n    }\n    return (1);\n}", 'void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)\n{\n    if (str == NULL)\n        return CRYPTO_malloc(num, file, line);\n    if (num == 0) {\n        CRYPTO_free(str);\n        return NULL;\n    }\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        void *ret;\n        CRYPTO_mem_debug_realloc(str, NULL, num, 0, file, line);\n        ret = realloc(str, num);\n        CRYPTO_mem_debug_realloc(str, ret, num, 1, file, line);\n        return ret;\n    }\n#else\n    (void)file;\n    (void)line;\n#endif\n    return realloc(str, num);\n}', 'ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone)\n{\n    SXNETID *id;\n    int i;\n    for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {\n        id = sk_SXNETID_value(sx->ids, i);\n        if (!ASN1_INTEGER_cmp(id->zone, zone))\n            return id->user;\n    }\n    return NULL;\n}', 'DEFINE_STACK_OF(SXNETID)', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'void ASN1_STRING_free(ASN1_STRING *a)\n{\n    if (a == NULL)\n        return;\n    if (!(a->flags & ASN1_STRING_FLAG_NDEF))\n        OPENSSL_free(a->data);\n    if (!(a->flags & ASN1_STRING_FLAG_EMBED))\n        OPENSSL_free(a);\n}']