liboqs/tests/system_info.c
Douglas Stebila 6e0b0d79a9
Add SPDX-License-Identifier headers (#749)
* Add SPDX-License-Identifier in src/common

* Add SPDX-License-Identifier in FrodoKEM

* Add SPDX-License-Identifier in SIKE

* Add SPDX-License-Identifier in BIKE

* Add SPDX-License-Identifier in OQS headers

* Add SPDX-License-Identifier in files generated during copy-from-pqclean

* Add SPDX-License-Identifier in Picnic

* Add SPDX-License-Identifier in qTesla

* Add SPDX-License-Identifier in CMake files

* Update license info in README

* Add SPDX-License-Identifier in scripts

* Add SPDX-License-Info to CMakeLists

* Add SPDX-License-Info in tests

* Add SPDX-License-Info to various files

* Prettyprint

* Add test for SPDX-License-Identifier headers

* Updated license identifiers for CPU extension detection code.

* Use conjunction for SPDX in file with two licenses

Co-authored-by: xvzcf <xvzcf@users.noreply.github.com>
2020-05-12 11:45:37 -04:00

76 lines
2.1 KiB
C

// SPDX-License-Identifier: MIT
#include <oqs/oqs.h>
#include <stdio.h>
// based on macros in https://sourceforge.net/p/predef/wiki/Compilers/
static void print_compiler_info(void) {
#if defined(__clang__)
printf("Compiler: clang (%s)\n", __clang_version__);
#elif defined(__GNUC_PATCHLEVEL__)
printf("Compiler: gcc (%d.%d.%d)\n", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#elif defined(__GNUC_MINOR__)
printf("Compiler: gcc (%d.%d)\n", __GNUC__, __GNUC_MINOR__);
#elif defined(__INTEL_COMPILER)
printf("Compiler: Intel C/C++ (%d)\n", __INTEL_COMPILER);
#elif defined(_MSC_FULL_VER)
printf("Compiler: Microsoft C/C++ (%d)\n", _MSC_FULL_VER);
#else
printf("Compiler: Unknown"\n);
#endif
}
// based on macros in https://sourceforge.net/p/predef/wiki/Architectures/
static void print_platform_info(void) {
#if defined(OQS_COMPILE_BUILD_TARGET)
printf("Target platform: %s\n", OQS_COMPILE_BUILD_TARGET);
#elif defined(_WIN64)
printf("Target platform: Windows (64-bit)\n");
#elif defined(_WIN32)
printf("Target platform: Windows (32-bit)\n");
#else
printf("Target platform: Unknown\n");
#endif
}
#if defined(OQS_USE_OPENSSL)
#include <openssl/opensslv.h>
#endif
static void print_oqs_configuration(void) {
printf("OQS version: %s\n", OQS_VERSION_TEXT);
#if defined(OQS_COMPILE_GIT_COMMIT)
printf("Git commit: %s\n", OQS_COMPILE_GIT_COMMIT);
#endif
#if defined(OQS_USE_OPENSSL)
printf("OpenSSL enabled: Yes (%s)\n", OPENSSL_VERSION_TEXT);
#else
printf("OpenSSL enabled: No\n");
#endif
#if defined(OQS_USE_AES_OPENSSL)
printf("AES: OpenSSL\n");
#else
printf("AES: C\n");
#endif
#if defined(OQS_USE_SHA2_OPENSSL)
printf("SHA-2: OpenSSL\n");
#else
printf("SHA-2: C\n");
#endif
#if defined(OQS_USE_SHA3_OPENSSL)
printf("SHA-3: OpenSSL\n");
#else
printf("SHA-3: C\n");
#endif
}
static void print_system_info(void) {
printf("Configuration info\n");
printf("==================\n");
print_platform_info();
print_compiler_info();
print_oqs_configuration();
printf("\n");
}