1

(5 replies, posted in wolfSSL)

hi all,
I am also facing the issue while making communication between client and server.i developed my own client and server files for sending the secure data between them.while doing that i am unable to make the ssl Connection. i am getting the error= -308, (error state on socket) .
I am working on ubuntu virtual machine. i put some part of client and server codes below.

/*Server.c*/
WOLFSSL_CTX *ctx;
WOLFSSL* ssl;
WOLFSSL_METHOD *method;

wolfSSL_Init();

ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method);

wolfSSL_CTX_use_certificate_file(ctx, serverCertFile, SSL_FILETYPE_PEM);
wolfSSL_CTX_use_PrivateKey_file(ctx, serverKeyFile, SSL_FILETYPE_PEM);

creating and binding a socket for server.
accept the connection

ssl = wolfSSL_new(ctx);
wolfSSL_set_fd(ssl, client);

if ( wolfSSL_accept(ssl) == -1 )     /* do SSL-protocol accept */
{
    printf("Wolfssl Accept failed!! \n");
}
at server side i am getting Wolfssl Accept failed!!

/*Client.c*/
WOLFSSL_CTX *ctx;
WOLFSSL* ssl;
WOLFSSL_METHOD *method;

wolfSSL_Init();
wolfSSL_Debugging_ON();

ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
wolfSSL_CTX_load_verify_locations(ctx,"Cacertificate.pem",NULL)

opening and establishing a socket connection to the server.

ssl = wolfSSL_new(ctx);
wolfSSL_set_fd(ssl, sockettoserver);

if(wolfSSL_connect(ssl) != SSL_SUCCESS)
{
  /* ithe code is entering into this loop and i am getting error = -308 */
}

wolfSSL_free(ssl);

at client side i am getting error = -308,

Thanks in advance.