Skip to content

Commit edcb202

Browse files
Include FIPS mode in OpenSSL_version return value (#1419)
This change includes FIPS mode information in the return value of `OpenSSL_version(OPENSSL_VERSION)`. This will allow consumers of CPython (and likely other tools or language runtimes) to detect FIPS mode without calling to an AWS-LC-specific API, which would require either patching or forking the language or tool in question.
1 parent 9860446 commit edcb202

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

crypto/crypto.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,10 @@ void CRYPTO_pre_sandbox_init(void) {
115115

116116
const char *SSLeay_version(int which) { return OpenSSL_version(which); }
117117

118-
#define AWS_LC_VERSION_TEXT AWSLC_VERSION_NAME " " AWSLC_VERSION_NUMBER_STRING
119118
const char *OpenSSL_version(int which) {
120119
switch (which) {
121120
case OPENSSL_VERSION:
122-
return AWS_LC_VERSION_TEXT;
121+
return AWSLC_VERSION_STRING;
123122
case OPENSSL_CFLAGS:
124123
return "compiler: n/a";
125124
case OPENSSL_BUILT_ON:

crypto/crypto_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <openssl/crypto.h>
2323
#include <openssl/cipher.h>
2424
#include <openssl/mem.h>
25+
#include <openssl/service_indicator.h>
2526

2627
#include <gtest/gtest.h>
2728

@@ -41,8 +42,7 @@ TEST(CryptoTest, Version) {
4142
full_expected += ")";
4243
EXPECT_EQ(OPENSSL_VERSION_TEXT, full_expected);
4344

44-
full_expected = "AWS-LC ";
45-
full_expected += AWSLC_VERSION_NUMBER_STRING;
45+
full_expected = AWSLC_VERSION_STRING;
4646
std::string actual = std::string(OpenSSL_version(OPENSSL_VERSION));
4747
EXPECT_EQ(actual, full_expected);
4848
}

0 commit comments

Comments
 (0)