>       From: [email protected] On Behalf Of Harshvir Sidhu
>       Sent: Wednesday, 13 April, 2011 08:29

>       Server is Single Threaded and is handling all the connections 
> in while(1) loop, the sockets are blocking but I am using FD_SET options, 
> not sure if that could be interrupting with the way openssl works, 
> in the code i am doing accept, then created SSL and CTX and then 
> calling SSL_Accept. I am NOT using OpenSSL callbacks.

Okay, that rules out all my obvious candidates for corruption.
         
>       Regarding code, the library i am using is 1.0.0a, but the 
> openssl s_client i was using that i downloaded and that is 1.0.0c, 
> but i think that should not cause a problem, as when i try to connect 
> using the client created with 1.0.0a i still get the same error. 
> I tried using OpenSSL s_client just to shortlist the error to be on 
> server or client side. Just to be sure, i will reply with the 
> OpenSSL s_client from the same build.
         
>       The server WORKS with clients that are NON SSL, but on the 
> connection that i do SSL it fails with the mentioned error.

>       PFA the log file for s_client side, I have removed the data 
> it exchanges between client and server to reduce the log, let me 
> know if this is not clear, i will rerun and send the whole log.

Yeah, the data probably wouldn't help -- I'm not going to 
check cipher and mac by hand and I doubt anyone else will.
It does support my guess that the error occurs on Finished.
         
>       I tried using s_server and s_client from the same build 
> and it works fine and it uses the cipher value from log 
> ECDHE-RSA-AES256-SHA. 

Which is same data-crypto although different keyexchange 
as s_client gets to your server namely (kaRSA-)AES256-SHA.
I don't really think kRSA is wrong, but just on the offchance 
try s_server with -cipher AES256-SHA. 

Heck, try your server (assuming configurable) and s_server 
with (kaRSA-)NULL-SHA and/or ECDHE-RSA-NULL-SHA; 
this may provide a useful datapoint and if debugging 
is needed (below) makes it easier. (Of course you 
shouldn't use eNULL for real, only for debugging.)

> But when i use s_client from the same build with my server then 
> it dont work. This means something is wrong with my server code. 
> Not sure what, any suggestions based on what i mentioend above?

Nothing obvious to me. For what it's worth, my approach on a stumper 
like this would be as follows, which I know is mostly obvious:

If not already using OpenSSL clean build from source, try that, 
and also a newer version and an older one (unless incompatible).
And try on at least one other platform. On the current data 
I doubt an OpenSSL build problem but it never hurts to try.

Gradually cut down the program, to see where the problem 
vanishes; or if easier, build up to it in pieces, to see 
where the problem starts. If this points at code, 
debug-step through it and check exactly what it's doing.
Remembering that in C, using bad pointers (especially 
uninit or stale) can cause problems to appear in a part 
of the code far away from the actual bug.

At worst, build OpenSSL with symbols if not already and 
step through the logic to handle Finished (at least) 
and see exactly what error it's getting; once localized, 
run both s_client and server in debug and watch exactly 
what they do and try to figure out which is wrong.
First check that premaster and master secrets agree, 
because that's a difference for ECDHE-RSA versus kaRSA. 
Use eNULL if possible (above) to make debugging easier.

Sorry I can't be more help. Good luck.

<snip previous>


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to