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

Function tcp_fastopen_make_cookie

freebsd/netinet/tcp_fastopen.c:536–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536static uint64_t
537tcp_fastopen_make_cookie(uint8_t key[SIPHASH_KEY_LENGTH], struct in_conninfo *inc)
538{
539 SIPHASH_CTX ctx;
540 uint64_t siphash;
541
542 SipHash24_Init(&ctx);
543 SipHash_SetKey(&ctx, key);
544 switch (inc->inc_flags & INC_ISIPV6) {
545#ifdef INET
546 case 0:
547 SipHash_Update(&ctx, &inc->inc_faddr, sizeof(inc->inc_faddr));
548 break;
549#endif
550#ifdef INET6
551 case INC_ISIPV6:
552 SipHash_Update(&ctx, &inc->inc6_faddr, sizeof(inc->inc6_faddr));
553 break;
554#endif
555 }
556 SipHash_Final((u_int8_t *)&siphash, &ctx);
557
558 return (siphash);
559}
560
561static uint64_t
562tcp_fastopen_make_psk_cookie(uint8_t *psk, uint8_t *cookie, uint8_t cookie_len)

Callers 1

Calls 3

SipHash_SetKeyFunction · 0.85
SipHash_UpdateFunction · 0.85
SipHash_FinalFunction · 0.85

Tested by

no test coverage detected