Re: function PEM_read_RSAPrivateKey not returning

2006-02-21 Thread William A. Rowe, Jr.

Matthias wrote:

Kyle Hamilton wrote:


Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
libeay32.dll?  Just running the uninstaller doesn't get rid of them.


No, I forgot that. Sorry, my fault.

I now replaced those two DLLs with the ones I compiled myself.

Good news: in Release mode my program works as expected.

Bad news: in Debug mode it crashes.


This is very typical of applications compiled under Microsoft compilers
where the library is built one way and the application is built another.

Please make certain your debug build of your consuming app and the library
match in cl.exe/link.exe flags, both debug, or both release.

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-21 Thread William A. Rowe, Jr.

Matthias wrote:

I deleted all ssl-related DLLs on my system now.

When I compile OpenSSL as described in INSTALL.W32, point the include 
library directory of my example program on openssl\out32dll, recompile 
my example program, copy the 2 DLLs from openssl\out32dll to my 
example project directory...
...then my example program will succeed when I run it in Release Mode 
but will crash when I run it in Debug Mode.


When I compile OpenSSL as described in INSTALLW32 with that tweak (*),
point the library include directory on openssl\out32dll.dbg, recompile 
my example program, copy the 2 DLLs from openssl\out32.dbg to my 
example project directory...

...then my example program will crash when I run it in Release Mode
but will succeed when I run it in Debug Mode (so just vice versa).

(*) tweak in file ms\do_masm.bat:
perl util\mk1mf.pl debug VC-WIN32 ms\nt.mak
perl util\mk1mf.pl debug dll VC-WIN32 ms\ntdll.mak

Surprisingly the DLLs have exactly the same size, no matter whether
compiled with that tweak or not. They are binary different though.


This is not a surprise.  Debug symbols land in a seperate file, but the
segment alignment means that minor changes to the compile process generally
create identically sized files.


libeay32.dll: 1.220.608 Bytes
ssleay32.dll:   249.856 Bytes

Despite many *.pdb files in the openssl\out32dll.dbg directory
I am unfortunately not able to produce a more nice call stack :(


You are looking for the result from the linker, probably libssl32.pdb
and libeay32.pdb, which you should move *WITH* the actual .dll files to
their final location.


So, result is that I have to use the LIBs and DLLs from out32dll
when compiling and running in Release mode and the LIBs and DLLs
from out32dll.dbg when compiling and running in Debug Mode.
In any other mixture it simply crashes. But at least it doesn't
just halt/loop anymore.


One most confusing thing is that MS actually has two -different- pdb
files.  One is a source program database, one is an executable program
database.  You want to locate the one with a name matching your .dll
files into the same location as the .dll that your application loads.
You also want to ensure that /ZI or /Zi is used to compile your app,
and /debug given to linking your app, so that you can unwind the stack
from the library into your app.  Finally, it also helps to turn off
optimization (/Od to the compiler) to make stacks more readable, and
I personally throw out the /Oy flag (/Oy- to force this) no matter what.
That flag causes the compiler not to build neat stack frames out of some
twisted desire for efficiency.  Even my release builds are /Zi /O2 /Oy-
to get all the optimizations but with stack frames and .pdb results,
and then linked with /debug /opt:ref.

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-21 Thread Kyle Hamilton
On 2/21/06, William A. Rowe, Jr. [EMAIL PROTECTED] wrote:
 One most confusing thing is that MS actually has two -different- pdb
 files.  One is a source program database, one is an executable program
 database.  You want to locate the one with a name matching your .dll
 files into the same location as the .dll that your application loads.
 You also want to ensure that /ZI or /Zi is used to compile your app,
 and /debug given to linking your app, so that you can unwind the stack
 from the library into your app.  Finally, it also helps to turn off
 optimization (/Od to the compiler) to make stacks more readable, and
 I personally throw out the /Oy flag (/Oy- to force this) no matter what.
 That flag causes the compiler not to build neat stack frames out of some
 twisted desire for efficiency.  Even my release builds are /Zi /O2 /Oy-
 to get all the optimizations but with stack frames and .pdb results,
 and then linked with /debug /opt:ref.

The only thing that /Oy will help is if you have what should really be
an inlined function, and then only one PUSH instruction.  It's akin to
the gcc option -fomit-frame-pointers, and I honestly believe that it
should never have been allowed in any ABI.

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Matthias

Kyle Hamilton wrote:


Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
libeay32.dll?  Just running the uninstaller doesn't get rid of them.


No, I forgot that. Sorry, my fault.

I now replaced those two DLLs with the ones I compiled myself.

Good news: in Release mode my program works as expected.

Bad news: in Debug mode it crashes.

-- snip --

11ef2068()  
libeay32.dll!10051bdd()
libeay32.dll!1004fc39()
libeay32.dll!1004fb8d()
libeay32.dll!100849fb()
kernel32.dll!7c81102e()
msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned 
int cnt=270647770)  Line 234 + 0x8	C
msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c, 
unsigned int cnt=1)  Line 87 + 0x9	C

msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
003f1fb8()  
msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001, 
unsigned int cnt=270542996)  Line 87 + 0x9	C
msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line 
180 + 0x11	C

msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int * 
pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int 
shflag=1244426, int pmode=273199175)  Line 414 + 0xd	C

msvcp71d.dll!std::_Fputcchar(char _Byte='
', _iobuf * _File=0x1048b047)  Line 69 + 0xfC++
msvcp71d.dll!std::basic_filebufchar,std::char_traitschar 
::overflow(int _Meta=32768)  Line 206 + 0x19	C++

0003()  
libeay32.dll!1005174d()
libeay32.dll!1004fdde()
libeay32.dll!10086c39()
libeay32.dll!10085490()
libeay32.dll!1008547d()
CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003f5a00)  Line 
82 + 0xf	C++

CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
kernel32.dll!7c816d4f()
ntdll.dll!7c925b4f()
kernel32.dll!7c8399f3()

-- snap --

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Kyle Hamilton
The best thing to do, when compiling, is to copy the DLLs to the
directory (either Debug or Release) that the rest of your project is
going to, and then create empty files named ssleay32.dll.local and
libeay32.dll.local in the same directory.  (This causes Windows to use
the versions of the files in the target directory instead of the
system directories.)

Are you compiling inside an IDE?  What C++ compiler are you using, and
what debugger?

-Kyle H

On 2/20/06, Matthias [EMAIL PROTECTED] wrote:
 Kyle Hamilton wrote:

  Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
  libeay32.dll?  Just running the uninstaller doesn't get rid of them.

 No, I forgot that. Sorry, my fault.

 I now replaced those two DLLs with the ones I compiled myself.

 Good news: in Release mode my program works as expected.

 Bad news: in Debug mode it crashes.

 -- snip --

 11ef2068()
 libeay32.dll!10051bdd()
 libeay32.dll!1004fc39()
 libeay32.dll!1004fb8d()
 libeay32.dll!100849fb()
 kernel32.dll!7c81102e()
 msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
 int cnt=270647770)  Line 234 + 0x8  C
 msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
 unsigned int cnt=1)  Line 87 + 0x9  C
 msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
 003f1fb8()
 msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
 unsigned int cnt=270542996)  Line 87 + 0x9  C
 msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
 180 + 0x11  C
 msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
 msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
 pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
 shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
 msvcp71d.dll!std::_Fputcchar(char _Byte='
 ', _iobuf * _File=0x1048b047)  Line 69 + 0xfC++
 msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
  ::overflow(int _Meta=32768)  Line 206 + 0x19  C++
 0003()
 libeay32.dll!1005174d()
 libeay32.dll!1004fdde()
 libeay32.dll!10086c39()
 libeay32.dll!10085490()
 libeay32.dll!1008547d()
 CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003f5a00)  Line
 82 + 0xfC++
 CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
 kernel32.dll!7c816d4f()
 ntdll.dll!7c925b4f()
 kernel32.dll!7c8399f3()

 -- snap --

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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Kyle Hamilton
Also, you didn't compile openssl in debug mode, otherwise the
libeay32.dll!(address)() calls in the stack would be showing the
function names.  To do so, you need to run:

perl Configure -d [VC-NT | VC-WIN32]

if you're running Visual C++.  The -d causes it to build for the debug
target, which does a couple of useful things like leave symbols in,
not do massive optimizations, leave frame pointers in place, that sort
of thing.

-Kyle H

On 2/20/06, Matthias [EMAIL PROTECTED] wrote:
 Kyle Hamilton wrote:

  Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
  libeay32.dll?  Just running the uninstaller doesn't get rid of them.

 No, I forgot that. Sorry, my fault.

 I now replaced those two DLLs with the ones I compiled myself.

 Good news: in Release mode my program works as expected.

 Bad news: in Debug mode it crashes.

 -- snip --

 11ef2068()
 libeay32.dll!10051bdd()
 libeay32.dll!1004fc39()
 libeay32.dll!1004fb8d()
 libeay32.dll!100849fb()
 kernel32.dll!7c81102e()
 msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
 int cnt=270647770)  Line 234 + 0x8  C
 msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
 unsigned int cnt=1)  Line 87 + 0x9  C
 msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
 003f1fb8()
 msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
 unsigned int cnt=270542996)  Line 87 + 0x9  C
 msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
 180 + 0x11  C
 msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
 msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
 pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
 shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
 msvcp71d.dll!std::_Fputcchar(char _Byte='
 ', _iobuf * _File=0x1048b047)  Line 69 + 0xfC++
 msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
  ::overflow(int _Meta=32768)  Line 206 + 0x19  C++
 0003()
 libeay32.dll!1005174d()
 libeay32.dll!1004fdde()
 libeay32.dll!10086c39()
 libeay32.dll!10085490()
 libeay32.dll!1008547d()
 CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003f5a00)  Line
 82 + 0xfC++
 CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
 kernel32.dll!7c816d4f()
 ntdll.dll!7c925b4f()
 kernel32.dll!7c8399f3()

 -- snap --

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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Kyle Hamilton
ignore this, I'm used to the POSIX-system variants. :P

-Kyle

On 2/20/06, Kyle Hamilton [EMAIL PROTECTED] wrote:
 Also, you didn't compile openssl in debug mode, otherwise the
 libeay32.dll!(address)() calls in the stack would be showing the
 function names.  To do so, you need to run:

 perl Configure -d [VC-NT | VC-WIN32]

 if you're running Visual C++.  The -d causes it to build for the debug
 target, which does a couple of useful things like leave symbols in,
 not do massive optimizations, leave frame pointers in place, that sort
 of thing.

 -Kyle H

 On 2/20/06, Matthias [EMAIL PROTECTED] wrote:
  Kyle Hamilton wrote:
 
   Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
   libeay32.dll?  Just running the uninstaller doesn't get rid of them.
 
  No, I forgot that. Sorry, my fault.
 
  I now replaced those two DLLs with the ones I compiled myself.
 
  Good news: in Release mode my program works as expected.
 
  Bad news: in Debug mode it crashes.
 
  -- snip --
 
  11ef2068()
  libeay32.dll!10051bdd()
  libeay32.dll!1004fc39()
  libeay32.dll!1004fb8d()
  libeay32.dll!100849fb()
  kernel32.dll!7c81102e()
  msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
  int cnt=270647770)  Line 234 + 0x8  C
  msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
  unsigned int cnt=1)  Line 87 + 0x9  C
  msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
  003f1fb8()
  msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
  unsigned int cnt=270542996)  Line 87 + 0x9  C
  msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
  180 + 0x11  C
  msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
  msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
  pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
  shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
  msvcp71d.dll!std::_Fputcchar(char _Byte='
  ', _iobuf * _File=0x1048b047)  Line 69 + 0xfC++
  msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
   ::overflow(int _Meta=32768)  Line 206 + 0x19  C++
  0003()
  libeay32.dll!1005174d()
  libeay32.dll!1004fdde()
  libeay32.dll!10086c39()
  libeay32.dll!10085490()
  libeay32.dll!1008547d()
  CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003f5a00)  Line
  82 + 0xfC++
  CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
  kernel32.dll!7c816d4f()
  ntdll.dll!7c925b4f()
  kernel32.dll!7c8399f3()
 
  -- snap --
 
  __
  OpenSSL Project http://www.openssl.org
  User Support Mailing Listopenssl-users@openssl.org
  Automated List Manager   [EMAIL PROTECTED]
 

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Kyle Hamilton
To get the debugging symbols for Windows, read the INSTALL.W32 file.
 Of particular note is this little gem:

