Return more placeholder version strings.

PyOpenSSL's tests expect all of the outputs to be distinct. OpenSSL also
tends to prefix the return values with strings like "compiler:", so do
something similar.

Change-Id: Ic411c95a276b477641ebad803ac309b3035c1b13
Reviewed-on: https://boringssl-review.googlesource.com/28544
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2018-05-15 13:37:53 -04:00
parent 9db1a0017a
commit d6e31f6a56
2 changed files with 15 additions and 4 deletions

View File

@ -167,10 +167,20 @@ int CRYPTO_has_asm(void) {
const char *SSLeay_version(int which) { return OpenSSL_version(which); } const char *SSLeay_version(int which) { return OpenSSL_version(which); }
const char *OpenSSL_version(int which) { const char *OpenSSL_version(int which) {
if (which == OPENSSL_VERSION) { switch (which) {
case OPENSSL_VERSION:
return "BoringSSL"; return "BoringSSL";
case OPENSSL_CFLAGS:
return "compiler: n/a";
case OPENSSL_BUILT_ON:
return "built on: n/a";
case OPENSSL_PLATFORM:
return "platform: n/a";
case OPENSSL_DIR:
return "OPENSSLDIR: n/a";
default:
return "not available";
} }
return "";
} }
unsigned long SSLeay(void) { return OPENSSL_VERSION_NUMBER; } unsigned long SSLeay(void) { return OPENSSL_VERSION_NUMBER; }

View File

@ -76,7 +76,8 @@ OPENSSL_EXPORT int BORINGSSL_self_test(void);
#define OPENSSL_DIR 4 #define OPENSSL_DIR 4
// OpenSSL_version is a compatibility function that returns the string // OpenSSL_version is a compatibility function that returns the string
// "BoringSSL" if |which| is |OPENSSL_VERSION| and "" otherwise. // "BoringSSL" if |which| is |OPENSSL_VERSION| and placeholder strings
// otherwise.
OPENSSL_EXPORT const char *OpenSSL_version(int which); OPENSSL_EXPORT const char *OpenSSL_version(int which);
#define SSLEAY_VERSION OPENSSL_VERSION #define SSLEAY_VERSION OPENSSL_VERSION