From 13f113f7a939494392e1d1ec121c83b6536ef66c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Korthaus?= Date: Fri, 27 Jul 2018 09:33:39 +0200 Subject: [PATCH] botan: Add MD5 support to Botan hasher Support MD5 in the Botan plugin if supported by Botan. MD5 is required for RADIUS and obviously EAP-MD5, and also for non-PKCS#8 encoded, encrypted private keys. --- src/libstrongswan/plugins/botan/botan_hasher.c | 3 +++ src/libstrongswan/plugins/botan/botan_hasher.h | 3 ++- src/libstrongswan/plugins/botan/botan_plugin.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libstrongswan/plugins/botan/botan_hasher.c b/src/libstrongswan/plugins/botan/botan_hasher.c index f3caec3876..06b2ad9b2d 100644 --- a/src/libstrongswan/plugins/botan/botan_hasher.c +++ b/src/libstrongswan/plugins/botan/botan_hasher.c @@ -112,6 +112,9 @@ botan_hasher_t *botan_hasher_create(hash_algorithm_t algo) switch (algo) { + case HASH_MD5: + hash_name = "MD5"; + break; case HASH_SHA1: hash_name = "SHA-1"; break; diff --git a/src/libstrongswan/plugins/botan/botan_hasher.h b/src/libstrongswan/plugins/botan/botan_hasher.h index 2cb0bc1174..164f63711b 100644 --- a/src/libstrongswan/plugins/botan/botan_hasher.h +++ b/src/libstrongswan/plugins/botan/botan_hasher.h @@ -1,5 +1,6 @@ /* - * Copyright (C) 2017 René Korthaus, Rohde & Schwarz Cybersecurity + * Copyright (C) 2018 René Korthaus + * Rohde & Schwarz Cybersecurity GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/src/libstrongswan/plugins/botan/botan_plugin.c b/src/libstrongswan/plugins/botan/botan_plugin.c index 3bc3883218..0fb9159c19 100644 --- a/src/libstrongswan/plugins/botan/botan_plugin.c +++ b/src/libstrongswan/plugins/botan/botan_plugin.c @@ -102,6 +102,9 @@ METHOD(plugin_t, get_features, int, #endif /* hashers */ PLUGIN_REGISTER(HASHER, botan_hasher_create), +#ifdef BOTAN_HAS_MD5 + PLUGIN_PROVIDE(HASHER, HASH_MD5), +#endif #ifdef BOTAN_HAS_SHA1 PLUGIN_PROVIDE(HASHER, HASH_SHA1), #endif -- 2.47.2