summaryrefslogtreecommitdiff
path: root/ospfd
diff options
context:
space:
mode:
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);