| 2712 | #endif /* INET6 */ |
| 2713 | |
| 2714 | static uint32_t |
| 2715 | tcp_keyed_hash(struct in_conninfo *inc, u_char *key, u_int len) |
| 2716 | { |
| 2717 | SIPHASH_CTX ctx; |
| 2718 | uint32_t hash[2]; |
| 2719 | |
| 2720 | KASSERT(len >= SIPHASH_KEY_LENGTH, |
| 2721 | ("%s: keylen %u too short ", __func__, len)); |
| 2722 | SipHash24_Init(&ctx); |
| 2723 | SipHash_SetKey(&ctx, (uint8_t *)key); |
| 2724 | SipHash_Update(&ctx, &inc->inc_fport, sizeof(uint16_t)); |
| 2725 | SipHash_Update(&ctx, &inc->inc_lport, sizeof(uint16_t)); |
| 2726 | switch (inc->inc_flags & INC_ISIPV6) { |
| 2727 | #ifdef INET |
| 2728 | case 0: |
| 2729 | SipHash_Update(&ctx, &inc->inc_faddr, sizeof(struct in_addr)); |
| 2730 | SipHash_Update(&ctx, &inc->inc_laddr, sizeof(struct in_addr)); |
| 2731 | break; |
| 2732 | #endif |
| 2733 | #ifdef INET6 |
| 2734 | case INC_ISIPV6: |
| 2735 | SipHash_Update(&ctx, &inc->inc6_faddr, sizeof(struct in6_addr)); |
| 2736 | SipHash_Update(&ctx, &inc->inc6_laddr, sizeof(struct in6_addr)); |
| 2737 | break; |
| 2738 | #endif |
| 2739 | } |
| 2740 | SipHash_Final((uint8_t *)hash, &ctx); |
| 2741 | |
| 2742 | return (hash[0] ^ hash[1]); |
| 2743 | } |
| 2744 | |
| 2745 | uint32_t |
| 2746 | tcp_new_ts_offset(struct in_conninfo *inc) |
no test coverage detected