Warning: loads of Win32-specific information inside. Proceed at your own
risk!

If by making it run via ASP/IIS you mean having it accessible from
Visual Basic/VBScript I'm afraid there's quite a bit of manual tweaking
that will have to be done.

In order for C functions to be at all usable from Visual Basic they
can't use the standard C calling convention. I can't really claim to
understand the logic behind this, so I'll abstain from commenting on it.
C functions that wish to be called from VB must instead use the
__stdcall convention, which handles the stack differently, and uses a
more intricate name decoration scheme.

If everything were easy, it would simply be a case of switching the
default calling convention in the OpenSSL makefiles to __stdcall by
supplying  the /Gz compiler flag, but unfortunately things are very
rarely easy. Compilation will fail after just the odd file or two due to
a function pointer assignment in crypto/mem.c:

static void *(*malloc_func)(size_t)         = malloc;

malloc, as defined in the Visual C++ malloc.h is actually:

void * __cdecl malloc(size_t)

This is unfortunately not the same type as:

static void *( __stdcall *malloc_func)(size_t)

Which our malloc_func function pointer has been expanded to by passing
the /Gz compiler switch.

So, we will either have to prepare the entire OpenSSL library for the
__stdcall convention by explicitly specifying as __cdecl the functions
we wish to be exempt from this rule, or we will have to explicitly
define every function we wish to have callable from VB as __stdcall.
Either way, this is going to require a bit of hacking.

An alternative to the above, which doesn't require rewriting OpenSSL
itself, once you have identified which functions you are going to call,
is to make yourself a wrapper library that uses __stdcall and simply
forwards the parameters to their OpenSSL equivalents:

int __stdcall std_X509_verify(X509* a, EVP_PKEY* r)
{
        return X509_verify(a, r);
}

These new __stdcall functions can now be declared in VB as something
like:

Declare Function X509_verify Lib "std_libeay32" Alias std_X509_verify _
        (ByVal a As Long, r As Long) As Integer

Hope this gives you a few ideas on how to proceed. I might be able to
find some time to look into making OpenSSL VB-friendly, but I can't make
any promises at present. :-/

Best regards,

//oscar

Derek Strickland wrote:
> [...] Is there no
> way to make this run via ASP/IIS or at least use a built in IIS object that
> will communicate effectively with an OpenSSL Listener on his end.  Help
> would be awesome.  Thanks.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to