Subject: Re: detect linkage against openssl or gcrypt

Re: detect linkage against openssl or gcrypt

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 30 Jul 2013 16:05:41 +0200 (CEST)

On Mon, 29 Jul 2013, Guenter wrote:

> perhaps something as simple like this would do already?
>
> LIBSSH2_API
> uint32_t libssh2_buildinfo()
> {
> uint32_t buildinfo = 0;
> #if defined(LIBSSH2_WINDOWSCRYPT) /* build with Windows native Crypt API */
> buildinfo |= 0x00000004;
> #elif defined(LIBSSH2_LIBGCRYPT) /* build with libgcrypt */
> buildinfo |= 0x00000002;
> #else /* must be build with OpenSSL */
> buildinfo |= 0x00000001;
> #endif
> #if defined(LIBSSH2_HAVE_ZLIB) /* build with Zlib support */
> buildinfo |= 0x00010000;
> #endif
> return buildinfo;
> }

Yeah. Perhaps with two version strings added, one for the crypto lib and one
for the zlib?

struct libssh2_build {
   unsigned int featuremask;
   char *cryptolib; /* name/version perhaps ? */
   char *zlib;
};

struct libssh2_build *libssh2_buildinfo(void);

... I can also imagine making it slightly more future-proof with a generation
counter in the struct:

struct libssh2_build {
   int age; /* generation number of this struct, 1 for now */
   unsigned int featuremask;
   char *cryptolib;
   char *zlib;
};

... that way we can add stuff to the end of the struct in a future if we bump
the age counter and document it properly.

-- 
  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-07-30