summaryrefslogtreecommitdiff
path: root/sys/src/libauthsrv/readnvram.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-08-19 21:06:17 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-08-19 21:06:17 +0200
commit02cfcfeab46f36aad95263ed40d19df7bd5eddef (patch)
tree30f67204be8d474b2c761e8944c20d042df1a08b /sys/src/libauthsrv/readnvram.c
parentf785d4da07349c7bb250eb00a3f2bed3eb170828 (diff)
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.
Diffstat (limited to 'sys/src/libauthsrv/readnvram.c')
-rw-r--r--sys/src/libauthsrv/readnvram.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/src/libauthsrv/readnvram.c b/sys/src/libauthsrv/readnvram.c
index ef9c91249..5d054725d 100644
--- a/sys/src/libauthsrv/readnvram.c
+++ b/sys/src/libauthsrv/readnvram.c
@@ -292,11 +292,14 @@ readnvram(Nvrsafe *safep, int flag)
readcons("secstore key", nil, 1, safe->config,
sizeof safe->config);
for(;;){
- if(readcons("password", nil, 1, in, sizeof in)
- == nil)
+ Authkey k;
+
+ if(readcons("password", nil, 1, in, sizeof in) == nil)
goto Out;
- if(passtokey(safe->machkey, in))
+ if(passtokey(&k, in)){
+ memmove(safe->machkey, k.des, DESKEYLEN);
break;
+ }
}
}