strange intermittent errors

2010-04-23 Thread Mikhail Kruk
Hi, we are getting strange intermittent errors from OpensSSL. We have a hundreds of instances of this app connecting over the Internet to our servers. Only this one instance is sometimes experiences the following errors: ssl error: error:0606C06E:digital envelope routines:EVP_VerifyFinal:wrong

RE: Wider fallout from Debian issue?

2008-05-29 Thread Mikhail Kruk
Only against random attacks of course, if all attackers first check these keys, then removing them strengthens the algorithm against (non-random) brute-force attack. This said, the effort of explicitly avoiding these is probably wasted (unless one suspects one has a identically weak RNG). --

Re: public key in the binary

2007-10-03 Thread Mikhail Kruk
On Wed, 3 Oct 2007, Md Lazreg wrote: On 10/3/07, Victor Duchovni <[EMAIL PROTECTED]> wrote: On Wed, Oct 03, 2007 at 10:42:59AM -0500, Md Lazreg wrote: Private keys do encrypt using the function : http://www.openssl.org/docs/crypto/RSA_private_encrypt.html Of course they do, but when a priv

Re: SSL_peek() ?

2006-06-22 Thread Mikhail Kruk
> > I'm probably missing something, but what's wrong with select()'ing for > > read when your SSL_write returns WANT_READ? > > See relatively elegant read_write() implementation from > > http://www.rtfm.com/openssl-examples/ > > Nothing, but how do I know when I can start my SSL_write() again,

Re: SSL_peek() ?

2006-06-22 Thread Mikhail Kruk
> David Schwartz wrote: > >> My program is being told by the operating system I can write(), the > >> operating system socket send buffers are empty, but OpenSSL is returning > >> WANT_READ to SSL_write(), so I need to stop calling SSL_write() and wait > >> for data to arrive. This means temporall

RE: On select and blocking

2006-06-22 Thread Mikhail Kruk
On Thu, 22 Jun 2006, David Schwartz wrote: > > Bingo! And work may or may not translate into application data. I thought that a recv on a blocking socket returns immediately after it was able to do some work, no matter whether it resulted in receiving any actual data (e.g. socket closed).

Re: renegotiating problem - connection hanging?

2006-06-20 Thread Mikhail Kruk
> Perhaps the backtracking to reprocess the event as data involves a > second blocking socket read() in ssl3_read_bytes(). I am not familiar > with the details of this code. What I am curious about is when does > this happen. What is it exactly that the server is doing here, why, > and is it legal?

RE: renegotiating problem - connection hanging?

2006-06-20 Thread Mikhail Kruk
> > R. Stevens, Unix Network Programming, Volume 1, Second Edition, Section > > 6.3, page 153: > > > > 1. A socket is ready for reading if any of the following four conditions > > is true: > > > > a. The number of bytes of data in the socket receive buffer is greater > > than or equal to the curren

Re: renegotiating problem - connection hanging?

2006-06-20 Thread Mikhail Kruk
> > If anyone thinks that 'select' or 'poll' guarantees that a future > > operation > > will not block, even if it's a single operation, that's just plain not true. > > The only way you can guarantee that even one operation will not block is if > > you set the socket non-blocking. > > Really.

Re: renegotiating problem - connection hanging?

2006-06-20 Thread Mikhail Kruk
> > Well, if s_client is broken in the blocking mode maybe it should be > > removed completely. I did test it in the non-blocking mode and, of > > course, it does not have the described error. > > So are you saying the bug is: > > * in s_client (for not correctly handling the SSL layer APIs)

RE: renegotiating problem - connection hanging?

2006-06-20 Thread Mikhail Kruk
> If I understand correctly the original thread poster was explaining a > bug in using OpenSSL s_client triggered during a renegotiation (was this > client or server initiated? SGC related?). - client sends some data - server initiates renegotiation and immediately after that sends some data

Re: i am confused in PEM_read_PrivateKey

2006-06-13 Thread Mikhail Kruk
On Tue, 13 Jun 2006, Girish Venkatachalam wrote: > Sorry I was wrong. d2i indeed resolves to > d2i_RSAPrivateKey() which takes 3 parameters and > passes the first type parameter to d2i_PrivateKey() > which takes 4 parameters. > > But it beats me why I cannot find the definition of > d2i_RSAPriva

Re: renegotiating problem - connection hanging?

2006-06-11 Thread Mikhail Kruk
> On Mon, Jun 12, 2006 at 12:06:28AM +0200, Marek Marcola wrote: > > > In what way this break already used applications ??? > > In what way this break anything ??? > > SSL_read(3): > >If the underlying BIO is blocking, SSL_read() will only return, once >the read operation ha

RE: renegotiating problem - connection hanging?

