2

I'm using Axis2C with OpenSSL in VC++ 2008 to access an https webservice. Whenever the actual communication is taking place I get a runtime fatal exception :

OPENSSL_UPLINK: no OPENSSL_APPLINK.

I read that there are several things you should do, such as link in the applink.c file to my application. I did that, (using extern "C"), and I also call CRYPTO_malloc_init. Both of them are ineffective.. I'm kind of lost here.

What else should I be checking? also, does anybody know why axis2c sometimes writes to the axis.log file, and sometimes not?

Thanks!

Roey.

Roey
  • 99
  • 5
  • 12

3 Answers3

4

I had a similar problem, using OpenSSL 1.0.1e (precompiled for Win32 from http://slproweb.com/products/Win32OpenSSL.html ).

I'm not sure what the root cause was, but the problem went away when I rebuilt my application using the static libraries for VC, instead of the DLL libraries.

In other words, this library here failed for me:

C:\OpenSSL-Win32\lib\libeay32.lib

But linking again this library succeeded

C:\OpenSSL-Win32\lib\VC\static\libeay32MD.lib

It's possibly related to incompatibilities with other libraries (see http://forums.epo.org/installation-and-maintenance/topic1373.html) as far as I could tell, my application only used the libeay32 library.

In addition, it had to do with the PEM handling. I was able to generate an RSA key, but I couldn't write it, when I linked against the DLL instead of statically.

Mark Lakata
  • 19,989
  • 5
  • 106
  • 123
  • +1 for "PEM handling". That got me to realize that I was pointing at a non-existent cert file, which made the error go away! – Mike Ounsworth Jul 31 '15 at 04:15
2

This might be due to the compile flags. Here is the description how you can compile Axis2c + OpenSSL 64 Bit on Windows.

Create Axis2c 64 Bit with OpenSSL

Versions:

  • Axis2c 1.6.0
  • OpenSSL 1.0.0d

Prerequisites:

  • Perl 5 (64 bit version)

Perl should be in the %PATH% system environment variable

OpenSSL

Configure and compile OpenSSL:

cd <openssl_root_dir> (e.g. C:\tmp\openssl-1.0.0b)
perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak
cd out32dll
..\ms\test

For preventing additional changes in the Axis2c makefile, copy the files to following dir-structure:

<openssl_root_dir>/bin (libeay32.dll, ssleay32.dll)
<openssl_root_dir>/lib  libeay32.lib, ssleay32.lib)
<openssl_root_dir>/include/openssl (all *.h, *.c files)

Axis2c

Configure Axis2C

Change the following settings in \build\win32\configure.in:

ENABLE_SSL = 1 OPENSSL_BIN_DIR =
<openssl_root_dir> (e.g.
C:\tmp\openssl-1.0.0b) CRUNTIME = /MD
EMBED_MANIFEST = 1

Change the following settings in \build\win32\makefile:

LDFLAGS = $(LDFLAGS) /LIBPATH:$(OPENSSL_BIN_DIR)\lib
LIBS = $(LIBS) libeay32.lib ssleay32.lib

Compile Axis2C cd \build\win32 nmake install

All encessary files are into the folder: \build\deploy

The 2 OpenSSL dll files (libeay32.dll, ssleay32.dll) might be copied to the deploy\lib sub folder manually.

JumbleNerd
  • 21
  • 2
1

According to openssl faq:

As per 0.9.8 the above limitation is eliminated for .DLLs. OpenSSL .DLLs compiled with some specific run-time option [we insist on the default /MD] can be deployed with application compiled with different option or even different compiler. But there is a catch! Instead of re-compiling OpenSSL toolkit, as you would have to with prior versions, you have to compile small C snippet with compiler and/or options of your choice. The snippet gets installed as /include/openssl/applink.c and should be either added to your application project or simply #include-d in one [and only one] of your application source files. Failure to link this shim module into your application manifests itself as fatal "no OPENSSL_Applink" run-time error. An explicit reminder is due that in this situation [mixing compiler options] it is as important to add CRYPTO_malloc_init prior first call to OpenSSL.

So just include applink.c in your project & enjoy!

Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87