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 --- ospfd/ospf_packet.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'ospfd/ospf_packet.c') diff --git a/ospfd/ospf_packet.c b/ospfd/ospf_packet.c index 1906cc1c..ceb6a20c 100644 --- a/ospfd/ospf_packet.c +++ b/ospfd/ospf_packet.c @@ -32,7 +32,7 @@ #include "stream.h" #include "log.h" #include "sockopt.h" -#include "md5-gnu.h" +#include "md5.h" #include "ospfd/ospfd.h" #include "ospfd/ospf_network.h" @@ -260,7 +260,7 @@ ospf_check_md5_digest (struct ospf_interface *oi, struct stream *s, u_int16_t length) { unsigned char *ibuf; - struct md5_ctx ctx; + MD5_CTX ctx; unsigned char digest[OSPF_AUTH_MD5_SIZE]; unsigned char *pdigest; struct crypt_key *ck; @@ -297,10 +297,11 @@ ospf_check_md5_digest (struct ospf_interface *oi, struct stream *s, } /* Generate a digest for the ospf packet - their digest + our digest. */ - md5_init_ctx (&ctx); - md5_process_bytes (ibuf, length, &ctx); - md5_process_bytes (ck->auth_key, OSPF_AUTH_MD5_SIZE, &ctx); - md5_finish_ctx (&ctx, digest); + memset(&ctx, 0, sizeof(ctx)); + MD5Init(&ctx); + MD5Update(&ctx, ibuf, length); + MD5Update(&ctx, ck->auth_key, OSPF_AUTH_MD5_SIZE); + MD5Final(digest, &ctx); /* compare the two */ if (memcmp (pdigest, digest, OSPF_AUTH_MD5_SIZE)) @@ -324,7 +325,7 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) { struct ospf_header *ospfh; unsigned char digest[OSPF_AUTH_MD5_SIZE]; - struct md5_ctx ctx; + MD5_CTX ctx; void *ibuf; u_int32_t t; struct crypt_key *ck; @@ -352,10 +353,11 @@ ospf_make_md5_digest (struct ospf_interface *oi, struct ospf_packet *op) } /* Generate a digest for the entire packet + our secret key. */ - md5_init_ctx (&ctx); - md5_process_bytes (ibuf, ntohs (ospfh->length), &ctx); - md5_process_bytes (auth_key, OSPF_AUTH_MD5_SIZE, &ctx); - md5_finish_ctx (&ctx, digest); + memset(&ctx, 0, sizeof(ctx)); + MD5Init(&ctx); + MD5Update(&ctx, ibuf, ntohs (ospfh->length)); + MD5Update(&ctx, auth_key, OSPF_AUTH_MD5_SIZE); + MD5Final(digest, &ctx); /* Append md5 digest to the end of the stream. */ stream_put (op->s, digest, OSPF_AUTH_MD5_SIZE); -- cgit v1.2.1