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>
diff --git a/crypto/crypto.c b/crypto/crypto.c
index 8ee4c82..f3ea9f7 100644
--- a/crypto/crypto.c
+++ b/crypto/crypto.c
@@ -167,10 +167,20 @@
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 6678f2a..8e1a271 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -76,7 +76,8 @@
#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