Let's start with the obvious, just to make 100% sure we're really having an
issue here.

> Here is one code example where I'm reading a 10-byte block of data
> (always 10-bytes, not less):
>
>      bufptr = (u_char *)&wh;
>      for (nread = 0; nread < sizeof(wh); nread += ret) {
>          ret = SSL_read(ssl,bufptr+nread,sizeof(wh)-nread);
>          if (ret <= 0)
>            break;
>      }

You are 100% sure sizeof(wh)==10? Do you check to be sure nread==10 after
this block? If it isn't, and you move on to the next chunk, you'll cause
exactly this problem. Is SSL_MODE_AUTO_RETRY set? (I'm assuming the
intention is for SSL_read to block until the session can be established
right?)

>      strncpy(msgLenStr,wh.msgLenStr,10);
>      msgLenStr[10] = 0;
>      msgLen = atoi(msgLenStr);

This looks fine, though it's terribly inefficient. (I hope you don't
particularly care about performance.)

DS


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to