int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
    char *v;
    int gmt = 0;
    int i;
    int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
    char *f = NULL;
    int f_len = 0;
    i = tm->length;
    v = (char *)tm->data;
    if (i < 12)
        goto err;
    if (v[i - 1] == 'Z')
        gmt = 1;
    for (i = 0; i < 12; i++)
        if ((v[i] > '9') || (v[i] < '0'))
            goto err;
    y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
        + (v[2] - '0') * 10 + (v[3] - '0');
    M = (v[4] - '0') * 10 + (v[5] - '0');
    if ((M > 12) || (M < 1))
        goto err;
    d = (v[6] - '0') * 10 + (v[7] - '0');
    h = (v[8] - '0') * 10 + (v[9] - '0');
    m = (v[10] - '0') * 10 + (v[11] - '0');
    if (tm->length >= 14 &&
        (v[12] >= '0') && (v[12] <= '9') &&
        (v[13] >= '0') && (v[13] <= '9')) {
        s = (v[12] - '0') * 10 + (v[13] - '0');
        if (tm->length >= 15 && v[14] == '.') {
            int l = tm->length;
            f = &v[14];
            f_len = 1;
            while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
                ++f_len;
        }
    }
    if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
                   _asn1_mon[M - 1], d, h, m, s, f_len, f, y,
                   (gmt) ? " GMT" : "") <= 0)
        return (0);
    else
        return (1);
 err:
    BIO_write(bp, "Bad time value", 14);
    return (0);
}
['static int www_body(char *hostname, int s, int stype, unsigned char *context)\n{\n    char *buf = NULL;\n    int ret = 1;\n    int i, j, k, dot;\n    SSL *con;\n    const SSL_CIPHER *c;\n    BIO *io, *ssl_bio, *sbio;\n#ifdef RENEG\n    int total_bytes = 0;\n#endif\n    buf = app_malloc(bufsize, "server www buffer");\n    io = BIO_new(BIO_f_buffer());\n    ssl_bio = BIO_new(BIO_f_ssl());\n    if ((io == NULL) || (ssl_bio == NULL))\n        goto err;\n#ifdef FIONBIO\n    if (s_nbio) {\n        unsigned long sl = 1;\n        if (!s_quiet)\n            BIO_printf(bio_err, "turning on non blocking io\\n");\n        if (BIO_socket_ioctl(s, FIONBIO, &sl) < 0)\n            ERR_print_errors(bio_err);\n    }\n#endif\n    if (!BIO_set_write_buffer_size(io, bufsize))\n        goto err;\n    if ((con = SSL_new(ctx)) == NULL)\n        goto err;\n    if (s_tlsextdebug) {\n        SSL_set_tlsext_debug_callback(con, tlsext_cb);\n        SSL_set_tlsext_debug_arg(con, bio_s_out);\n    }\n    if (context && !SSL_set_session_id_context(con, context,\n                        strlen((char *)context)))\n        goto err;\n    sbio = BIO_new_socket(s, BIO_NOCLOSE);\n    if (s_nbio_test) {\n        BIO *test;\n        test = BIO_new(BIO_f_nbio_test());\n        sbio = BIO_push(test, sbio);\n    }\n    SSL_set_bio(con, sbio, sbio);\n    SSL_set_accept_state(con);\n    BIO_set_ssl(ssl_bio, con, BIO_CLOSE);\n    BIO_push(io, ssl_bio);\n#ifdef CHARSET_EBCDIC\n    io = BIO_push(BIO_new(BIO_f_ebcdic_filter()), io);\n#endif\n    if (s_debug) {\n        SSL_set_debug(con, 1);\n        BIO_set_callback(SSL_get_rbio(con), bio_dump_callback);\n        BIO_set_callback_arg(SSL_get_rbio(con), (char *)bio_s_out);\n    }\n    if (s_msg) {\n#ifndef OPENSSL_NO_SSL_TRACE\n        if (s_msg == 2)\n            SSL_set_msg_callback(con, SSL_trace);\n        else\n#endif\n            SSL_set_msg_callback(con, msg_cb);\n        SSL_set_msg_callback_arg(con, bio_s_msg ? bio_s_msg : bio_s_out);\n    }\n    for (;;) {\n        i = BIO_gets(io, buf, bufsize - 1);\n        if (i < 0) {\n            if (!BIO_should_retry(io)) {\n                if (!s_quiet)\n                    ERR_print_errors(bio_err);\n                goto err;\n            } else {\n                BIO_printf(bio_s_out, "read R BLOCK\\n");\n#ifndef OPENSSL_NO_SRP\n                if (BIO_should_io_special(io)\n                    && BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {\n                    BIO_printf(bio_s_out, "LOOKUP renego during read\\n");\n                    srp_callback_parm.user =\n                        SRP_VBASE_get_by_user(srp_callback_parm.vb,\n                                              srp_callback_parm.login);\n                    if (srp_callback_parm.user)\n                        BIO_printf(bio_s_out, "LOOKUP done %s\\n",\n                                   srp_callback_parm.user->info);\n                    else\n                        BIO_printf(bio_s_out, "LOOKUP not successful\\n");\n                    continue;\n                }\n#endif\n#if defined(OPENSSL_SYS_NETWARE)\n                delay(1000);\n#elif !defined(OPENSSL_SYS_MSDOS)\n                sleep(1);\n#endif\n                continue;\n            }\n        } else if (i == 0) {\n            ret = 1;\n            goto end;\n        }\n        if (((www == 1) && (strncmp("GET ", buf, 4) == 0)) ||\n            ((www == 2) && (strncmp("GET /stats ", buf, 11) == 0))) {\n            char *p;\n            X509 *peer;\n            STACK_OF(SSL_CIPHER) *sk;\n            static const char *space = "                          ";\n            if (www == 1 && strncmp("GET /reneg", buf, 10) == 0) {\n                if (strncmp("GET /renegcert", buf, 14) == 0)\n                    SSL_set_verify(con,\n                                   SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE,\n                                   NULL);\n                i = SSL_renegotiate(con);\n                BIO_printf(bio_s_out, "SSL_renegotiate -> %d\\n", i);\n                i = SSL_do_handshake(con);\n                if (i <= 0) {\n                    BIO_printf(bio_s_out, "SSL_do_handshake() Retval %d\\n",\n                               SSL_get_error(con, i));\n                    ERR_print_errors(bio_err);\n                    goto err;\n                }\n                SSL_set_state(con, SSL_ST_ACCEPT);\n                i = SSL_do_handshake(con);\n                BIO_printf(bio_s_out, "SSL_do_handshake -> %d\\n", i);\n                if (i <= 0) {\n                    BIO_printf(bio_s_out, "SSL_do_handshake() Retval %d\\n",\n                               SSL_get_error(con, i));\n                    ERR_print_errors(bio_err);\n                    goto err;\n                }\n            }\n            BIO_puts(io,\n                     "HTTP/1.0 200 ok\\r\\nContent-type: text/html\\r\\n\\r\\n");\n            BIO_puts(io, "<HTML><BODY BGCOLOR=\\"#ffffff\\">\\n");\n            BIO_puts(io, "<pre>\\n");\n            BIO_puts(io, "\\n");\n            for (i = 0; i < local_argc; i++) {\n                const char *myp;\n                for (myp = local_argv[i]; *myp; myp++)\n                    switch (*myp) {\n                    case \'<\':\n                        BIO_puts(io, "&lt;");\n                        break;\n                    case \'>\':\n                        BIO_puts(io, "&gt;");\n                        break;\n                    case \'&\':\n                        BIO_puts(io, "&amp;");\n                        break;\n                    default:\n                        BIO_write(io, myp, 1);\n                        break;\n                    }\n                BIO_write(io, " ", 1);\n            }\n            BIO_puts(io, "\\n");\n            BIO_printf(io,\n                       "Secure Renegotiation IS%s supported\\n",\n                       SSL_get_secure_renegotiation_support(con) ?\n                       "" : " NOT");\n            BIO_printf(io, "Ciphers supported in s_server binary\\n");\n            sk = SSL_get_ciphers(con);\n            j = sk_SSL_CIPHER_num(sk);\n            for (i = 0; i < j; i++) {\n                c = sk_SSL_CIPHER_value(sk, i);\n                BIO_printf(io, "%-11s:%-25s ",\n                           SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));\n                if ((((i + 1) % 2) == 0) && (i + 1 != j))\n                    BIO_puts(io, "\\n");\n            }\n            BIO_puts(io, "\\n");\n            p = SSL_get_shared_ciphers(con, buf, bufsize);\n            if (p != NULL) {\n                BIO_printf(io,\n                           "---\\nCiphers common between both SSL end points:\\n");\n                j = i = 0;\n                while (*p) {\n                    if (*p == \':\') {\n                        BIO_write(io, space, 26 - j);\n                        i++;\n                        j = 0;\n                        BIO_write(io, ((i % 3) ? " " : "\\n"), 1);\n                    } else {\n                        BIO_write(io, p, 1);\n                        j++;\n                    }\n                    p++;\n                }\n                BIO_puts(io, "\\n");\n            }\n            ssl_print_sigalgs(io, con);\n#ifndef OPENSSL_NO_EC\n            ssl_print_curves(io, con, 0);\n#endif\n            BIO_printf(io, (SSL_cache_hit(con)\n                            ? "---\\nReused, " : "---\\nNew, "));\n            c = SSL_get_current_cipher(con);\n            BIO_printf(io, "%s, Cipher is %s\\n",\n                       SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));\n            SSL_SESSION_print(io, SSL_get_session(con));\n            BIO_printf(io, "---\\n");\n            print_stats(io, SSL_get_SSL_CTX(con));\n            BIO_printf(io, "---\\n");\n            peer = SSL_get_peer_certificate(con);\n            if (peer != NULL) {\n                BIO_printf(io, "Client certificate\\n");\n                X509_print(io, peer);\n                PEM_write_bio_X509(io, peer);\n            } else\n                BIO_puts(io, "no client certificate available\\n");\n            BIO_puts(io, "</BODY></HTML>\\r\\n\\r\\n");\n            break;\n        } else if ((www == 2 || www == 3)\n                   && (strncmp("GET /", buf, 5) == 0)) {\n            BIO *file;\n            char *p, *e;\n            static const char *text =\n                "HTTP/1.0 200 ok\\r\\nContent-type: text/plain\\r\\n\\r\\n";\n            p = &(buf[5]);\n            dot = 1;\n            for (e = p; *e != \'\\0\'; e++) {\n                if (e[0] == \' \')\n                    break;\n                switch (dot) {\n                case 1:\n                    dot = (e[0] == \'.\') ? 2 : 0;\n                    break;\n                case 2:\n                    dot = (e[0] == \'.\') ? 3 : 0;\n                    break;\n                case 3:\n                    dot = (e[0] == \'/\') ? -1 : 0;\n                    break;\n                }\n                if (dot == 0)\n                    dot = (e[0] == \'/\') ? 1 : 0;\n            }\n            dot = (dot == 3) || (dot == -1);\n            if (*e == \'\\0\') {\n                BIO_puts(io, text);\n                BIO_printf(io, "\'%s\' is an invalid file name\\r\\n", p);\n                break;\n            }\n            *e = \'\\0\';\n            if (dot) {\n                BIO_puts(io, text);\n                BIO_printf(io, "\'%s\' contains \'..\' reference\\r\\n", p);\n                break;\n            }\n            if (*p == \'/\') {\n                BIO_puts(io, text);\n                BIO_printf(io, "\'%s\' is an invalid path\\r\\n", p);\n                break;\n            }\n            if (app_isdir(p) > 0) {\n                BIO_puts(io, text);\n                BIO_printf(io, "\'%s\' is a directory\\r\\n", p);\n                break;\n            }\n            if ((file = BIO_new_file(p, "r")) == NULL) {\n                BIO_puts(io, text);\n                BIO_printf(io, "Error opening \'%s\'\\r\\n", p);\n                ERR_print_errors(io);\n                break;\n            }\n            if (!s_quiet)\n                BIO_printf(bio_err, "FILE:%s\\n", p);\n            if (www == 2) {\n                i = strlen(p);\n                if (((i > 5) && (strcmp(&(p[i - 5]), ".html") == 0)) ||\n                    ((i > 4) && (strcmp(&(p[i - 4]), ".php") == 0)) ||\n                    ((i > 4) && (strcmp(&(p[i - 4]), ".htm") == 0)))\n                    BIO_puts(io,\n                             "HTTP/1.0 200 ok\\r\\nContent-type: text/html\\r\\n\\r\\n");\n                else\n                    BIO_puts(io,\n                             "HTTP/1.0 200 ok\\r\\nContent-type: text/plain\\r\\n\\r\\n");\n            }\n            for (;;) {\n                i = BIO_read(file, buf, bufsize);\n                if (i <= 0)\n                    break;\n#ifdef RENEG\n                total_bytes += i;\n                BIO_printf(bio_err, "%d\\n", i);\n                if (total_bytes > 3 * 1024) {\n                    total_bytes = 0;\n                    BIO_printf(bio_err, "RENEGOTIATE\\n");\n                    SSL_renegotiate(con);\n                }\n#endif\n                for (j = 0; j < i;) {\n#ifdef RENEG\n                    {\n                        static count = 0;\n                        if (++count == 13) {\n                            SSL_renegotiate(con);\n                        }\n                    }\n#endif\n                    k = BIO_write(io, &(buf[j]), i - j);\n                    if (k <= 0) {\n                        if (!BIO_should_retry(io))\n                            goto write_error;\n                        else {\n                            BIO_printf(bio_s_out, "rwrite W BLOCK\\n");\n                        }\n                    } else {\n                        j += k;\n                    }\n                }\n            }\n write_error:\n            BIO_free(file);\n            break;\n        }\n    }\n    for (;;) {\n        i = (int)BIO_flush(io);\n        if (i <= 0) {\n            if (!BIO_should_retry(io))\n                break;\n        } else\n            break;\n    }\n end:\n    SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN);\n err:\n    if (ret >= 0)\n        BIO_printf(bio_s_out, "ACCEPT\\n");\n    OPENSSL_free(buf);\n    BIO_free_all(io);\n    return (ret);\n}', 'static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)\n{\n    BIO_printf(bio, "%4ld items in the session cache\\n",\n               SSL_CTX_sess_number(ssl_ctx));\n    BIO_printf(bio, "%4ld client connects (SSL_connect())\\n",\n               SSL_CTX_sess_connect(ssl_ctx));\n    BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\\n",\n               SSL_CTX_sess_connect_renegotiate(ssl_ctx));\n    BIO_printf(bio, "%4ld client connects that finished\\n",\n               SSL_CTX_sess_connect_good(ssl_ctx));\n    BIO_printf(bio, "%4ld server accepts (SSL_accept())\\n",\n               SSL_CTX_sess_accept(ssl_ctx));\n    BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\\n",\n               SSL_CTX_sess_accept_renegotiate(ssl_ctx));\n    BIO_printf(bio, "%4ld server accepts that finished\\n",\n               SSL_CTX_sess_accept_good(ssl_ctx));\n    BIO_printf(bio, "%4ld session cache hits\\n", SSL_CTX_sess_hits(ssl_ctx));\n    BIO_printf(bio, "%4ld session cache misses\\n",\n               SSL_CTX_sess_misses(ssl_ctx));\n    BIO_printf(bio, "%4ld session cache timeouts\\n",\n               SSL_CTX_sess_timeouts(ssl_ctx));\n    BIO_printf(bio, "%4ld callback cache hits\\n",\n               SSL_CTX_sess_cb_hits(ssl_ctx));\n    BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\\n",\n               SSL_CTX_sess_cache_full(ssl_ctx),\n               SSL_CTX_sess_get_cache_size(ssl_ctx));\n}', 'long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg)\n{\n    long l;\n    if (ctx == NULL) {\n        switch (cmd) {\n#ifndef OPENSSL_NO_EC\n        case SSL_CTRL_SET_CURVES_LIST:\n            return tls1_set_curves_list(NULL, NULL, parg);\n#endif\n        case SSL_CTRL_SET_SIGALGS_LIST:\n        case SSL_CTRL_SET_CLIENT_SIGALGS_LIST:\n            return tls1_set_sigalgs_list(NULL, parg, 0);\n        default:\n            return 0;\n        }\n    }\n    switch (cmd) {\n    case SSL_CTRL_GET_READ_AHEAD:\n        return (ctx->read_ahead);\n    case SSL_CTRL_SET_READ_AHEAD:\n        l = ctx->read_ahead;\n        ctx->read_ahead = larg;\n        return (l);\n    case SSL_CTRL_SET_MSG_CALLBACK_ARG:\n        ctx->msg_callback_arg = parg;\n        return 1;\n    case SSL_CTRL_GET_MAX_CERT_LIST:\n        return (ctx->max_cert_list);\n    case SSL_CTRL_SET_MAX_CERT_LIST:\n        l = ctx->max_cert_list;\n        ctx->max_cert_list = larg;\n        return (l);\n    case SSL_CTRL_SET_SESS_CACHE_SIZE:\n        l = ctx->session_cache_size;\n        ctx->session_cache_size = larg;\n        return (l);\n    case SSL_CTRL_GET_SESS_CACHE_SIZE:\n        return (ctx->session_cache_size);\n    case SSL_CTRL_SET_SESS_CACHE_MODE:\n        l = ctx->session_cache_mode;\n        ctx->session_cache_mode = larg;\n        return (l);\n    case SSL_CTRL_GET_SESS_CACHE_MODE:\n        return (ctx->session_cache_mode);\n    case SSL_CTRL_SESS_NUMBER:\n        return (lh_SSL_SESSION_num_items(ctx->sessions));\n    case SSL_CTRL_SESS_CONNECT:\n        return (ctx->stats.sess_connect);\n    case SSL_CTRL_SESS_CONNECT_GOOD:\n        return (ctx->stats.sess_connect_good);\n    case SSL_CTRL_SESS_CONNECT_RENEGOTIATE:\n        return (ctx->stats.sess_connect_renegotiate);\n    case SSL_CTRL_SESS_ACCEPT:\n        return (ctx->stats.sess_accept);\n    case SSL_CTRL_SESS_ACCEPT_GOOD:\n        return (ctx->stats.sess_accept_good);\n    case SSL_CTRL_SESS_ACCEPT_RENEGOTIATE:\n        return (ctx->stats.sess_accept_renegotiate);\n    case SSL_CTRL_SESS_HIT:\n        return (ctx->stats.sess_hit);\n    case SSL_CTRL_SESS_CB_HIT:\n        return (ctx->stats.sess_cb_hit);\n    case SSL_CTRL_SESS_MISSES:\n        return (ctx->stats.sess_miss);\n    case SSL_CTRL_SESS_TIMEOUTS:\n        return (ctx->stats.sess_timeout);\n    case SSL_CTRL_SESS_CACHE_FULL:\n        return (ctx->stats.sess_cache_full);\n    case SSL_CTRL_OPTIONS:\n        return (ctx->options |= larg);\n    case SSL_CTRL_CLEAR_OPTIONS:\n        return (ctx->options &= ~larg);\n    case SSL_CTRL_MODE:\n        return (ctx->mode |= larg);\n    case SSL_CTRL_CLEAR_MODE:\n        return (ctx->mode &= ~larg);\n    case SSL_CTRL_SET_MAX_SEND_FRAGMENT:\n        if (larg < 512 || larg > SSL3_RT_MAX_PLAIN_LENGTH)\n            return 0;\n        ctx->max_send_fragment = larg;\n        return 1;\n    case SSL_CTRL_CERT_FLAGS:\n        return (ctx->cert->cert_flags |= larg);\n    case SSL_CTRL_CLEAR_CERT_FLAGS:\n        return (ctx->cert->cert_flags &= ~larg);\n    default:\n        return (ctx->method->ssl_ctx_ctrl(ctx, cmd, larg, parg));\n    }\n}', 'int X509_print(BIO *bp, X509 *x)\n{\n    return X509_print_ex(bp, x, XN_FLAG_COMPAT, X509_FLAG_COMPAT);\n}', 'int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags,\n                  unsigned long cflag)\n{\n    long l;\n    int ret = 0, i;\n    char *m = NULL, mlch = \' \';\n    int nmindent = 0;\n    X509_CINF *ci;\n    ASN1_INTEGER *bs;\n    EVP_PKEY *pkey = NULL;\n    const char *neg;\n    if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {\n        mlch = \'\\n\';\n        nmindent = 12;\n    }\n    if (nmflags == X509_FLAG_COMPAT)\n        nmindent = 16;\n    ci = &x->cert_info;\n    if (!(cflag & X509_FLAG_NO_HEADER)) {\n        if (BIO_write(bp, "Certificate:\\n", 13) <= 0)\n            goto err;\n        if (BIO_write(bp, "    Data:\\n", 10) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_VERSION)) {\n        l = X509_get_version(x);\n        if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\\n", "", l + 1, l) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_SERIAL)) {\n        if (BIO_write(bp, "        Serial Number:", 22) <= 0)\n            goto err;\n        bs = X509_get_serialNumber(x);\n        if (bs->length <= (int)sizeof(long)) {\n                ERR_set_mark();\n                l = ASN1_INTEGER_get(bs);\n                ERR_pop_to_mark();\n        } else {\n            l = -1;\n        }\n        if (l != -1) {\n            if (bs->type == V_ASN1_NEG_INTEGER) {\n                l = -l;\n                neg = "-";\n            } else\n                neg = "";\n            if (BIO_printf(bp, " %s%lu (%s0x%lx)\\n", neg, l, neg, l) <= 0)\n                goto err;\n        } else {\n            neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : "";\n            if (BIO_printf(bp, "\\n%12s%s", "", neg) <= 0)\n                goto err;\n            for (i = 0; i < bs->length; i++) {\n                if (BIO_printf(bp, "%02x%c", bs->data[i],\n                               ((i + 1 == bs->length) ? \'\\n\' : \':\')) <= 0)\n                    goto err;\n            }\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_SIGNAME)) {\n        if (X509_signature_print(bp, &ci->signature, NULL) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_ISSUER)) {\n        if (BIO_printf(bp, "        Issuer:%c", mlch) <= 0)\n            goto err;\n        if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), nmindent, nmflags)\n            < 0)\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_VALIDITY)) {\n        if (BIO_write(bp, "        Validity\\n", 17) <= 0)\n            goto err;\n        if (BIO_write(bp, "            Not Before: ", 24) <= 0)\n            goto err;\n        if (!ASN1_TIME_print(bp, X509_get_notBefore(x)))\n            goto err;\n        if (BIO_write(bp, "\\n            Not After : ", 25) <= 0)\n            goto err;\n        if (!ASN1_TIME_print(bp, X509_get_notAfter(x)))\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_SUBJECT)) {\n        if (BIO_printf(bp, "        Subject:%c", mlch) <= 0)\n            goto err;\n        if (X509_NAME_print_ex\n            (bp, X509_get_subject_name(x), nmindent, nmflags) < 0)\n            goto err;\n        if (BIO_write(bp, "\\n", 1) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_PUBKEY)) {\n        if (BIO_write(bp, "        Subject Public Key Info:\\n", 33) <= 0)\n            goto err;\n        if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0)\n            goto err;\n        if (i2a_ASN1_OBJECT(bp, ci->key->algor->algorithm) <= 0)\n            goto err;\n        if (BIO_puts(bp, "\\n") <= 0)\n            goto err;\n        pkey = X509_get_pubkey(x);\n        if (pkey == NULL) {\n            BIO_printf(bp, "%12sUnable to load Public Key\\n", "");\n            ERR_print_errors(bp);\n        } else {\n            EVP_PKEY_print_public(bp, pkey, 16, NULL);\n            EVP_PKEY_free(pkey);\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_IDS)) {\n        if (ci->issuerUID) {\n            if (BIO_printf(bp, "%8sIssuer Unique ID: ", "") <= 0)\n                goto err;\n            if (!X509_signature_dump(bp, ci->issuerUID, 12))\n                goto err;\n        }\n        if (ci->subjectUID) {\n            if (BIO_printf(bp, "%8sSubject Unique ID: ", "") <= 0)\n                goto err;\n            if (!X509_signature_dump(bp, ci->subjectUID, 12))\n                goto err;\n        }\n    }\n    if (!(cflag & X509_FLAG_NO_EXTENSIONS))\n        X509V3_extensions_print(bp, "X509v3 extensions",\n                                ci->extensions, cflag, 8);\n    if (!(cflag & X509_FLAG_NO_SIGDUMP)) {\n        if (X509_signature_print(bp, &x->sig_alg, x->signature) <= 0)\n            goto err;\n    }\n    if (!(cflag & X509_FLAG_NO_AUX)) {\n        if (!X509_CERT_AUX_print(bp, x->aux, 0))\n            goto err;\n    }\n    ret = 1;\n err:\n    OPENSSL_free(m);\n    return (ret);\n}', 'int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)\n{\n    if (tm->type == V_ASN1_UTCTIME)\n        return ASN1_UTCTIME_print(bp, tm);\n    if (tm->type == V_ASN1_GENERALIZEDTIME)\n        return ASN1_GENERALIZEDTIME_print(bp, tm);\n    BIO_write(bp, "Bad time value", 14);\n    return (0);\n}', 'int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)\n{\n    char *v;\n    int gmt = 0;\n    int i;\n    int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;\n    char *f = NULL;\n    int f_len = 0;\n    i = tm->length;\n    v = (char *)tm->data;\n    if (i < 12)\n        goto err;\n    if (v[i - 1] == \'Z\')\n        gmt = 1;\n    for (i = 0; i < 12; i++)\n        if ((v[i] > \'9\') || (v[i] < \'0\'))\n            goto err;\n    y = (v[0] - \'0\') * 1000 + (v[1] - \'0\') * 100\n        + (v[2] - \'0\') * 10 + (v[3] - \'0\');\n    M = (v[4] - \'0\') * 10 + (v[5] - \'0\');\n    if ((M > 12) || (M < 1))\n        goto err;\n    d = (v[6] - \'0\') * 10 + (v[7] - \'0\');\n    h = (v[8] - \'0\') * 10 + (v[9] - \'0\');\n    m = (v[10] - \'0\') * 10 + (v[11] - \'0\');\n    if (tm->length >= 14 &&\n        (v[12] >= \'0\') && (v[12] <= \'9\') &&\n        (v[13] >= \'0\') && (v[13] <= \'9\')) {\n        s = (v[12] - \'0\') * 10 + (v[13] - \'0\');\n        if (tm->length >= 15 && v[14] == \'.\') {\n            int l = tm->length;\n            f = &v[14];\n            f_len = 1;\n            while (14 + f_len < l && f[f_len] >= \'0\' && f[f_len] <= \'9\')\n                ++f_len;\n        }\n    }\n    if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",\n                   _asn1_mon[M - 1], d, h, m, s, f_len, f, y,\n                   (gmt) ? " GMT" : "") <= 0)\n        return (0);\n    else\n        return (1);\n err:\n    BIO_write(bp, "Bad time value", 14);\n    return (0);\n}']