| 1 |
AC_DEFUN([ACX_BOTAN_ECC],[ |
| 2 |
AC_MSG_CHECKING(for Botan ECC support) |
| 3 |
|
| 4 |
tmp_CPPFLAGS=$CPPFLAGS |
| 5 |
tmp_LIBS=$LIBS |
| 6 |
|
| 7 |
CPPFLAGS="$CPPFLAGS $CRYPTO_INCLUDES" |
| 8 |
LIBS="$CRYPTO_LIBS $LIBS" |
| 9 |
|
| 10 |
AC_LANG_PUSH([C++]) |
| 11 |
AC_CACHE_VAL([acx_cv_lib_botan_ecc_support],[ |
| 12 |
acx_cv_lib_botan_ecc_support=no |
| 13 |
AC_RUN_IFELSE([ |
| 14 |
AC_LANG_SOURCE([[ |
| 15 |
#include <botan/ec_group.h> |
| 16 |
#include <botan/oids.h> |
| 17 |
#include <botan/version.h> |
| 18 |
int main() |
| 19 |
{ |
| 20 |
const std::string name("secp256r1"); |
| 21 |
const Botan::OID oid(Botan::OIDS::lookup(name)); |
| 22 |
const Botan::EC_Group ecg(oid); |
| 23 |
try { |
| 24 |
const std::vector<Botan::byte> der = |
| 25 |
ecg.DER_encode(Botan::EC_DOMPAR_ENC_OID); |
| 26 |
} catch(...) { |
| 27 |
return 1; |
| 28 |
} |
| 29 |
return 0; |
| 30 |
} |
| 31 |
]]) |
| 32 |
],[ |
| 33 |
AC_MSG_RESULT([Found P256]) |
| 34 |
acx_cv_lib_botan_ecc_support=yes |
| 35 |
],[ |
| 36 |
AC_MSG_RESULT([Cannot find P256]) |
| 37 |
acx_cv_lib_botan_ecc_support=no |
| 38 |
],[ |
| 39 |
AC_MSG_WARN([Cannot test, assuming P256]) |
| 40 |
acx_cv_lib_botan_ecc_support=yes |
| 41 |
]) |
| 42 |
]) |
| 43 |
AC_LANG_POP([C++]) |
| 44 |
|
| 45 |
CPPFLAGS=$tmp_CPPFLAGS |
| 46 |
LIBS=$tmp_LIBS |
| 47 |
have_lib_botan_ecc_support="${acx_cv_lib_botan_ecc_support}" |
| 48 |
]) |