hw-support.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #ifdef FREEBL_NO_DEPEND
  5. #include "stubs.h"
  6. #endif
  7. /* This is a freebl command line utility that prints hardware support as freebl
  8. * sees it from its detection in blinit.c
  9. */
  10. #include <stdio.h>
  11. #include "blapi.h"
  12. #include "blapii.h"
  13. #include "nss.h"
  14. int main(int argc, char const *argv[]) {
  15. BL_Init();
  16. printf("\n\n ========== NSS Hardware Report ==========\n");
  17. #if defined(NSS_X86_OR_X64)
  18. printf("\tAES-NI \t%s supported\n", aesni_support() ? "" : "not");
  19. printf("\tPCLMUL \t%s supported\n", clmul_support() ? "" : "not");
  20. printf("\tAVX \t%s supported\n", avx_support() ? "" : "not");
  21. printf("\tAVX2 \t%s supported\n", avx2_support() ? "" : "not");
  22. printf("\tSSSE3 \t%s supported\n", ssse3_support() ? "" : "not");
  23. printf("\tSSE4.1 \t%s supported\n", sse4_1_support() ? "" : "not");
  24. printf("\tSSE4.2 \t%s supported\n", sse4_2_support() ? "" : "not");
  25. #elif defined(__aarch64__) || defined(__arm__)
  26. printf("\tNEON \t%s supported\n", arm_neon_support() ? "" : "not");
  27. printf("\tAES \t%s supported\n", arm_aes_support() ? "" : "not");
  28. printf("\tPMULL \t%s supported\n", arm_pmull_support() ? "" : "not");
  29. printf("\tSHA1 \t%s supported\n", arm_sha1_support() ? "" : "not");
  30. printf("\tSHA2 \t%s supported\n", arm_sha2_support() ? "" : "not");
  31. #endif
  32. printf(" ========== Hardware Report End ==========\n\n\n");
  33. BL_Cleanup();
  34. return 0;
  35. }