apps/s_server.c:2412: error: UNINITIALIZED_VALUE
  The value read from fd was never initialized.
Showing all 1 steps of the trace


apps/s_server.c:2412:25: 
2410.               }
2411.   
2412. >             if(!wbio || connect(fd, &client, sizeof(struct sockaddr))) {
2413.                   BIO_printf(bio_err, "ERROR - unable to connect\n");
2414.                   return 0;

static int init_ssl_connection(SSL *con)
{
    int i;
    const char *str;
    X509 *peer;
    long verify_err;
    char buf[BUFSIZ];
#if !defined(OPENSSL_NO_NEXTPROTONEG)
    const unsigned char *next_proto_neg;
    unsigned next_proto_neg_len;
#endif
    unsigned char *exportedkeymat;
    struct sockaddr client;
#ifndef OPENSSL_NO_DTLS1
    if(dtlslisten) {
        i = DTLSv1_listen(con, &client);
        if (i > 0) {
            BIO *wbio;
            int fd;
            wbio = SSL_get_wbio(con);
            if(wbio) {
                BIO_get_fd(wbio, &fd);
            }
            if(!wbio || connect(fd, &client, sizeof(struct sockaddr))) {
                BIO_printf(bio_err, "ERROR - unable to connect\n");
                return 0;
            }
            dtlslisten = 0;
            i = SSL_accept(con);
        }
    } else
#endif
        i = SSL_accept(con);
#ifdef CERT_CB_TEST_RETRY
    {
        while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
               && SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {
            BIO_printf(bio_err,
                       "LOOKUP from certificate callback during accept\n");
            i = SSL_accept(con);
        }
    }
#endif
#ifndef OPENSSL_NO_SRP
    while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
        BIO_printf(bio_s_out, "LOOKUP during accept %s\n",
                   srp_callback_parm.login);
        srp_callback_parm.user =
            SRP_VBASE_get_by_user(srp_callback_parm.vb,
                                  srp_callback_parm.login);
        if (srp_callback_parm.user)
            BIO_printf(bio_s_out, "LOOKUP done %s\n",
                       srp_callback_parm.user->info);
        else
            BIO_printf(bio_s_out, "LOOKUP not successful\n");
        i = SSL_accept(con);
    }
#endif
    if (i <= 0) {
#ifndef OPENSSL_NO_DTLS1
        if ((dtlslisten && i == 0)
                || (!dtlslisten && BIO_sock_should_retry(i))) {
            BIO_printf(bio_s_out, "DELAY\n");
            return (1);
        }
#endif
        BIO_printf(bio_err, "ERROR\n");
        verify_err = SSL_get_verify_result(con);
        if (verify_err != X509_V_OK) {
            BIO_printf(bio_err, "verify error:%s\n",
                       X509_verify_cert_error_string(verify_err));
        }
        ERR_print_errors(bio_err);
        return (0);
    }
    if (s_brief)
        print_ssl_summary(con);
    PEM_write_bio_SSL_SESSION(bio_s_out, SSL_get_session(con));
    peer = SSL_get_peer_certificate(con);
    if (peer != NULL) {
        BIO_printf(bio_s_out, "Client certificate\n");
        PEM_write_bio_X509(bio_s_out, peer);
        X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf);
        BIO_printf(bio_s_out, "subject=%s\n", buf);
        X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf);
        BIO_printf(bio_s_out, "issuer=%s\n", buf);
        X509_free(peer);
    }
    if (SSL_get_shared_ciphers(con, buf, sizeof buf) != NULL)
        BIO_printf(bio_s_out, "Shared ciphers:%s\n", buf);
    str = SSL_CIPHER_get_name(SSL_get_current_cipher(con));
    ssl_print_sigalgs(bio_s_out, con);
#ifndef OPENSSL_NO_EC
    ssl_print_point_formats(bio_s_out, con);
    ssl_print_curves(bio_s_out, con, 0);
#endif
    BIO_printf(bio_s_out, "CIPHER is %s\n", (str != NULL) ? str : "(NONE)");
#if !defined(OPENSSL_NO_NEXTPROTONEG)
    SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);
    if (next_proto_neg) {
        BIO_printf(bio_s_out, "NEXTPROTO is ");
        BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len);
        BIO_printf(bio_s_out, "\n");
    }
#endif
#ifndef OPENSSL_NO_SRTP
    {
        SRTP_PROTECTION_PROFILE *srtp_profile
            = SSL_get_selected_srtp_profile(con);
        if (srtp_profile)
            BIO_printf(bio_s_out, "SRTP Extension negotiated, profile=%s\n",
                       srtp_profile->name);
    }
