]> git.puffer.fish Git - mirror/frr.git/commitdiff
isisd: Enabling build with openssl 4930/head
authorMichal Ruprich <mruprich@redhat.com>
Tue, 20 Aug 2019 09:34:34 +0000 (11:34 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 4 Sep 2019 13:39:47 +0000 (09:39 -0400)
Similar to PR #4677, I am enabling the openssl library for md5
authentication in IS-IS

Signed-off-by: Michal Ruprich <michalruprich@gmail.com>
isisd/isis_tlvs.c
lib/zebra.h

index 488dfedae4c0f8032f0554c73fc66a8c9ac54931..ee253c7a31ae4afb4aaff513146a2b6a414932d7 100644 (file)
@@ -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);
index 789a93a3c475eab9e7e4666c6eaaa0ba960a7ef2..b17ef700b4aed2ea9860f945bef902c990ab07d4 100644 (file)
@@ -136,6 +136,7 @@ typedef unsigned char uint8_t;
 
 #ifdef CRYPTO_OPENSSL
 #include <openssl/evp.h>
+#include <openssl/hmac.h>
 #endif
 
 #include "openbsd-tree.h"