From c1a03d4774f8ecc30a21267469d48cb2276de48c Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 28 Sep 2005 15:47:44 +0000 Subject: 2005-09-28 Alain Ritoux * lib/md5-gnu.h: removed * lib/md5.h: replaces md5-gnu.h * lib/Makefile.am: use correct md5.h * lib/md5.c: import from WIDE * ospfd/ospf_packet.c: use new md5 API * ripd/ripd.c: use new md5 API --- ripd/ChangeLog | 4 ++++ ripd/ripd.c | 23 ++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) (limited to 'ripd') diff --git a/ripd/ChangeLog b/ripd/ChangeLog index b39faa95..3a9b5516 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,7 @@ +2005-09-28 Alain Ritoux + + * ripd.c: use new md5 API + 2005-08-16 Paul Jakma * ripd.c: (general) Fix previous commit, broke multicast bind and diff --git a/ripd/ripd.c b/ripd/ripd.c index d21485e5..b75e018b 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -36,7 +36,7 @@ #include "if_rmap.h" #include "plist.h" #include "distribute.h" -#include "md5-gnu.h" +#include "md5.h" #include "keychain.h" #include "privs.h" @@ -842,7 +842,7 @@ rip_auth_md5 (struct rip_packet *packet, struct sockaddr_in *from, struct rip_md5_data *md5data; struct keychain *keychain; struct key *key; - struct md5_ctx ctx; + MD5_CTX ctx; u_char pdigest[RIP_AUTH_MD5_SIZE]; u_char digest[RIP_AUTH_MD5_SIZE]; u_int16_t packet_len; @@ -915,10 +915,10 @@ rip_auth_md5 (struct rip_packet *packet, struct sockaddr_in *from, memset (md5data->digest, 0, RIP_AUTH_MD5_SIZE); strncpy ((char *)md5data->digest, auth_str, RIP_AUTH_MD5_SIZE); - md5_init_ctx (&ctx); - md5_process_bytes (packet, packet_len + RIP_HEADER_SIZE + RIP_AUTH_MD5_SIZE, - &ctx); - md5_finish_ctx (&ctx, digest); + memset (&ctx, 0, sizeof(ctx)); + MD5Init(&ctx); + MD5Update(&ctx, packet, packet_len + md5->auth_len); + MD5Final(digest, &ctx); if (memcmp (pdigest, digest, RIP_AUTH_MD5_SIZE) == 0) return packet_len; @@ -1047,7 +1047,7 @@ rip_auth_md5_set (struct stream *s, struct rip_interface *ri, size_t doff, char *auth_str, int authlen) { unsigned long len; - struct md5_ctx ctx; + MD5_CTX ctx; unsigned char digest[RIP_AUTH_MD5_SIZE]; /* Make it sure this interface is configured as MD5 @@ -1073,10 +1073,11 @@ rip_auth_md5_set (struct stream *s, struct rip_interface *ri, size_t doff, stream_putw (s, RIP_AUTH_DATA); /* Generate a digest for the RIP packet. */ - md5_init_ctx (&ctx); - md5_process_bytes (s->data, s->endp, &ctx); - md5_process_bytes (auth_str, RIP_AUTH_MD5_SIZE, &ctx); - md5_finish_ctx (&ctx, digest); + memset(&ctx, 0, sizeof(ctx)); + MD5Init(&ctx); + MD5Update(&ctx, s->data, s->endp); + MD5Update(&ctx, auth_str, RIP_AUTH_MD5_SIZE); + MD5Final(digest, &ctx); /* Copy the digest to the packet. */ stream_write (s, digest, RIP_AUTH_MD5_SIZE); -- cgit v1.2.1