| 409 | } |
| 410 | |
| 411 | static void |
| 412 | carp_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 | |
| 432 | static int |
| 433 | carp_hmac_verify(struct carp_softc *sc, uint32_t counter[2], |
no test coverage detected