There are various changes you can make to the Win32 compile environment. By
default the library is not compiled with debugging symbols. If you add 'debug'
to the mk1mf.pl lines in the do_* batch file then debugging symbols will be
compiled in. Note that mk1mf.pl expects the platform to be the last argument
on the command line, so 'debug' must appear before that, as all other options.

-Kyle H

On 2/20/06, Kyle Hamilton [EMAIL PROTECTED] wrote:
 ignore this, I'm used to the POSIX-system variants. :P

 -Kyle

 On 2/20/06, Kyle Hamilton [EMAIL PROTECTED] wrote:
  Also, you didn't compile openssl in debug mode, otherwise the
  libeay32.dll!(address)() calls in the stack would be showing the
  function names.  To do so, you need to run:
 
  perl Configure -d [VC-NT | VC-WIN32]
 
  if you're running Visual C++.  The -d causes it to build for the debug
  target, which does a couple of useful things like leave symbols in,
  not do massive optimizations, leave frame pointers in place, that sort
  of thing.
 
  -Kyle H
 
  On 2/20/06, Matthias [EMAIL PROTECTED] wrote:
   Kyle Hamilton wrote:
  
Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
libeay32.dll?  Just running the uninstaller doesn't get rid of them.
  
   No, I forgot that. Sorry, my fault.
  
   I now replaced those two DLLs with the ones I compiled myself.
  
   Good news: in Release mode my program works as expected.
  
   Bad news: in Debug mode it crashes.
  
   -- snip --
  
   11ef2068()
   libeay32.dll!10051bdd()
   libeay32.dll!1004fc39()
   libeay32.dll!1004fb8d()
   libeay32.dll!100849fb()
   kernel32.dll!7c81102e()
   msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
   int cnt=270647770)  Line 234 + 0x8  C
   msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
   unsigned int cnt=1)  Line 87 + 0x9  C
   msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
   003f1fb8()
   msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
   unsigned int cnt=270542996)  Line 87 + 0x9  C
   msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
   180 + 0x11  C
   msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
   msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
   pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
   shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
   msvcp71d.dll!std::_Fputcchar(char _Byte='
   ', _iobuf * _File=0x1048b047)  Line 69 + 0xfC++
   msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
::overflow(int _Meta=32768)  Line 206 + 0x19  C++
   0003()
   libeay32.dll!1005174d()
   libeay32.dll!1004fdde()
   libeay32.dll!10086c39()
   libeay32.dll!10085490()
   libeay32.dll!1008547d()
   CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003f5a00)  Line
   82 + 0xfC++
   CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
   kernel32.dll!7c816d4f()
   ntdll.dll!7c925b4f()
   kernel32.dll!7c8399f3()
  
   -- snap --
  
   __
   OpenSSL Project http://www.openssl.org
   User Support Mailing Listopenssl-users@openssl.org
   Automated List Manager   [EMAIL PROTECTED]
  
 

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Matthias

I deleted all ssl-related DLLs on my system now.

When I compile OpenSSL as described in INSTALL.W32, point the include 
library directory of my example program on openssl\out32dll, recompile 
my example program, copy the 2 DLLs from openssl\out32dll to my 
example project directory...
...then my example program will succeed when I run it in Release Mode 
but will crash when I run it in Debug Mode.


When I compile OpenSSL as described in INSTALLW32 with that tweak (*),
point the library include directory on openssl\out32dll.dbg, recompile 
my example program, copy the 2 DLLs from openssl\out32.dbg to my 
example project directory...

...then my example program will crash when I run it in Release Mode
but will succeed when I run it in Debug Mode (so just vice versa).

(*) tweak in file ms\do_masm.bat:
perl util\mk1mf.pl debug VC-WIN32 ms\nt.mak
perl util\mk1mf.pl debug dll VC-WIN32 ms\ntdll.mak

Surprisingly the DLLs have exactly the same size, no matter whether
compiled with that tweak or not. They are binary different though.

libeay32.dll: 1.220.608 Bytes
ssleay32.dll:   249.856 Bytes

