summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2017-03-14 21:47:09 +0100
committerlouiz’ <louiz@louiz.org>2017-03-14 21:47:09 +0100
commit28a537a90a4262a83152b20bffdd6936f3320efc (patch)
treee4ab5466daee92d590ad9a2ae6bd8ce8bd47ca5a /src/utils
parent0ab40dc1ab4e689921da54080b135e1d22b1c586 (diff)
downloadbiboumi-28a537a90a4262a83152b20bffdd6936f3320efc.tar.gz
biboumi-28a537a90a4262a83152b20bffdd6936f3320efc.tar.bz2
biboumi-28a537a90a4262a83152b20bffdd6936f3320efc.tar.xz
biboumi-28a537a90a4262a83152b20bffdd6936f3320efc.zip
Make things work with botan < 1.11.34
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/sha1.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/utils/sha1.cpp b/src/utils/sha1.cpp
index b77446e..2e6efc2 100644
--- a/src/utils/sha1.cpp
+++ b/src/utils/sha1.cpp
@@ -3,8 +3,10 @@
#include <biboumi.h>
#ifdef BOTAN_FOUND
+# include <botan/version.h>
# include <botan/hash.h>
# include <botan/hex.h>
+# include <botan/exceptn.h>
#endif
#ifdef GCRYPT_FOUND
# include <gcrypt.h>
@@ -16,7 +18,13 @@
std::string sha1(const std::string& input)
{
#ifdef BOTAN_FOUND
+# if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,11,34)
+ auto sha1 = Botan::HashFunction::create("SHA-1");
+ if (!sha1)
+ throw Botan::Algorithm_Not_Found("SHA-1");
+# else
auto sha1 = Botan::HashFunction::create_or_throw("SHA-1");
+# endif
sha1->update(input);
return Botan::hex_encode(sha1->final(), false);
#endif