blob: 9bce21d92ff1f80a7cffe684936afbfda02a7ba8 [file] [log] [blame]
NingSun0c89b3c2018-02-08 08:34:03 -08001AC_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_RUN_IFELSE([
12 AC_LANG_SOURCE([[
13 #include <botan/init.h>
14 #include <botan/ec_group.h>
15 #include <botan/oids.h>
16 #include <botan/version.h>
17 int main()
18 {
19 Botan::LibraryInitializer::initialize();
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#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,11,0)
25 const std::vector<Botan::byte> der =
26 ecg.DER_encode(Botan::EC_DOMPAR_ENC_OID);
27#else
28 const Botan::SecureVector<Botan::byte> der =
29 ecg.DER_encode(Botan::EC_DOMPAR_ENC_OID);
30#endif
31 } catch(...) {
32 return 1;
33 }
34 return 0;
35 }
36 ]])
37 ],[
38 AC_MSG_RESULT([Found P256])
39 ],[
40 AC_MSG_RESULT([Cannot find P256])
41 AC_MSG_ERROR([
42Botan library has no valid ECC support. Please upgrade to a later version
43of Botan, above or including version 1.10.6 or 1.11.5.
44Alternatively disable ECC support in SoftHSM with --disable-ecc
45])
46 ],[])
47 AC_LANG_POP([C++])
48
49 CPPFLAGS=$tmp_CPPFLAGS
50 LIBS=$tmp_LIBS
51])