Despite many *.pdb files in the openssl\out32dll.dbg directory
I am unfortunately not able to produce a more nice call stack :(

So, result is that I have to use the LIBs and DLLs from out32dll
when compiling and running in Release mode and the LIBs and DLLs
from out32dll.dbg when compiling and running in Debug Mode.
In any other mixture it simply crashes. But at least it doesn't
just halt/loop anymore.

Is it intended and/or expected like that?


Kyle Hamilton wrote:

 Are you compiling inside an IDE?  What C++ compiler are you using, and
 what debugger?

I am using Visual Studio .NET 2003 v7.0.3088 - no other compiler or
debugger is on my computer.

nmake spits out the following version information:

C:\myProjects\opensslnmake -f ms\ntdll.mak
Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.


Matthias


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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-20 Thread Kyle Hamilton
Are you making sure to link properly with the multithreaded libraries?
 (I think that was the default starting with VC++.net 2003, but I
can't recall.)

Incidentally, you can download a free ISO of VC++ 2005 Express Edition
from Microsoft.  The IDE doesn't support resource editing, but I'm
having no problems with it so far.

The debug libraries should have been put in out32dll.dbg\, as I recall
-- you may need to edit the settings for your debug versus release
builds to import from the correct version.  I don't have 2003, so I
can't test.

-Kyle H

On 2/20/06, Matthias [EMAIL PROTECTED] wrote:
 I deleted all ssl-related DLLs on my system now.

 When I compile OpenSSL as described in INSTALL.W32, point the include
 library directory of my example program on openssl\out32dll, recompile
 my example program, copy the 2 DLLs from openssl\out32dll to my
 example project directory...
 ...then my example program will succeed when I run it in Release Mode
 but will crash when I run it in Debug Mode.

 When I compile OpenSSL as described in INSTALLW32 with that tweak (*),
 point the library include directory on openssl\out32dll.dbg, recompile
 my example program, copy the 2 DLLs from openssl\out32.dbg to my
 example project directory...
 ...then my example program will crash when I run it in Release Mode
 but will succeed when I run it in Debug Mode (so just vice versa).

 (*) tweak in file ms\do_masm.bat:
 perl util\mk1mf.pl debug VC-WIN32 ms\nt.mak
 perl util\mk1mf.pl debug dll VC-WIN32 ms\ntdll.mak

 Surprisingly the DLLs have exactly the same size, no matter whether
 compiled with that tweak or not. They are binary different though.

 libeay32.dll: 1.220.608 Bytes
 ssleay32.dll:   249.856 Bytes

 Despite many *.pdb files in the openssl\out32dll.dbg directory
 I am unfortunately not able to produce a more nice call stack :(

 So, result is that I have to use the LIBs and DLLs from out32dll
 when compiling and running in Release mode and the LIBs and DLLs
 from out32dll.dbg when compiling and running in Debug Mode.
 In any other mixture it simply crashes. But at least it doesn't
 just halt/loop anymore.

 Is it intended and/or expected like that?


 Kyle Hamilton wrote:

   Are you compiling inside an IDE?  What C++ compiler are you using, and
   what debugger?

 I am using Visual Studio .NET 2003 v7.0.3088 - no other compiler or
 debugger is on my computer.

 nmake spits out the following version information:

 C:\myProjects\opensslnmake -f ms\ntdll.mak
 Microsoft (R) Program Maintenance Utility Version 7.10.3077
 Copyright (C) Microsoft Corporation.  All rights reserved.


 Matthias


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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-17 Thread Matthias

Did recompiling OpenSSL myself solve my problem with
PEM_read_RSAPrivateKey not returning?

Short answer: no.

Long answer: I did uninstall the precompiled binaries. Then I compiled
OpenSSL 0.9.8a (openssl-0.9.8a.tar.gz which is found at your website)
myself and tried my test program - but same symptoms, function simply
does nothing. Afterwards I compiled the latest snapshot
(openssl-0.9.8-stable-SNAP-20060217.tar.gz) but even there it does
not work - same problem again.

I really appreciate all your help here! Thanks.

Matthias

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-17 Thread Kyle Hamilton
Did you make sure to remove %SYSTEMROOT%\system32\ssleay32.dll and
libeay32.dll?  Just running the uninstaller doesn't get rid of them.

-Kyle H

On 2/17/06, Matthias [EMAIL PROTECTED] wrote:
 Did recompiling OpenSSL myself solve my problem with
 PEM_read_RSAPrivateKey not returning?

 Short answer: no.

 Long answer: I did uninstall the precompiled binaries. Then I compiled
 OpenSSL 0.9.8a (openssl-0.9.8a.tar.gz which is found at your website)
 myself and tried my test program - but same symptoms, function simply
 does nothing. Afterwards I compiled the latest snapshot
 (openssl-0.9.8-stable-SNAP-20060217.tar.gz) but even there it does
 not work - same problem again.

 I really appreciate all your help here! Thanks.

 Matthias

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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-16 Thread Matthias

Kyle Hamilton wrote:


msvcr71d.dll? That looks like a debug version of the VC library to me.


It was compiled and run in debug mode.


Incidentally, I'm getting the same problem on VC8 (VC++2005 Express
Edition).  And I'm getting it even in release configuration.


Somehow I am relieved and worried the same time that it affects not
only me...

Did you use the precompiled binaries or compiled yourself?
Do you consider it a bug?
Do you plan to fix it? (in case you are able to do so)

Bye,
Matthias


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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-16 Thread Dr. Stephen Henson
On Thu, Feb 16, 2006, Matthias wrote:

 
 Somehow I am relieved and worried the same time that it affects not
 only me...
 

I recently noticed a problem when attempting to use an OpenSSL DLL compiled
against Visual Studio 2005 with an OpenSSL application compiled with another
compiler.

When both application and DLL were compiled with Visual Studio 2005 there were
no problems.

So as I asked earlier: please try compiling a recent 0.9.8 snapshot of OpenSSL 
using the same version of VC++ and link your application to that.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: function PEM_read_RSAPrivateKey not returning

2006-02-16 Thread Kyle Hamilton
I was using the precompiled binaries when that test failed.

After I rebuilt the libraries with the VC8 compiler as Dr. Henson
suggested, it worked.

I consider it a bug in the Application Binary Interface of Windows,
not a bug that OpenSSL can work around.

-Kyle H

On 2/16/06, Matthias [EMAIL PROTECTED] wrote:
 Kyle Hamilton wrote:

  msvcr71d.dll? That looks like a debug version of the VC library to me.

 It was compiled and run in debug mode.

  Incidentally, I'm getting the same problem on VC8 (VC++2005 Express
  Edition).  And I'm getting it even in release configuration.

 Somehow I am relieved and worried the same time that it affects not
 only me...

 Did you use the precompiled binaries or compiled yourself?
 Do you consider it a bug?
 Do you plan to fix it? (in case you are able to do so)

 Bye,
 Matthias


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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-15 Thread Kyle Hamilton
One of the most important things about this is, when did you obtain
the installer from slproweb.com?  It's difficult to figure out if
it's older, or a problem in a very recent build, or what.

Did you attach a debugger to the program and examine it to see what
might be looping?

(In the meantime, I'm going to try this with VC++ 2005, 8.0).

-Kyle H

On 2/15/06, Matthias [EMAIL PROTECTED] wrote:
 Good day everyone!

 I do have the problem that the OpenSSL function PEM_read_RSAPrivateKey
 does nothing, not even returning. Since I can not find any more hints
 in the net I am asking here for help. I wrote a minimalistic example
 program and hope somebody can give me some advice based on that.

 I am using Visual Studio .net 2003 v7.1.3088 on Windows XP Pro SP 2.

 For OpenSSL I am using Win32 OpenSSL v0.9.8a, the precompiled and
 installer-packed binaries you can find under
 http://www.slproweb.com/products/Win32OpenSSL.html

 What I did:

 Visual Studio Application Wizard: Win32 Console Application,
 starting as empty project
 added Additional Include Directories: ..\openssl\include
 added Additional Library Directories: ..\openssl\lib\vc
 (NOT ..\openssl\lib\vc\static !)
 added Additional Dependencies: libeay32.lib ssleay32.lib
 set Runtime Library on Multi-threaded Debug DLL (/MDd) and
 Multi-threaded DLL (/MD)
 copied applink.c into project directory and added to VS project
 created new file example.cpp and added to VS project

  snip 

 // SSL
 #include openssl/ssl.h
 #include openssl/rand.h
 #include openssl/err.h
 #include openssl/rsa.h

 // STD
 #include iostream
 #include string
 #include iomanip
 using namespace std;

 // TCHAR
 #include tchar.h

 int _tmain(int argc, _TCHAR* argv[])
 {
// initialization
{
  SSL_load_error_strings();

  SSL_library_init();
  // note: replaces OpenSSL_add_all_algorithms() since 0.9.8a

  cout  Seed random number generator...  endl;
  const char SeedBuffer[16] = 123456789ABCDEF;
  RAND_seed(SeedBuffer, 16);
}

// generate and write keys
{
  cout  Generate RSA key...  endl;
  RSA* pRSA = RSA_generate_key(1024, 65537, NULL, NULL);
  if (pRSA == NULL)
  {
cout
   RSA_generate_key failed: 
   ERR_get_error()
   endl;
return false;
  }

  cout  Size:   RSA_size(pRSA) * 8   Bit  endl;

  FILE* pPrivateKeyFile = fopen(RSAPrivateKey.txt, w);
  if (pPrivateKeyFile == NULL)
  {
cout  fopen failed  endl;
return 1;
  }

  cout  Write private key file...  endl;
  if (PEM_write_RSAPrivateKey(
pPrivateKeyFile, pRSA, NULL, NULL, 0, NULL, NULL) == 0)
  {
cout
   PEM_write_RSAPrivateKey failed: 
   ERR_get_error()
   endl;
return 1;
  }

  fclose(pPrivateKeyFile);

  // note: file RSAPrivateKey.txt now exists, is plaintext
  // and obviously contains a key

}

// read keys
{
  FILE* pPrivateKeyFile = fopen(RSAPrivateKey.txt, r);
  if (pPrivateKeyFile == NULL)
  {
cout  fopen failed  endl;
return 1;
  }

  cout  Read private key file...  endl;
  RSA* pPrivateKeyRSA = PEM_read_RSAPrivateKey(
pPrivateKeyFile, NULL, NULL, NULL);

  // ! program never comes here !

  // note: I tried every combination of callback function
  // for the password but the program never got there, too

  if (pPrivateKeyRSA == NULL)
  {
cout
   PEM_read_RSAPrivateKey failed: 
   ERR_get_error()
   endl;
return 1;
  }

  fclose(pPrivateKeyFile);

  cout
 Size:   RSA_size(pPrivateKeyRSA) * 8   Bit
 endl;
}

cout  Done.  endl;
return 0;
 }

  snap 

 Thanks,
 Matthias

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

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


Re: function PEM_read_RSAPrivateKey not returning

2006-02-15 Thread Matthias

Hi again

I downloaded from slproweb at 9. February 2006 and the file
is called Win32OpenSSL-v0.9.8a.exe. I didn't have any
OpenSSL stuff on my computer before, so even no old things
lieing around on the harddisc.

If I run the program in VS .net 2003 v7.1.3088 with Start F5
the program seems to freeze at PEM_read_RSAPrivateKey,
consumes 100% usage of one CPU (I have a Hyperthreading so
I see 50% CPU usage in task manager) and when I press
Break All in the Debugger I get the following call stack:

-- snip --

msvcrt.dll!77c12b9f()
ntdll.dll!7c9206eb()
ntdll.dll!7c97d886()
ntdll.dll!7c959d18()
ntdll.dll!7c92b686()
ntdll.dll!7c936a44()
ntdll.dll!7c936abe()
ntdll.dll!7c936abe()
ntdll.dll!7c97cde9()
ntdll.dll!7c97e0f0()
ntdll.dll!7c97e0d4()
ntdll.dll!7c92b5f4()
ntdll.dll!7c92b686()
ntdll.dll!7c936abe()
ntdll.dll!7c97cde9()
ntdll.dll!7c97e0f0()
ntdll.dll!7c95a1f5()
ntdll.dll!7c92b5f4()
ntdll.dll!7c92b686()
kernel32.dll!7c81cb8e()
kernel32.dll!7c81cbcb()
ntdll.dll!7c91e3ed()
ntdll.dll!7c9232f8()
kernel32.dll!7c81cb8e()
kernel32.dll!7c81cbcb()
msvcrt.dll!77c0f962()
msvcrt.dll!77bfc3ce()
libeay32.dll!1000101e()
libeay32.dll!1000120c()
libeay32.dll!1003f487()
libeay32.dll!1003d627()
libeay32.dll!10068404()
msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned 
int cnt=270647770)  Line 234 + 0x8	C
msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c, 
unsigned int cnt=1)  Line 87 + 0x9	C

msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
003e1fb8()  
msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001, 
unsigned int cnt=270542996)  Line 87 + 0x9	C
msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line 
180 + 0x11	C

msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int * 
pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int 
shflag=1244426, int pmode=273199175)  Line 414 + 0xd	C
msvcp71d.dll!std::_Fputcchar(char _Byte='STRANGEBOXHERE', _iobuf * 
_File=0x1048b047)  Line 69 + 0xf	C++
msvcp71d.dll!std::basic_filebufchar,std::char_traitschar 
::overflow(int _Meta=268693911)  Line 206 + 0x19	C++

msvcrt.dll!77bffc5d()
libeay32.dll!1003d861()
libeay32.dll!1006a15a()
libeay32.dll!1006a4d6()
libeay32.dll!10068cf8()
CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003e5a40)  Line 
82 + 0xf	C++

CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
kernel32.dll!7c816d4f()
ntdll.dll!7c925b4f()
kernel32.dll!7c8399f3()

-- snap --

That CryptoOpenSSLTest5.exe!main [...] Line 82 is the call of
PEM_read_RSAPrivateKey. STRANGEBOXHERE is that strange box
for undisplayable characters.

Thanks for the help,
Matthias



Kyle Hamilton wrote:


One of the most important things about this is, when did you obtain
the installer from slproweb.com?  It's difficult to figure out if
it's older, or a problem in a very recent build, or what.

