diff options
author | vincent <vincent> | 2005-09-28 15:47:44 +0000 |
---|---|---|
committer | vincent <vincent> | 2005-09-28 15:47:44 +0000 |
commit | 94ded4ff0ee6af6f715d90a04e337d5b52c2b970 (patch) | |
tree | 529bca83a3c2d033d7fa68c88592e6ea6d22bbb7 /ospfd/ospf_packet.c | |
parent | 4ba66e60a2e8266f884c6bee413c8177a960fb79 (diff) | |
download | quagga-94ded4ff0ee6af6f715d90a04e337d5b52c2b970.tar.bz2 quagga-94ded4ff0ee6af6f715d90a04e337d5b52c2b970.tar.xz |
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/ospf_packet.c')
-rw-r--r-- | ospfd/ospf_packet.c | 24 |
1 files changed, 13 insertions, 11 deletions
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); |