diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-11-25 14:24:35 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-11-25 14:24:35 +0100 |
commit | 04ae8ddaa15b72c265dc7cf038b733d235198754 (patch) | |
tree | eadc4dfee9a0f0eba3446538129608dffbde4625 /proto/rip/packets.c | |
parent | d44e686e9bcae5850115c0e1adfe24523dce61ee (diff) | |
parent | 33b4f40acce02c90b4b7766c5c94ebf2d22765c6 (diff) |
Merge branch 'master' into int-new
Diffstat (limited to 'proto/rip/packets.c')
-rw-r--r-- | proto/rip/packets.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/proto/rip/packets.c b/proto/rip/packets.c index e2a2390b..4fc832d5 100644 --- a/proto/rip/packets.c +++ b/proto/rip/packets.c @@ -240,10 +240,10 @@ rip_fill_authentication(struct rip_proto *p, struct rip_iface *ifa, struct rip_p *plen += sizeof(struct rip_auth_tail) + RIP_MD5_LENGTH; - struct MD5Context ctxt; - MD5Init(&ctxt); - MD5Update(&ctxt, (byte *) pkt, *plen); - MD5Final(tail->auth_data, &ctxt); + struct md5_context ctx; + md5_init(&ctx); + md5_update(&ctx, (byte *) pkt, *plen); + memcpy(tail->auth_data, md5_final(&ctx), RIP_MD5_LENGTH); return; default: @@ -311,15 +311,13 @@ rip_check_authentication(struct rip_proto *p, struct rip_iface *ifa, struct rip_ } char received[RIP_MD5_LENGTH]; - char computed[RIP_MD5_LENGTH]; - memcpy(received, tail->auth_data, RIP_MD5_LENGTH); strncpy(tail->auth_data, pass->password, RIP_MD5_LENGTH); - struct MD5Context ctxt; - MD5Init(&ctxt); - MD5Update(&ctxt, (byte *) pkt, *plen); - MD5Final(computed, &ctxt); + struct md5_context ctx; + md5_init(&ctx); + md5_update(&ctx, (byte *) pkt, *plen); + char *computed = md5_final(&ctx); if (memcmp(received, computed, RIP_MD5_LENGTH)) DROP("wrong MD5 digest", pass->id); |