You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.3 KiB

  1. dnl Check to find the mbed TLS headers/libraries
  2. AC_DEFUN([ss_MBEDTLS],
  3. [
  4. AC_ARG_WITH(mbedtls,
  5. AS_HELP_STRING([--with-mbedtls=DIR], [mbed TLS base directory, or:]),
  6. [mbedtls="$withval"
  7. CFLAGS="$CFLAGS -I$withval/include"
  8. LDFLAGS="$LDFLAGS -L$withval/lib"]
  9. )
  10. AC_ARG_WITH(mbedtls-include,
  11. AS_HELP_STRING([--with-mbedtls-include=DIR], [mbed TLS headers directory (without trailing /mbedtls)]),
  12. [mbedtls_include="$withval"
  13. CFLAGS="$CFLAGS -I$withval"]
  14. )
  15. AC_ARG_WITH(mbedtls-lib,
  16. AS_HELP_STRING([--with-mbedtls-lib=DIR], [mbed TLS library directory]),
  17. [mbedtls_lib="$withval"
  18. LDFLAGS="$LDFLAGS -L$withval"]
  19. )
  20. AC_CHECK_LIB(mbedcrypto, mbedtls_cipher_setup,
  21. [LIBS="-lmbedcrypto $LIBS"],
  22. [AC_MSG_ERROR([mbed TLS libraries not found.])]
  23. )
  24. AC_MSG_CHECKING([whether mbedtls supports Cipher Feedback mode or not])
  25. AC_COMPILE_IFELSE(
  26. [AC_LANG_PROGRAM(
  27. [[
  28. #include <mbedtls/config.h>
  29. ]],
  30. [[
  31. #ifndef MBEDTLS_CIPHER_MODE_CFB
  32. #error Cipher Feedback mode a.k.a CFB not supported by your mbed TLS.
  33. #endif
  34. ]]
  35. )],
  36. [AC_MSG_RESULT([ok])],
  37. [AC_MSG_ERROR([MBEDTLS_CIPHER_MODE_CFB required])]
  38. )
  39. AC_MSG_CHECKING([whether mbedtls supports the ARC4 stream cipher or not])
  40. AC_COMPILE_IFELSE(
  41. [AC_LANG_PROGRAM(
  42. [[
  43. #include <mbedtls/config.h>
  44. ]],
  45. [[
  46. #ifndef MBEDTLS_ARC4_C
  47. #error the ARC4 stream cipher not supported by your mbed TLS.
  48. #endif
  49. ]]
  50. )],
  51. [AC_MSG_RESULT([ok])],
  52. [AC_MSG_ERROR([MBEDTLS_ARC4_C required])]
  53. )
  54. AC_MSG_CHECKING([whether mbedtls supports the Blowfish block cipher or not])
  55. AC_COMPILE_IFELSE(
  56. [AC_LANG_PROGRAM(
  57. [[
  58. #include <mbedtls/config.h>
  59. ]],
  60. [[
  61. #ifndef MBEDTLS_BLOWFISH_C
  62. #error the Blowfish block cipher not supported by your mbed TLS.
  63. #endif
  64. ]]
  65. )],
  66. [AC_MSG_RESULT([ok])],
  67. [AC_MSG_ERROR([MBEDTLS_BLOWFISH_C required])]
  68. )
  69. AC_MSG_CHECKING([whether mbedtls supports the Camellia block cipher or not])
  70. AC_COMPILE_IFELSE(
  71. [AC_LANG_PROGRAM(
  72. [[
  73. #include <mbedtls/config.h>
  74. ]],
  75. [[
  76. #ifndef MBEDTLS_CAMELLIA_C
  77. #error the Camellia block cipher not supported by your mbed TLS.
  78. #endif
  79. ]]
  80. )],
  81. [AC_MSG_RESULT([ok])],
  82. [AC_MSG_ERROR([MBEDTLS_CAMELLIA_C required])]
  83. )
  84. ])