MCPcopy Create free account
hub / github.com/F-Stack/f-stack / carp_hmac_generate

Function carp_hmac_generate

freebsd/netinet/ip_carp.c:411–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409}
410
411static void
412carp_hmac_generate(struct carp_softc *sc, uint32_t counter[2],
413 unsigned char md[20])
414{
415 SHA1_CTX sha1ctx;
416
417 CARP_LOCK_ASSERT(sc);
418
419 /* fetch first half of inner hash */
420 bcopy(&sc->sc_sha1, &sha1ctx, sizeof(sha1ctx));
421
422 SHA1Update(&sha1ctx, (void *)counter, sizeof(sc->sc_counter));
423 SHA1Final(md, &sha1ctx);
424
425 /* outer hash */
426 SHA1Init(&sha1ctx);
427 SHA1Update(&sha1ctx, sc->sc_pad, sizeof(sc->sc_pad));
428 SHA1Update(&sha1ctx, md, 20);
429 SHA1Final(md, &sha1ctx);
430}
431
432static int
433carp_hmac_verify(struct carp_softc *sc, uint32_t counter[2],

Callers 2

carp_hmac_verifyFunction · 0.85
carp_prepare_adFunction · 0.85

Calls 3

SHA1UpdateFunction · 0.50
SHA1FinalFunction · 0.50
SHA1InitFunction · 0.50

Tested by

no test coverage detected