RE: crash when calling ERR_print_errors_fp()
From: owner-openssl-us...@openssl.org On Behalf Of Mithun Kumar Sent: Thursday, 06 September, 2012 16:29 When i give file pointer as input to API(ERR_print_errors_fp()) nothing is getting written to the FILE during a SSL handshake failure. Any inputs why things are failing. If you are on Windows and app doesn't have OpenSSL_applink, OpenSSL won't (can't) write to the file, but it should give a message on stderr and should not crash. http://www.openssl.org/support/faq.html#PROG2 at the end. On all systems make sure the fp is open (for write) before, and is flushed or closed after. __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
RE: crash when calling ERR_print_errors_fp()
Try ERR_print_errors_fp(stderr) -- eliminates issues with your file. If that works, then it's your file pointer. Note Dave's point about flushing the file. Charles -Original Message- From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Dave Thompson Sent: Thursday, September 06, 2012 4:46 PM To: openssl-users@openssl.org Subject: RE: crash when calling ERR_print_errors_fp() From: owner-openssl-us...@openssl.org On Behalf Of Mithun Kumar Sent: Thursday, 06 September, 2012 16:29 When i give file pointer as input to API(ERR_print_errors_fp()) nothing is getting written to the FILE during a SSL handshake failure. Any inputs why things are failing. If you are on Windows and app doesn't have OpenSSL_applink, OpenSSL won't (can't) write to the file, but it should give a message on stderr and should not crash. http://www.openssl.org/support/faq.html#PROG2 at the end. On all systems make sure the fp is open (for write) before, and is flushed or closed after. __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
RE: crash when calling ERR_print_errors_fp()
Your message suggests to me that you are calling the API and expecting it to cause subsequent errors to be written to the FILE. It doesn't work like that; the messages won't be written to the file during the handshake. The API writes out any messages which are queued up in the internal message buffers. You need to call the API after the handshake failure to dump out the errors which have been buffered internally. Regards, jjf From: Mithun Kumar [mailto:mithunsi...@gmail.com] Sent: Thursday, September 06, 2012 9:29 PM To: openssl-users@openssl.org; openssl-...@openssl.org Subject: crash when calling ERR_print_errors_fp() Hello All, When i give file pointer as input to API(ERR_print_errors_fp()) nothing is getting written to the FILE during a SSL handshake failure. Any inputs why things are failing. -mithun
Re: crash when calling ERR_print_errors_fp()
Thanks All, I am currently on Linux and trying to write to a file after the handshake has failed. But i dont see anything written to a file. using stderr instead of file pointer be of some help? -mithun On Fri, Sep 7, 2012 at 5:58 AM, Jeremy Farrell jeremy.farr...@oracle.comwrote: Your message suggests to me that you are calling the API and expecting it to cause subsequent errors to be written to the FILE. It doesn't work like that; the messages won't be written to the file during the handshake. The API writes out any messages which are queued up in the internal message buffers. You need to call the API after the handshake failure to dump out the errors which have been buffered internally. ** ** Regards, jjf ** ** *From:* Mithun Kumar [mailto:mithunsi...@gmail.com] *Sent:* Thursday, September 06, 2012 9:29 PM *To:* openssl-users@openssl.org; openssl-...@openssl.org *Subject:* crash when calling ERR_print_errors_fp() ** ** Hello All, When i give file pointer as input to API(ERR_print_errors_fp()) nothing is getting written to the FILE during a SSL handshake failure. Any inputs why things are failing. -mithun
Re: crash when calling ERR_print_errors_fp()
i could see following method failing.. uplink.c :19 static void unimplemented (void) { OPENSSL_showfatal (sizeof(TCHAR)==sizeof(char)?%s\n:%S\n,msg); ExitProcess (1);//causing crash } On Thu, Aug 30, 2012 at 3:25 PM, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun
Re: crash when calling ERR_print_errors_fp()
is as simple as below const *errString = ERR_error_string(ERR_get_error(), NULL)); On 8/30/12, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: crash when calling ERR_print_errors_fp()
Thanks for the quick reply. I could see that following condition compiler flag is used OPENSSL_USE_APPLINK causing the problem. Any idea why this flag is used? -mithun On Thu, Aug 30, 2012 at 3:58 PM, Saurabh Pandya er.saurabhpan...@gmail.comwrote: is as simple as below const *errString = ERR_error_string(ERR_get_error(), NULL)); On 8/30/12, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: crash when calling ERR_print_errors_fp()
How do you identified that the dame flag is causing problem On Aug 30, 2012 4:49 PM, Mithun Kumar mithunsi...@gmail.com wrote: Thanks for the quick reply. I could see that following condition compiler flag is used OPENSSL_USE_APPLINK causing the problem. Any idea why this flag is used? -mithun On Thu, Aug 30, 2012 at 3:58 PM, Saurabh Pandya er.saurabhpan...@gmail.com wrote: is as simple as below const *errString = ERR_error_string(ERR_get_error(), NULL)); On 8/30/12, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: crash when calling ERR_print_errors_fp()
i am extremely sorry. its BIO_FLAGS_UPLINK flag. On Thu, Aug 30, 2012 at 5:24 PM, Saurabh Pandya er.saurabhpan...@gmail.comwrote: How do you identified that the dame flag is causing problem On Aug 30, 2012 4:49 PM, Mithun Kumar mithunsi...@gmail.com wrote: Thanks for the quick reply. I could see that following condition compiler flag is used OPENSSL_USE_APPLINK causing the problem. Any idea why this flag is used? -mithun On Thu, Aug 30, 2012 at 3:58 PM, Saurabh Pandya er.saurabhpan...@gmail.com wrote: is as simple as below const *errString = ERR_error_string(ERR_get_error(), NULL)); On 8/30/12, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
Re: crash when calling ERR_print_errors_fp()
Its in cryptlib.h #ifdef OPENSSL_USE_APPLINK #define BIO_FLAGS_UPLINK 0x8000 #include ms/uplink.h #endif On Thu, Aug 30, 2012 at 6:00 PM, Mithun Kumar mithunsi...@gmail.com wrote: i am extremely sorry. its BIO_FLAGS_UPLINK flag. On Thu, Aug 30, 2012 at 5:24 PM, Saurabh Pandya er.saurabhpan...@gmail.com wrote: How do you identified that the dame flag is causing problem On Aug 30, 2012 4:49 PM, Mithun Kumar mithunsi...@gmail.com wrote: Thanks for the quick reply. I could see that following condition compiler flag is used OPENSSL_USE_APPLINK causing the problem. Any idea why this flag is used? -mithun On Thu, Aug 30, 2012 at 3:58 PM, Saurabh Pandya er.saurabhpan...@gmail.com wrote: is as simple as below const *errString = ERR_error_string(ERR_get_error(), NULL)); On 8/30/12, Mithun Kumar mithunsi...@gmail.com wrote: Hello All, I am using the function ERR_print_errors_fp() to get the last error in case of any failure. I want to divert the output to file. When ever there is a handshake failure application crashes. If handshake is successful i don't see any crash. Any idea where things are going wrong. -mithun __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org
RE: crash when calling ERR_print_errors_fp()
From: owner-openssl-us...@openssl.org On Behalf Of Mithun Kumar Sent: Thursday, 30 August, 2012 08:32 cryptlib.h #ifdef OPENSSL_USE_APPLINK #define BIO_FLAGS_UPLINK 0x8000 #include ms/uplink.h #endif On Thu, Aug 30, 2012 at 6:00 PM, Mithun Kumar mithunsi...@gmail.com wrote: i am extremely sorry. its BIO_FLAGS_UPLINK flag. These are related. USE_APPLINK says if the OS needs special handling for file I/O in library versus main, currently only Windows (for DLL and MS LIB*/MSVCRT). BIO_UPLINK says if that handling applies to specific BIO. If on Windows do you #include applink.c in your app? http://www.openssl.org/support/faq.html#PROG2 Alternatively use a file-BIO opened by name (not C fileptr); or do the ERR_get_error/ERR_string/etc yourself as another reply suggested (although that's a little more work). __ OpenSSL Project http://www.openssl.org User Support Mailing Listopenssl-users@openssl.org Automated List Manager majord...@openssl.org