summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
authorvincent <vincent>2005-09-28 15:47:44 +0000
committervincent <vincent>2005-09-28 15:47:44 +0000
commitc1a03d4774f8ecc30a21267469d48cb2276de48c (patch)
tree1bf9309bc99e316a5633d18f7724330d8d6fa836 /ospfd
parentaa2e32be264710ef208516dfe1661b8148c3eede (diff)
2005-09-28 Alain Ritoux <alain.ritoux@6wind.com>
* 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
Diffstat (limited to 'ospfd')
-rw-r--r--ospfd/ChangeLog4
-rw-r--r--ospfd/ospf_packet.c24
2 files changed, 17 insertions, 11 deletions
diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog
index 1a3edcc3..bef4c643 100644
--- a/ospfd/ChangeLog
+++ b/ospfd/ChangeLog
@@ -1,3 +1,7 @@
+2005-09-28 Alain Ritoux <alain.ritoux@6wind.com>
+
+ * ospf_packet.c: use new md5 API
+
2005-09-19 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
* ospf_lsa.h: (ospf_external_lsa_flush) Comment out the 5th argument
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);