NingSun | 0c89b3c | 2018-02-08 08:34:03 -0800 | [diff] [blame] | 1 | AC_DEFUN([ACX_BOTAN_GOST],[ |
| 2 | AC_MSG_CHECKING(for Botan GOST 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/gost_3410.h> |
| 15 | #include <botan/oids.h> |
| 16 | #include <botan/version.h> |
| 17 | int main() |
| 18 | { |
| 19 | Botan::LibraryInitializer::initialize(); |
| 20 | const std::string name("gost_256A"); |
| 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 | |
| 35 | return 0; |
| 36 | } |
| 37 | ]]) |
| 38 | ],[ |
| 39 | AC_MSG_RESULT([Found GOST]) |
| 40 | ],[ |
| 41 | AC_MSG_RESULT([Cannot find GOST]) |
| 42 | AC_MSG_ERROR([ |
| 43 | Botan library has no valid GOST support. Please upgrade to a later version |
| 44 | of Botan, above or including version 1.10.6 or 1.11.5. |
| 45 | Alternatively disable GOST support in SoftHSM with --disable-gost |
| 46 | ]) |
| 47 | ],[]) |
| 48 | AC_LANG_POP([C++]) |
| 49 | |
| 50 | CPPFLAGS=$tmp_CPPFLAGS |
| 51 | LIBS=$tmp_LIBS |
| 52 | ]) |