Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All, I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request. My problem is, ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    50

    Exclamation Help: SSL_write returns SSL_ERROR_SYSCALL, EOF on Second Call


    Hi All,

    I am facing issue in my OPENSSL code. I have written openssl client. It sends request to the host and receives response for that request.

    My problem is, it connects, sends request successfully to host at first time only in sencond attempt it fails on SSL_write(). where SSL_get_error() returns SSL_ERROR_SYSCALL error.

    In that ERR_get_error() returns 0. man page shows "If ret == 0, an EOF was observed that violates the protocol".

    Is anybody help me on this. How i can fix this.

    Code Snippet.

    w=SSL_write(SSLRequestData.ssl,c2s,c2sl);

    switch(SSL_get_error(SSLRequestData.ssl,w))
    {
    case SSL_ERROR_NONE:
    if(c2sl!=w)
    {
    wRetVal = SSL_INCOMPLETE_WRITE;
    SSLConnect_Flag = FALSE;
    LOG_PRINTF("SSL Error: SSL_INCOMPLETE_WRITE\n");
    }
    else
    {
    wRetVal = SUCCESS;
    LOG_PRINTF("SSL: SSL Write SUCCESS\n");
    }
    break;

    case SSL_ERROR_WANT_READ:
    LOG_PRINTF("############## SSL_ERROR_WANT_READ \n");
    break;

    case SSL_ERROR_WANT_WRITE:
    LOG_PRINTF("############## SSL_ERROR_WANT_WRITE \n");
    break;

    case SSL_ERROR_WANT_CONNECT:
    LOG_PRINTF("############## SSL_ERROR_WANT_CONNECT \n");
    break;

    case SSL_ERROR_WANT_ACCEPT:
    LOG_PRINTF("############## SSL_ERROR_WANT_ACCEPT \n");
    break;

    case SSL_ERROR_WANT_X509_LOOKUP:
    LOG_PRINTF("############## SSL_ERROR_WANT_X509_LOOKUP \n");
    break;

    case SSL_ERROR_SYSCALL:
    LOG_PRINTF("############## SSL_ERROR_SYSCALL \n");
    iRetVal=ERR_get_error();
    LOG_PRINTF("### ERR_get_error: %d\n", iRetVal);
    break;

    case SSL_ERROR_SSL:
    LOG_PRINTF("############## SSL_ERROR_SSL \n");
    break;

    default:
    wRetVal = SSL_WRITE_ERROR;
    break;
    }

    if(wRetVal == SUCCESS)
    {
    LOG_PRINTF("Calling SSL_read..\n");

    /* set transaction timer */
    txnTimerId = CreateTimer(lTxnTimeout, Txn_TimerCallback, NULL);

    do
    {
    r=SSL_read(SSLRequestData.ssl,s2c,NUM_OF_BYTES);
    ------
    ------


    Please help on this!

  2. #2
    Just Joined!
    Join Date
    Oct 2010
    Posts
    4
    check the code flow after first "success". Is it resetting anything - ctx, etc?

    Also.. check if you're reading only part buffer OR if there are any loss of packet-level data in your program

  3. #3
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,753
    My guess is that the reader has closed its end of the connection, hence the EOF being detected by the writer.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Feb 2008
    Posts
    50

    Smile

    Thanks kcinmumbai & Rubberman for your replies.

    Yes Rubberman, it's issue of server side, It was fixed.

  6. #5
    Just Joined!
    Join Date
    Sep 2012
    Posts
    1
    Quote Originally Posted by ypankaj View Post
    Thanks kcinmumbai & Rubberman for your replies.

    Yes Rubberman, it's issue of server side, It was fixed.
    Hi Pankaj,

    Can you please disclose what was the issue on server side.

  7. #6
    oz
    oz is offline
    forum.guy
    Join Date
    May 2004
    Location
    arch linux
    Posts
    18,733
    Hello and welcome to the forums, Shisya!

    This thread is almost 2 years old so I'm going to go ahead and close it, but please feel free to start a fresh thread of your own with some details if you are having any problems with Linux.

    Thank you.
    oz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •