From d6e31f6a5616216e7b68064f27848f50cfc7afad Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Tue, 15 May 2018 13:37:53 -0400 Subject: [PATCH] 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 --- crypto/crypto.c | 16 +++++++++++++--- include/openssl/crypto.h | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/crypto/crypto.c b/crypto/crypto.c index 8ee4c822..f3ea9f7c 100644 --- a/crypto/crypto.c +++ b/crypto/crypto.c @@ -167,10 +167,20 @@ int CRYPTO_has_asm(void) { const char *SSLeay_version(int which) { return OpenSSL_version(which); } const char *OpenSSL_version(int which) { - if (which == OPENSSL_VERSION) { - return "BoringSSL"; + switch (which) { + case OPENSSL_VERSION: + 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; } diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h index 6678f2a7..8e1a271c 100644 --- a/include/openssl/crypto.h +++ b/include/openssl/crypto.h @@ -76,7 +76,8 @@ OPENSSL_EXPORT int BORINGSSL_self_test(void); #define OPENSSL_DIR 4 // 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); #define SSLEAY_VERSION OPENSSL_VERSION