From 02cfcfeab46f36aad95263ed40d19df7bd5eddef Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Wed, 19 Aug 2015 21:06:17 +0200 Subject: libauthsrv: generalize ticket service, not hardcoding ticket format and DES encryption this is in preparation for replacing DES ticket encryption with something better. but first need to make the code stop making assumptions. the wire encoding of the Ticket might be variable length with TICKETLEN just giving an upper bound. the details will be handled by libauthsrv _asgetticket() and _asgetresp() funciotns. the Authenticator and Passwordreq structures are encrypted with the random ticket key. The encryption schmeme will depend on the Ticket format used, so we pass the Ticket* structure instead of the DES key. introduce Authkey structure that will hold all the required cryptographic keys instead of passing DES key. --- sys/src/cmd/auth/netkey.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/src/cmd/auth/netkey.c') diff --git a/sys/src/cmd/auth/netkey.c b/sys/src/cmd/auth/netkey.c index ee7b10a28..faca0f3d5 100644 --- a/sys/src/cmd/auth/netkey.c +++ b/sys/src/cmd/auth/netkey.c @@ -15,7 +15,8 @@ usage(void) void main(int argc, char *argv[]) { - char buf[32], pass[32], key[DESKEYLEN]; + Authkey key; + char buf[32], pass[32]; char *s; int n; @@ -33,7 +34,7 @@ main(int argc, char *argv[]) } readln("Password: ", pass, sizeof pass, 1); - passtokey(key, pass); + passtokey(&key, pass); for(;;){ print("challenge: "); @@ -43,7 +44,7 @@ main(int argc, char *argv[]) buf[n] = '\0'; n = strtol(buf, 0, 10); sprint(buf, "%d", n); - netcrypt(key, buf); + netcrypt(key.des, buf); print("response: %s\n", buf); } } -- cgit v1.2.3