ape: add auth library Reference: /n/atom/patch/applied2013/apeauth Date: Tue May 28 03:18:29 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/ape/lib/auth/authsrv.h Thu Jan 1 00:00:00 1970 +++ /sys/src/ape/lib/auth/authsrv.h Tue May 21 19:21:36 2013 @@ -0,0 +1,18 @@ +enum +{ + ANAMELEN= 28, /* name max size in previous proto */ + AERRLEN= 64, /* errstr max size in previous proto */ + DOMLEN= 48, /* authentication domain name length */ + DESKEYLEN= 7, /* encrypt/decrypt des key length */ + CHALLEN= 8, /* plan9 sk1 challenge length */ + NETCHLEN= 16, /* max network challenge length (used in AS protocol) */ + CONFIGLEN= 14, + SECRETLEN= 32, /* secret max size */ + + KEYDBOFF= 8, /* bytes of random data at key file's start */ + OKEYDBLEN= ANAMELEN+DESKEYLEN+4+2, /* old key file entry length */ + KEYDBLEN= OKEYDBLEN+SECRETLEN, /* key file entry length */ + OMD5LEN= 16, +}; + +extern int passtokey(char*, char*); --- /sys/src/ape/lib/auth/fcall.h Thu Jan 1 00:00:00 1970 +++ /sys/src/ape/lib/auth/fcall.h Tue May 21 19:06:34 2013 @@ -0,0 +1,20 @@ +#define VERSION9P "9P2000" +#define MAXWELEM 16 + +#define GBIT8(p) ((p)[0]) +#define GBIT16(p) ((p)[0]|((p)[1]<<8)) +#define GBIT32(p) ((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) +#define GBIT64(p) ((u32int)((p)[0]|((p)[1]<<8)|((p)[2]<<16)|((p)[3]<<24)) |\ + ((vlong)((p)[4]|((p)[5]<<8)|((p)[6]<<16)|((p)[7]<<24)) << 32)) + +#define PBIT8(p,v) (p)[0]=(v) +#define PBIT16(p,v) (p)[0]=(v);(p)[1]=(v)>>8 +#define PBIT32(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24 +#define PBIT64(p,v) (p)[0]=(v);(p)[1]=(v)>>8;(p)[2]=(v)>>16;(p)[3]=(v)>>24;\ + (p)[4]=(v)>>32;(p)[5]=(v)>>40;(p)[6]=(v)>>48;(p)[7]=(v)>>56 + +#define BIT8SZ 1 +#define BIT16SZ 2 +#define BIT32SZ 4 +#define BIT64SZ 8 +#define QIDSZ (BIT8SZ+BIT32SZ+BIT64SZ) --- /sys/src/ape/lib/auth/mkfile Thu Jan 1 00:00:00 1970 +++ /sys/src/ape/lib/auth/mkfile Tue May 21 19:44:44 2013 @@ -0,0 +1,39 @@ +APE=/sys/src/ape +<$APE/config + +LIB=/$objtype/lib/ape/libauth.a +OFILES=\ + amount.$O\ + amount_getkey.$O\ + attr.$O\ + auth_attr.$O\ + auth_challenge.$O\ + auth_chuid.$O\ + auth_getkey.$O\ + auth_getuserpasswd.$O\ + auth_proxy.$O\ + auth_respond.$O\ + auth_rpc.$O\ + auth_userpasswd.$O\ + auth_wep.$O\ + login.$O\ +# newns.$O\ +# noworld.$O\ + +HFILES=\ + /sys/include/ape/auth.h\ + /sys/src/libauth/authlocal.h\ + ../9/libc.h + +UPDATE=\ + mkfile\ + $HFILES\ + ${OFILES:%.$O=%.c}\ + ${LIB:/$objtype/%=/386/%}\ + +