plan 9 kernel history: overview | file list | diff list

1998/0404/port/auth.c (diff list | history)

1997/0327/sys/src/9/port/auth.c:478,4831998/0404/sys/src/9/port/auth.c:478,501 (short | long | prev | next)
Add authcheckread.
rsc Fri Mar 4 12:44:25 2005
1993/0731    
} 
 
/* 
1998/0404    
 *  reading authcheck after writing into it yields the 
 *  nonce key 
 */ 
long 
authcheckread(Chan *c, char *a, int n) 
{ 
	Crypt *cp; 
 
	cp = c->aux; 
	if(cp == nil) 
		error(Ebadarg); 
	if(n < TICKETLEN)) 
		error(Ebadarg); 
	convT2M(&cp->t, a, nil); 
	return sizeof(cp->t); 
} 
 
/* 
1993/0731    
 *  called by devcons() for #c/authenticator 
 * 
 *  a read after a write of a ticket (or ticket+id) returns an authenticator 
1997/0327/sys/src/9/port/auth.c:522,5281998/0404/sys/src/9/port/auth.c:540,550
1993/0731    
	cp->a.num = AuthAc; 
	memmove(cp->a.chal, cp->t.chal, CHALLEN); 
	convA2M(&cp->a, cp->tbuf, cp->t.key); 
	memmove(a, cp->tbuf, AUTHENTLEN); 
1998/0404    
 
	if(n >= AUTHENTLEN) 
		memmove(a, cp->tbuf, AUTHENTLEN); 
	if(n >= AUTHENTLEN + TICKETLEN) 
		convT2M(&cp->t, a+AUTHENTLEN, nil); 
1993/0731    
 
1993/0428    
	return n; 
} 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)