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/libauthsrv/convTR2M.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sys/src/libauthsrv/convTR2M.c') diff --git a/sys/src/libauthsrv/convTR2M.c b/sys/src/libauthsrv/convTR2M.c index 3a7610a71..0bbe9cb6f 100644 --- a/sys/src/libauthsrv/convTR2M.c +++ b/sys/src/libauthsrv/convTR2M.c @@ -9,11 +9,13 @@ #define STRING(x,n) memmove(p, f->x, n); p += n int -convTR2M(Ticketreq *f, char *ap) +convTR2M(Ticketreq *f, char *ap, int n) { - int n; uchar *p; + if(n < TICKREQLEN) + return 0; + p = (uchar*)ap; CHAR(type); STRING(authid, 28); /* BUG */ @@ -24,4 +26,3 @@ convTR2M(Ticketreq *f, char *ap) n = p - (uchar*)ap; return n; } - -- cgit v1.2.3