summaryrefslogtreecommitdiffstats
path: root/isisd/isis_tlvs.c
diff options
context:
space:
mode:
authorMichal Ruprich <mruprich@redhat.com>2019-08-20 11:34:34 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-09-04 15:39:47 +0200
commit6252100f88a2fad0495deb4af26ebba1e96eb3a7 (patch)
tree5ab0b2ecb0992dd2e0fb0b9ba45be9666fd6dbf9 /isisd/isis_tlvs.c
parentMerge pull request #4874 from manuhalo/fix_isis_mtu (diff)
downloadfrr-6252100f88a2fad0495deb4af26ebba1e96eb3a7.tar.xz
frr-6252100f88a2fad0495deb4af26ebba1e96eb3a7.zip
isisd: Enabling build with openssl
Similar to PR #4677, I am enabling the openssl library for md5 authentication in IS-IS Signed-off-by: Michal Ruprich <michalruprich@gmail.com>
Diffstat (limited to 'isisd/isis_tlvs.c')
-rw-r--r--isisd/isis_tlvs.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index 488dfedae..ee253c7a3 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -22,7 +22,9 @@
*/
#include <zebra.h>
+#ifdef CRYPTO_INTERNAL
#include "md5.h"
+#endif
#include "memory.h"
#include "stream.h"
#include "sbuf.h"
@@ -2770,8 +2772,16 @@ static void update_auth_hmac_md5(struct isis_auth *auth, struct stream *s,
safe_auth_md5(s, &checksum, &rem_lifetime);
memset(STREAM_DATA(s) + auth->offset, 0, 16);
+#ifdef CRYPTO_OPENSSL
+ uint8_t *result = (uint8_t *)HMAC(EVP_md5(), auth->passwd,
+ auth->plength, STREAM_DATA(s),
+ stream_get_endp(s), NULL, NULL);
+
+ memcpy(digest, result, 16);
+#elif CRYPTO_INTERNAL
hmac_md5(STREAM_DATA(s), stream_get_endp(s), auth->passwd,
auth->plength, digest);
+#endif
memcpy(auth->value, digest, 16);
memcpy(STREAM_DATA(s) + auth->offset, digest, 16);
@@ -3310,8 +3320,16 @@ static bool auth_validator_hmac_md5(struct isis_passwd *passwd,
safe_auth_md5(stream, &checksum, &rem_lifetime);
memset(STREAM_DATA(stream) + auth->offset, 0, 16);
+#ifdef CRYPTO_OPENSSL
+ uint8_t *result = (uint8_t *)HMAC(EVP_md5(), passwd->passwd,
+ passwd->len, STREAM_DATA(stream),
+ stream_get_endp(stream), NULL, NULL);
+
+ memcpy(digest, result, 16);
+#elif CRYPTO_INTERNAL
hmac_md5(STREAM_DATA(stream), stream_get_endp(stream), passwd->passwd,
passwd->len, digest);
+#endif
memcpy(STREAM_DATA(stream) + auth->offset, auth->value, 16);
bool rv = !memcmp(digest, auth->value, 16);