FreeBSD/contrib/ntp/libntp/authkeys.c
/*
 * allocsymkey - common code to allocate and link in symkey
 *
 * secret must be allocated with a free-compatible allocator.  It is
 * owned by the referring symkey structure, and will be free()d by
 * freesymkey().
 */
common code to allocate and link in symkey
secret must be allocated with a free-compatible allocator.  It is
owned by the referring symkey structure, and will be free()d by
freesymkey().
common code to allocate and link in symkey secret must be allocated with a free - compatible allocator . It is owned by the referring symkey structure and will be free () d by freesymkey () .
static void
allocsymkey(
	keyid_t		id,
	u_short		flags,
	u_short		type,
	u_long		lifetime,
	size_t		secretsize,
	u_char *	secret,
	KeyAccT *	ka
	)
{
	symkey *	sk;
	symkey **	bucket;
	bucket = &key_hash[KEYHASH(id)];
	if (authnumfreekeys < 1)
		auth_moremem(-1);
	UNLINK_HEAD_SLIST(sk, authfreekeys, llink.f);
	DEBUG_ENSURE(sk != NULL);
	sk->keyid = id;
	sk->flags = flags;
	sk->type = type;
	sk->secretsize = secretsize;
	sk->secret = secret;
	sk->keyacclist = ka;
	sk->lifetime = lifetime;
	LINK_SLIST(*bucket, sk, hlink);
	LINK_TAIL_DLIST(key_listhead, sk, llink);
	authnumfreekeys--;
	authnumkeys++;
}
static void allocsymkey ( keyid_t id , u_short flags , u_short type , u_long lifetime , size_t secretsize , u_char * secret , KeyAccT * ka ) { symkey * sk ; symkey * * bucket ; bucket = & key_hash [ KEYHASH ( id ) ] ; if ( authnumfreekeys < 1 ) auth_moremem ( -1 ) ; UNLINK_HEAD_SLIST ( sk , authfreekeys , llink . f ) ; DEBUG_ENSURE ( sk != NULL ) ; sk -> keyid = id ; sk -> flags = flags ; sk -> type = type ; sk -> secretsize = secretsize ; sk -> secret = secret ; sk -> keyacclist = ka ; sk -> lifetime = lifetime ; LINK_SLIST ( * bucket , sk , hlink ) ; LINK_TAIL_DLIST ( key_listhead , sk , llink ) ; authnumfreekeys -- ; authnumkeys ++ ; }
allocsymkey - common code to allocate and link in symkey
 secret must be allocated with a free-compatible allocator.
allocsymkey - common code to allocate and link in symkey secret must be allocated with a free - compatible allocator .