On Mon, Apr 14, 2014 at 11:51:53AM +0200, Tom Swirly via RT wrote:
> Hello.  This is a small feature request that's applicable to all operating
> systems.
> 
> *The problem.*
> 
> The version numbers for OpenSSL appear in the header opensslv.h as macro
> symbols:
> 
> OPENSSL_VERSION_NUMBER
> OPENSSL_VERSION_TEXT
> 
> Unfortunately, it seems that neither of these two variables are actually
> used in the OpenSSL library.
> 
> This is a pity, because it means that a program that links to the OpenSSL
> library has no way to tell if it's *linking* to the correct library - you
> can only tell if you are *compiling* with the right header.
> 
> 
> *A possible solution.*
> 
> A possible solution is to have two global variables declared in opensslv.h,
> defined as:
> 
> long long openssl_version_number = OPENSSL_VERSION_NUMBER;
> const char* openssl_version_text = OPENSSL_VERSION_TEXT;

That last thing will not work properly because it would create a
relocation for that with a fixed size to copy it from the shared
library to the program, because you can't have text relocations.
So the program that links to it might not see the whole string, or
might copy a too long string.  You really want to use a function.

There are also already those function:
const char *SSLeay_version(int type);
unsigned long SSLeay(void);

> Then a program linking to this library can read either of these global
> variables at runtime and fail to start or emit a warning if the version
> isn't up-to-date.

Please don't do that.  You only create problems if you check the
version.  I've actually had to remove checks like that from
existing programs because it only causes problems.


Kurt


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to