From 9ad816a5d8d74105558640b2f37baec50d8b920f Mon Sep 17 00:00:00 2001 From: Matthias Gierlings Date: Thu, 27 Oct 2016 19:00:23 +0200 Subject: Implements GMAC with GHASH. Adds support for Galois Message Authentication Code calculation based on GHASH, rather than GCM_Mode. --- src/lib/mac/mac.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/lib/mac/mac.cpp') diff --git a/src/lib/mac/mac.cpp b/src/lib/mac/mac.cpp index f2c5557c7..2fa321a67 100644 --- a/src/lib/mac/mac.cpp +++ b/src/lib/mac/mac.cpp @@ -45,6 +45,17 @@ MessageAuthenticationCode::create(const std::string& algo_spec, { const SCAN_Name req(algo_spec); +#if defined(BOTAN_HAS_GMAC) + if(req.algo_name() == "GMAC" && req.arg_count() == 1) + { + if(provider.empty() || provider == "base") + { + if(auto bc = BlockCipher::create(req.arg(0))) + return std::unique_ptr(new GMAC(bc.release())); + } + } +#endif + #if defined(BOTAN_HAS_HMAC) if(req.algo_name() == "HMAC" && req.arg_count() == 1) { -- cgit v1.2.3