shithub: riscv

Download patch

ref: e48a5832b26f817ab06db2d42f88288373b78fac
parent: 167ea748f8b20a5940108ef5b23132310213e77e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 20 16:56:00 EDT 2015

kfs: adjust to new libauthsrv

--- a/sys/src/cmd/disk/kfs/auth.c
+++ b/sys/src/cmd/disk/kfs/auth.c
@@ -8,6 +8,7 @@
 
 int allownone;
 Nvrsafe nvr;
+Authkey authkey; 
 int didread;
 
 /*
@@ -18,8 +19,10 @@
 {
 	int i;
 
-	if(!didread && readnvram(&nvr, 0) >= 0)
+	if(!didread && readnvram(&nvr, 0) >= 0){
+		memmove(authkey.des, nvr.machkey, DESKEYLEN);
 		didread = 1;
+	}
 
 	srand(truerand());
 	for(i = 0; i < CHALLEN; i++)
@@ -58,7 +61,7 @@
 		return 0;
 
 	/* decrypt and unpack ticket */
-	convM2T(in->ticket, &t, nvr.machkey);
+	convM2T(in->ticket, sizeof(in->ticket), &t, &authkey);
 	if(t.num != AuthTs){
 print("bad AuthTs num\n");
 		return 0;
@@ -65,7 +68,7 @@
 	}
 
 	/* decrypt and unpack authenticator */
-	convM2A(in->auth, &a, t.key);
+	convM2A(in->auth, sizeof(in->auth), &a, &t);
 	if(a.num != AuthAc){
 print("bad AuthAc num\n");
 		return 0;
@@ -110,7 +113,7 @@
 	/* craft a reply */
 	a.num = AuthAs;
 	memmove(a.chal, cp->rchal, CHALLEN);
-	convA2M(&a, ou->rauth, t.key);
+	convA2M(&a, ou->rauth, sizeof(ou->rauth), &t);
 
 	cp->authed = 1;
 	return 1;