Did you attach a debugger to the program and examine it to see what
might be looping?

(In the meantime, I'm going to try this with VC++ 2005, 8.0).

-Kyle H

On 2/15/06, Matthias [EMAIL PROTECTED] wrote:

Good day everyone!

I do have the problem that the OpenSSL function PEM_read_RSAPrivateKey
does nothing, not even returning. Since I can not find any more hints
in the net I am asking here for help. I wrote a minimalistic example
program and hope somebody can give me some advice based on that.

I am using Visual Studio .net 2003 v7.1.3088 on Windows XP Pro SP 2.

For OpenSSL I am using Win32 OpenSSL v0.9.8a, the precompiled and
installer-packed binaries you can find under
http://www.slproweb.com/products/Win32OpenSSL.html

What I did:

Visual Studio Application Wizard: Win32 Console Application,
starting as empty project
added Additional Include Directories: ..\openssl\include
added Additional Library Directories: ..\openssl\lib\vc
(NOT ..\openssl\lib\vc\static !)
added Additional Dependencies: libeay32.lib ssleay32.lib
set Runtime Library on Multi-threaded Debug DLL (/MDd) and
Multi-threaded DLL (/MD)
copied applink.c into project directory and added to VS project
created new file example.cpp and added to VS project

 snip 

// SSL
#include openssl/ssl.h
#include openssl/rand.h
#include openssl/err.h
#include openssl/rsa.h

// STD
#include iostream
#include string
#include iomanip
using namespace std;

// TCHAR
#include tchar.h

int _tmain(int argc, _TCHAR* argv[])
{
   // initialization
   {
 SSL_load_error_strings();

 SSL_library_init();
 // note: replaces OpenSSL_add_all_algorithms() since 0.9.8a

 cout  Seed random number generator...  endl;
 const char SeedBuffer[16] = 123456789ABCDEF;
 RAND_seed(SeedBuffer, 16);
   }

   // generate and write keys
   {
 cout  Generate RSA key...  endl;
 RSA* pRSA = RSA_generate_key(1024, 65537, NULL, NULL);
 if (pRSA == NULL)
 {
   cout
  RSA_generate_key 

RE: function PEM_read_RSAPrivateKey not returning

2006-02-15 Thread Ambarish Mitra

Your stack trace points to a release version of MS libraries. Please ensure
that you run the release version of your program.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Matthias
Sent: Wednesday, February 15, 2006 4:24 PM
To: openssl-users@openssl.org
Subject: Re: function PEM_read_RSAPrivateKey not returning


Hi again

I downloaded from slproweb at 9. February 2006 and the file
is called Win32OpenSSL-v0.9.8a.exe. I didn't have any
OpenSSL stuff on my computer before, so even no old things
lieing around on the harddisc.

If I run the program in VS .net 2003 v7.1.3088 with Start F5
the program seems to freeze at PEM_read_RSAPrivateKey,
consumes 100% usage of one CPU (I have a Hyperthreading so
I see 50% CPU usage in task manager) and when I press
Break All in the Debugger I get the following call stack:

-- snip --

msvcrt.dll!77c12b9f()
ntdll.dll!7c9206eb()
ntdll.dll!7c97d886()
ntdll.dll!7c959d18()
ntdll.dll!7c92b686()
ntdll.dll!7c936a44()
ntdll.dll!7c936abe()
ntdll.dll!7c936abe()
ntdll.dll!7c97cde9()
ntdll.dll!7c97e0f0()
ntdll.dll!7c97e0d4()
ntdll.dll!7c92b5f4()
ntdll.dll!7c92b686()
ntdll.dll!7c936abe()
ntdll.dll!7c97cde9()
ntdll.dll!7c97e0f0()
ntdll.dll!7c95a1f5()
ntdll.dll!7c92b5f4()
ntdll.dll!7c92b686()
kernel32.dll!7c81cb8e()
kernel32.dll!7c81cbcb()
ntdll.dll!7c91e3ed()
ntdll.dll!7c9232f8()
kernel32.dll!7c81cb8e()
kernel32.dll!7c81cbcb()
msvcrt.dll!77c0f962()
msvcrt.dll!77bfc3ce()
libeay32.dll!1000101e()
libeay32.dll!1000120c()
libeay32.dll!1003f487()
libeay32.dll!1003d627()
libeay32.dll!10068404()
msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
int cnt=270647770)  Line 234 + 0x8  C
msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
unsigned int cnt=1)  Line 87 + 0x9  C
msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
003e1fb8()
msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
unsigned int cnt=270542996)  Line 87 + 0x9  C
msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
180 + 0x11  C
msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
msvcp71d.dll!std::_Fputcchar(char _Byte='STRANGEBOXHERE', _iobuf *
_File=0x1048b047)  Line 69 + 0xfC++
msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
 ::overflow(int _Meta=268693911)  Line 206 + 0x19  C++
msvcrt.dll!77bffc5d()
libeay32.dll!1003d861()
libeay32.dll!1006a15a()
libeay32.dll!1006a4d6()
libeay32.dll!10068cf8()
CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003e5a40)  Line
82 + 0xfC++
CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
kernel32.dll!7c816d4f()
ntdll.dll!7c925b4f()
kernel32.dll!7c8399f3()