2006-06-11 Thread Mikhail Kruk
> > In what way this break already used applications ??? > > In what way this break anything ??? [snip] > block. Fortunately for the original poster, he was able to detect this > problem and can now easily fix it by using non-blocking sockets. (And > with luck he won't make this same mistake wit

RE: renegotiating problem - connection hanging?

2006-06-10 Thread Mikhail Kruk
> > If you call SSL_read on a blocking socket when select says > > it is readable you expect it not to block [forever]. Of course > > it might block > > if there is some data available on the underlying socket but not > > enough to > > complete SSL deciphering, but under normal circumstances it wi

RE: renegotiating problem - connection hanging?

2006-06-10 Thread Mikhail Kruk
> The discussion below wherein the term "you're screwed" is used seems to > indicate that there is a deadlock situation, which isn't the case. There > may or may not be performance issues associated with the > scenario/use-case, but there's no deadlock. Did you look at my logs with s_client?

RE: renegotiating problem - connection hanging?

2006-06-10 Thread Mikhail Kruk
> > > Is your socket non-blocking? > > > No, socket is blocking. When I run s_client in non-blocking mode it > > doesn't get stuck. > > You can't use 'select' reliably with blocking sockets. Well, it is > possible > to do so, but it is extremely difficult and can only be done with OpenS

Re: renegotiating problem - connection hanging?

2006-06-09 Thread Mikhail Kruk
> > calling SSL_write > > after SSL_write: write 6 bytes, 0 > > select returned 1 fd, read: 1, write 0 > > calling SSL_read > > SSL_connect:SSL renegotiate ciphers > > SSL_connect:SSLv3 write client hello A > > SSL_connect:error in SSLv3 read server hello A > > after SSL_read: 9 bytes, 0 > Interest

RE: renegotiating problem - connection hanging?

2006-06-09 Thread Mikhail Kruk
> > I always call SSL_pending() before going into select(), as far as I > > understand that should be sufficient. Anyways, the server is not hanging > > in select(), it is definitely inside SSL_read(). > > Is your socket non-blocking? No, socket is blocking. When I run s_client in non-blo

Re: renegotiating problem - connection hanging?

2006-06-09 Thread Mikhail Kruk
> > I always call SSL_pending() before going into select(), as far as I > > understand that should be sufficient. Anyways, the server is not hanging > > in select(), it is definitely inside SSL_read(). > Ok, just checking :-) I think there is a bug in the library... I've added some debug printo

Re: renegotiating problem - connection hanging?

2006-06-09 Thread Mikhail Kruk
> > Would appreciate any advice on how to procede with debugging this. > As usual my suggestion is to add "-msg -debug" options to get more > information from openssl s_client. I get a bunch of binary data displayed but it seems to stop on the same line: SSL_connect:SSLv3 read finished A I'm now

renegotiating problem - connection hanging?

2006-06-09 Thread Mikhail Kruk
I have a custom server and openssl s_client -state -ssl3 connecting to it. The server uses blocking TCP sockets, no BIO. It all seems to be working fine. Now I'm trying to change the server to force renegotiations. The server uses select to determine when to start reading. When it is about to

Re: Calling Sequence of Nonblocking SSL_read() and SSL_write()

2006-05-15 Thread Mikhail Kruk
On Tue, 16 May 2006, Wei Li wrote: On Mon, 15 May 2006 21:40:22 -0400 (EDT), "Mikhail Kruk" <[EMAIL PROTECTED]> said: When using nonblocking BIO, can SSL_write(ssl, ...) be called right after a SSL_read(ssl, ...) "returned" SSL_ERROR_WANT_READ/WRITE? Or vice versa, pl

Re: Calling Sequence of Nonblocking SSL_read() and SSL_write()

2006-05-15 Thread Mikhail Kruk
Always assume that a non-blocking SSL_read and SSL_write can return both WANT_READ and WANT_WRITE. It's not as difficult as they want you to think. When using nonblocking BIO, can SSL_write(ssl, ...) be called right after a SSL_read(ssl, ...) "returned" SSL_ERROR_WANT_READ/WRITE? Or vice vers

Re: License to use openssl

2006-05-03 Thread Mikhail Kruk
http://www.openssl.org/support/faq.html#LEGAL This absolutely does not answer his question. On May 3, 2006, at 12:09 AM, Ambarish Mitra wrote: Hi all, A question on licensing issue: For using openssl libraries for commercial applications, is there any licensing issues? Do we have to attach

OpenSSL, EVP_Digests, memory allocations

2006-04-10 Thread Mikhail Kruk
I'm looking into very high number of memory allocations in our app using OpenSSL. We are doing a lot of SSL_write()s of small chunks of data and each call to SSL_write seems to result in a malloc. We are getting around 10 thousand CRYPTO_malloc() calls a second and I assume that this is very

Re: securing my client / server application

2006-03-15 Thread Mikhail Kruk
The name in the certificate will not be automatically verified for you. Your application has to verify that the name specified in the certificate somehow matches who your peer claims to be. So if client verifies a certificate of a server it should make sure that the name in certificate matches

Re: securing my client / server application

2006-03-14 Thread Mikhail Kruk
Thanks for your fast answer. Well I've just generated certificates with the machine names. And the problem is the same. Or maybe I'm still wrong with my certificates. The name in the certificate will not be automatically verified for you. Your application has to verify that the name specified

Windows certificate authorities list?

2006-03-02 Thread Mikhail Kruk
Hello, I want my application to trust certificates sign by the major CAs out there. Does anyone know of a way to hook up to the place where Windows stores its list of CAs? Or maybe just a place where I can download the keys of the standard CAs (like Verisign, Thawte...). Is there such thing

RE: SSL_write() crashes

2006-02-22 Thread Mikhail Kruk
On Wed, 22 Feb 2006, Dusty Hendrickson wrote: I've never really dealt with signals before, but I will definitely look into it. Thanks for the heads up. Any idea if there is a way to circumvent this in a cross-platform nature? #if defined(unix) {struct sigaction act; act.sa_handler = SIG_

Re: SSL_write returns SSL_ERROR_SYSCALL on win32

2006-02-14 Thread Mikhail Kruk
Um... sorry, please disregard the parent message. The application which I am adding the SSL support to insists on periodically sending a 0-byte buffer and apparently SSL_write() doesn't like being called with 0 bytes to send. I'd still call it a bug in OpenSSL (since error code is set incorre

SSL_write returns SSL_ERROR_SYSCALL on win32

2006-02-13 Thread Mikhail Kruk
Hi, I'm running the following setup: client and server, both using OpenSSL 0.9.8a on win2k3/win2k. Server is using blocking sockets, client is using non-blocking sockets. Periodically on the client SSL_write returns 0 and SSL_get_error() indicates SSL_ERROR_SYSCALL. If I read the docs right,