aboutsummaryrefslogtreecommitdiff
path: root/crypto/crypto_test.cc
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2020-09-16 12:29:13 -0400
committerCQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>2020-09-16 17:33:33 +0000
commit49e9f67d8b7cbeb3953b5548ad1009d15947a523 (patch)
treeba4e2a5a9bd379fcc56211ac786d370ea8f53219 /crypto/crypto_test.cc
parenta82cfdf08370bc4fd945f21c66d7dee3c4b7bd48 (diff)
downloadboringssl-49e9f67d8b7cbeb3953b5548ad1009d15947a523.zip
boringssl-49e9f67d8b7cbeb3953b5548ad1009d15947a523.tar.gz
boringssl-49e9f67d8b7cbeb3953b5548ad1009d15947a523.tar.bz2
Bump OPENSSL_VERSION_NUMBER to 1.1.1.
With TLS 1.3 and Ed25519 support, we're much closer to OpenSSL 1.1.1 these days than OpenSSL 1.1.0. I've also added a test to keep OPENSSL_VERSION_NUMBER and OPENSSL_VERSION_TEXT in sync. Update-Note: Some OPENSSL_VERSION_NUMBER/OPENSSL_IS_BORINGSSL checks may need to be updated. Hopefully even more can go away. Bug: 367 Change-Id: Idaa238b74f35993c9c03fec31f1346c15cf82968 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/42864 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/crypto_test.cc')
-rw-r--r--crypto/crypto_test.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/crypto/crypto_test.cc b/crypto/crypto_test.cc
new file mode 100644
index 0000000..f6c2374
--- /dev/null
+++ b/crypto/crypto_test.cc
@@ -0,0 +1,35 @@
+/* Copyright (c) 2020, Google Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
+
+#include <stdio.h>
+#include <string.h>
+
+#include <string>
+
+#include <openssl/base.h>
+#include <openssl/crypto.h>
+
+#include <gtest/gtest.h>
+
+// Test that OPENSSL_VERSION_NUMBER and OPENSSL_VERSION_TEXT are consistent.
+// Node.js parses the version out of OPENSSL_VERSION_TEXT instead of using
+// OPENSSL_VERSION_NUMBER.
+TEST(CryptoTest, Version) {
+ char expected[512];
+ snprintf(expected, sizeof(expected), "OpenSSL %d.%d.%d ",
+ OPENSSL_VERSION_NUMBER >> 28, (OPENSSL_VERSION_NUMBER >> 20) & 0xff,
+ (OPENSSL_VERSION_NUMBER >> 12) & 0xff);
+ EXPECT_EQ(expected,
+ std::string(OPENSSL_VERSION_TEXT).substr(0, strlen(expected)));
+}