-- snap --

That CryptoOpenSSLTest5.exe!main [...] Line 82 is the call of
PEM_read_RSAPrivateKey. STRANGEBOXHERE is that strange box
for undisplayable characters.

Thanks for the help,
Matthias



Kyle Hamilton wrote:

 One of the most important things about this is, when did you obtain
 the installer from slproweb.com?  It's difficult to figure out if
 it's older, or a problem in a very recent build, or what.

 Did you attach a debugger to the program and examine it to see what
 might be looping?

 (In the meantime, I'm going to try this with VC++ 2005, 8.0).

 -Kyle H

 On 2/15/06, Matthias [EMAIL PROTECTED] wrote:
 Good day everyone!

 I do have the problem that the OpenSSL function PEM_read_RSAPrivateKey
 does nothing, not even returning. Since I can not find any more hints
 in the net I am asking here for help. I wrote a minimalistic example
 program and hope somebody can give me some advice based on that.

 I am using Visual Studio .net 2003 v7.1.3088 on Windows XP Pro SP 2.

 For OpenSSL I am using Win32 OpenSSL v0.9.8a, the precompiled and
 installer-packed binaries you can find under
 http://www.slproweb.com/products/Win32OpenSSL.html

 What I did:

 Visual Studio Application Wizard: Win32 Console Application,
 starting as empty project
 added Additional Include Directories: ..\openssl\include
 added Additional Library Directories: ..\openssl\lib\vc
 (NOT ..\openssl\lib\vc\static !)
 added Additional Dependencies: libeay32.lib ssleay32.lib
 set Runtime Library on Multi-threaded Debug DLL (/MDd) and
 Multi-threaded DLL (/MD)
 copied applink.c into project directory and added to VS project
 created new file example.cpp and added to VS project

  snip 

 // SSL
 #include openssl/ssl.h
 #include openssl/rand.h
 #include openssl/err.h
 #include openssl/rsa.h

 // STD
 #include iostream
 #include string
 #include iomanip
 using namespace std;

 // TCHAR
 #include tchar.h

 int _tmain(int argc, _TCHAR* argv[])
 {
// initialization
{
  SSL_load_error_strings

Re: function PEM_read_RSAPrivateKey not returning

2006-02-15 Thread Dr. Stephen Henson
On Wed, Feb 15, 2006, Matthias wrote:

 Good day everyone!
 
 I do have the problem that the OpenSSL function PEM_read_RSAPrivateKey
 does nothing, not even returning. Since I can not find any more hints
 in the net I am asking here for help. I wrote a minimalistic example
 program and hope somebody can give me some advice based on that.
 
 I am using Visual Studio .net 2003 v7.1.3088 on Windows XP Pro SP 2.
 
 For OpenSSL I am using Win32 OpenSSL v0.9.8a, the precompiled and
 installer-packed binaries you can find under
 http://www.slproweb.com/products/Win32OpenSSL.html
 

Try compiling a recent 0.9.8 snapshot using that version of Visual Studio.

Then try your program when you link against that.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   [EMAIL PROTECTED]


Re: function PEM_read_RSAPrivateKey not returning

2006-02-15 Thread Kyle Hamilton
msvcr71d.dll?  That looks like a debug version of the VC library to me.

Incidentally, I'm getting the same problem on VC8 (VC++2005 Express
Edition).  And I'm getting it even in release configuration.

-Kyle H

On 2/15/06, Ambarish Mitra [EMAIL PROTECTED] wrote:

 Your stack trace points to a release version of MS libraries. Please ensure
 that you run the release version of your program.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Matthias
 Sent: Wednesday, February 15, 2006 4:24 PM
 To: openssl-users@openssl.org
 Subject: Re: function PEM_read_RSAPrivateKey not returning


 Hi again

 I downloaded from slproweb at 9. February 2006 and the file
 is called Win32OpenSSL-v0.9.8a.exe. I didn't have any
 OpenSSL stuff on my computer before, so even no old things
 lieing around on the harddisc.

 If I run the program in VS .net 2003 v7.1.3088 with Start F5
 the program seems to freeze at PEM_read_RSAPrivateKey,
 consumes 100% usage of one CPU (I have a Hyperthreading so
 I see 50% CPU usage in task manager) and when I press
 Break All in the Debugger I get the following call stack:

 -- snip --

 msvcrt.dll!77c12b9f()
 ntdll.dll!7c9206eb()
 ntdll.dll!7c97d886()
 ntdll.dll!7c959d18()
 ntdll.dll!7c92b686()
 ntdll.dll!7c936a44()
 ntdll.dll!7c936abe()
 ntdll.dll!7c936abe()
 ntdll.dll!7c97cde9()
 ntdll.dll!7c97e0f0()
 ntdll.dll!7c97e0d4()
 ntdll.dll!7c92b5f4()
 ntdll.dll!7c92b686()
 ntdll.dll!7c936abe()
 ntdll.dll!7c97cde9()
 ntdll.dll!7c97e0f0()
 ntdll.dll!7c95a1f5()
 ntdll.dll!7c92b5f4()
 ntdll.dll!7c92b686()
 kernel32.dll!7c81cb8e()
 kernel32.dll!7c81cbcb()
 ntdll.dll!7c91e3ed()
 ntdll.dll!7c9232f8()
 kernel32.dll!7c81cb8e()
 kernel32.dll!7c81cbcb()
 msvcrt.dll!77c0f962()
 msvcrt.dll!77bfc3ce()
 libeay32.dll!1000101e()
 libeay32.dll!1000120c()
 libeay32.dll!1003f487()
 libeay32.dll!1003d627()
 libeay32.dll!10068404()
 msvcr71d.dll!_write_lk(int fh=1, const void * buf=0x0fa0, unsigned
 int cnt=270647770)  Line 234 + 0x8  C
 msvcr71d.dll!_write(int fh=1244344, const void * buf=0x1021b45c,
 unsigned int cnt=1)  Line 87 + 0x9  C
 msvcr71d.dll!_unlock_fhandle(int fh=1244344)  Line 477  C
 003e1fb8()
 msvcr71d.dll!_write(int fh=1244392, const void * buf=0x0001,
 unsigned int cnt=270542996)  Line 87 + 0x9  C
 msvcr71d.dll!_flsbuf(int ch=271042648, _iobuf * str=0x1024755c)  Line
 180 + 0x11  C
 msvcr71d.dll!fputc(int ch=10, _iobuf * str=0x1027c858)  Line 56 + 0x9   C
 msvcr71d.dll!_tsopen_lk(int * punlock_flag=0x000a, int *
 pfh=0x1027c858, const char * path=0x0012fdb8, int oflag=273198671, int
 shflag=1244426, int pmode=273199175)  Line 414 + 0xdC
 msvcp71d.dll!std::_Fputcchar(char _Byte='STRANGEBOXHERE', _iobuf *
 _File=0x1048b047)  Line 69 + 0xfC++
 msvcp71d.dll!std::basic_filebufchar,std::char_traitschar
  ::overflow(int _Meta=268693911)  Line 206 + 0x19  C++
 msvcrt.dll!77bffc5d()
 libeay32.dll!1003d861()
 libeay32.dll!1006a15a()
 libeay32.dll!1006a4d6()
 libeay32.dll!10068cf8()
 CryptoOpenSSLTest5.exe!main(int argc=1, char * * argv=0x003e5a40)  Line
 82 + 0xfC++
 CryptoOpenSSLTest5.exe!mainCRTStartup()  Line 398 + 0x11C
 kernel32.dll!7c816d4f()
 ntdll.dll!7c925b4f()
 kernel32.dll!7c8399f3()

 -- snap --

 That CryptoOpenSSLTest5.exe!main [...] Line 82 is the call of
 PEM_read_RSAPrivateKey. STRANGEBOXHERE is that strange box
 for undisplayable characters.

 Thanks for the help,
 Matthias



 Kyle Hamilton wrote:

  One of the most important things about this is, when did you obtain
  the installer from slproweb.com?  It's difficult to figure out if
  it's older, or a problem in a very recent build, or what.
 
  Did you attach a debugger to the program and examine it to see what
  might be looping?
 
  (In the meantime, I'm going to try this with VC++ 2005, 8.0).
 
  -Kyle H
 
  On 2/15/06, Matthias [EMAIL PROTECTED] wrote:
  Good day everyone!
 
  I do have the problem that the OpenSSL function PEM_read_RSAPrivateKey
  does nothing, not even returning. Since I can not find any more hints
  in the net I am asking here for help. I wrote a minimalistic example
  program and hope somebody can give me some advice based on that.
 
  I am using Visual Studio .net 2003 v7.1.3088 on Windows XP Pro SP 2.
 
  For OpenSSL I am using Win32 OpenSSL v0.9.8a, the precompiled and
  installer-packed binaries you can find under
  http://www.slproweb.com/products/Win32OpenSSL.html
 
  What I did:
 
  Visual Studio Application Wizard: Win32 Console Application,
  starting as empty project
  added Additional Include Directories: ..\openssl\include
  added Additional Library Directories: ..\openssl\lib\vc
  (NOT ..\openssl\lib\vc\static !)
  added Additional Dependencies: libeay32.lib ssleay32.lib
  set Runtime Library on Multi-threaded Debug DLL (/MDd) and
  Multi-threaded DLL (/MD)
  copied applink.c into project directory and added to VS project
  created new file example.cpp and added to VS