I modified my code a bit: *static SSL_CTX *ctx = NULL; static SSL *ssl = NULL;
void CreateTLSSession(int sockfd) { int RetValue=0; printf("CREATING TLS SESSION...\n"); SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms(); //ctx = SSL_CTX_new(TLSv1_client_method()); ctx = SSL_CTX_new(TLSv1_client_method()); //(SSL_CTX_set_options(ctx, SSL_OP_NO_COMPRESSION); //SSL_CTX_set_mode(ctx, SSL_MODE_RELEASE_BUFFERS); if (ctx == NULL) { printf("failed to initialize context\n"); return; } printf("CTX created...\n"); ssl = SSL_new(ctx); if (ssl == NULL) { printf("failed to create SSL structure...\n"); return; } if (!SSL_set_fd(ssl, sockfd)) { printf("failed to bind to socket fd\n"); return; } printf("SSL bound to sockfd=%d...\n",sockfd); while (RetValue != 1) { interpreteError(RetValue); sleep(1); RetValue = SSL_connect(ssl); } printf("OK\n"); } static void interpreteError(int iError) { int iRet = 0; iRet = SSL_get_error(ssl, iError); switch (iRet) { case SSL_ERROR_ZERO_RETURN: printf("ERROR: TLS/SSL connection has been closed!\n"); break; case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: printf("ERROR: want read/write!\n"); break; case SSL_ERROR_WANT_CONNECT: case SSL_ERROR_WANT_ACCEPT: printf("ERROR: socket not yet connect to the peer!\n"); break; case SSL_ERROR_WANT_X509_LOOKUP: printf("ERROR: want x509 lookup!\n"); break; case SSL_ERROR_SYSCALL: perror("SSL_ERROR_SYSCALL"); break; case SSL_ERROR_SSL: printf("ERROR: failure in SSL library!n"); break; default: printf("No errors\n"); } }* The output is: * CREATING TLS SESSION... CTX created... SSL bound to sockfd=9... SSL_ERROR_SYSCALL: No such file or directory SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success SSL_ERROR_SYSCALL: Success* So apparently some underlying system call is failing. Not sure which one though. -- View this message in context: http://openssl.6102.n7.nabble.com/SSL-connect-fails-no-attempt-for-handshake-with-server-observed-in-wireshark-tp49399p49413.html Sent from the OpenSSL - Dev mailing list archive at Nabble.com. ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org