#endif
    if (SSL_cache_hit(con))
        BIO_printf(bio_s_out, "Reused session-id\n");
    BIO_printf(bio_s_out, "Secure Renegotiation IS%s supported\n",
               SSL_get_secure_renegotiation_support(con) ? "" : " NOT");
    if (keymatexportlabel != NULL) {
        BIO_printf(bio_s_out, "Keying material exporter:\n");
        BIO_printf(bio_s_out, "    Label: '%s'\n", keymatexportlabel);
        BIO_printf(bio_s_out, "    Length: %i bytes\n", keymatexportlen);
        exportedkeymat = app_malloc(keymatexportlen, "export key");
        if (!SSL_export_keying_material(con, exportedkeymat,
                                        keymatexportlen,
                                        keymatexportlabel,
                                        strlen(keymatexportlabel),
                                        NULL, 0, 0)) {
            BIO_printf(bio_s_out, "    Error\n");
        } else {
            BIO_printf(bio_s_out, "    Keying material: ");
            for (i = 0; i < keymatexportlen; i++)
                BIO_printf(bio_s_out, "%02X", exportedkeymat[i]);
            BIO_printf(bio_s_out, "\n");
        }
        OPENSSL_free(exportedkeymat);
    }
    return (1);
}
['static int init_ssl_connection(SSL *con)\n{\n    int i;\n    const char *str;\n    X509 *peer;\n    long verify_err;\n    char buf[BUFSIZ];\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n    const unsigned char *next_proto_neg;\n    unsigned next_proto_neg_len;\n#endif\n    unsigned char *exportedkeymat;\n    struct sockaddr client;\n#ifndef OPENSSL_NO_DTLS1\n    if(dtlslisten) {\n        i = DTLSv1_listen(con, &client);\n        if (i > 0) {\n            BIO *wbio;\n            int fd;\n            wbio = SSL_get_wbio(con);\n            if(wbio) {\n                BIO_get_fd(wbio, &fd);\n            }\n            if(!wbio || connect(fd, &client, sizeof(struct sockaddr))) {\n                BIO_printf(bio_err, "ERROR - unable to connect\\n");\n                return 0;\n            }\n            dtlslisten = 0;\n            i = SSL_accept(con);\n        }\n    } else\n#endif\n        i = SSL_accept(con);\n#ifdef CERT_CB_TEST_RETRY\n    {\n        while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP\n               && SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {\n            BIO_printf(bio_err,\n                       "LOOKUP from certificate callback during accept\\n");\n            i = SSL_accept(con);\n        }\n    }\n#endif\n#ifndef OPENSSL_NO_SRP\n    while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {\n        BIO_printf(bio_s_out, "LOOKUP during accept %s\\n",\n                   srp_callback_parm.login);\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        i = SSL_accept(con);\n    }\n#endif\n    if (i <= 0) {\n#ifndef OPENSSL_NO_DTLS1\n        if ((dtlslisten && i == 0)\n                || (!dtlslisten && BIO_sock_should_retry(i))) {\n            BIO_printf(bio_s_out, "DELAY\\n");\n            return (1);\n        }\n#endif\n        BIO_printf(bio_err, "ERROR\\n");\n        verify_err = SSL_get_verify_result(con);\n        if (verify_err != X509_V_OK) {\n            BIO_printf(bio_err, "verify error:%s\\n",\n                       X509_verify_cert_error_string(verify_err));\n        }\n        ERR_print_errors(bio_err);\n        return (0);\n    }\n    if (s_brief)\n        print_ssl_summary(con);\n    PEM_write_bio_SSL_SESSION(bio_s_out, SSL_get_session(con));\n    peer = SSL_get_peer_certificate(con);\n    if (peer != NULL) {\n        BIO_printf(bio_s_out, "Client certificate\\n");\n        PEM_write_bio_X509(bio_s_out, peer);\n        X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf);\n        BIO_printf(bio_s_out, "subject=%s\\n", buf);\n        X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf);\n        BIO_printf(bio_s_out, "issuer=%s\\n", buf);\n        X509_free(peer);\n    }\n    if (SSL_get_shared_ciphers(con, buf, sizeof buf) != NULL)\n        BIO_printf(bio_s_out, "Shared ciphers:%s\\n", buf);\n    str = SSL_CIPHER_get_name(SSL_get_current_cipher(con));\n    ssl_print_sigalgs(bio_s_out, con);\n#ifndef OPENSSL_NO_EC\n    ssl_print_point_formats(bio_s_out, con);\n    ssl_print_curves(bio_s_out, con, 0);\n#endif\n    BIO_printf(bio_s_out, "CIPHER is %s\\n", (str != NULL) ? str : "(NONE)");\n#if !defined(OPENSSL_NO_NEXTPROTONEG)\n    SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);\n    if (next_proto_neg) {\n        BIO_printf(bio_s_out, "NEXTPROTO is ");\n        BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len);\n        BIO_printf(bio_s_out, "\\n");\n    }\n#endif\n#ifndef OPENSSL_NO_SRTP\n    {\n        SRTP_PROTECTION_PROFILE *srtp_profile\n            = SSL_get_selected_srtp_profile(con);\n        if (srtp_profile)\n            BIO_printf(bio_s_out, "SRTP Extension negotiated, profile=%s\\n",\n                       srtp_profile->name);\n    }\n#endif\n    if (SSL_cache_hit(con))\n        BIO_printf(bio_s_out, "Reused session-id\\n");\n    BIO_printf(bio_s_out, "Secure Renegotiation IS%s supported\\n",\n               SSL_get_secure_renegotiation_support(con) ? "" : " NOT");\n    if (keymatexportlabel != NULL) {\n        BIO_printf(bio_s_out, "Keying material exporter:\\n");\n        BIO_printf(bio_s_out, "    Label: \'%s\'\\n", keymatexportlabel);\n        BIO_printf(bio_s_out, "    Length: %i bytes\\n", keymatexportlen);\n        exportedkeymat = app_malloc(keymatexportlen, "export key");\n        if (!SSL_export_keying_material(con, exportedkeymat,\n                                        keymatexportlen,\n                                        keymatexportlabel,\n                                        strlen(keymatexportlabel),\n                                        NULL, 0, 0)) {\n            BIO_printf(bio_s_out, "    Error\\n");\n        } else {\n            BIO_printf(bio_s_out, "    Keying material: ");\n            for (i = 0; i < keymatexportlen; i++)\n                BIO_printf(bio_s_out, "%02X", exportedkeymat[i]);\n            BIO_printf(bio_s_out, "\\n");\n        }\n        OPENSSL_free(exportedkeymat);\n    }\n    return (1);\n}']