Browse Source

Added factotum byte array to k8cpu.root.c file. It requires you run sys/src/cmd/auth/factotum/BUILDKFACTOTUM script to build the binary. Build.bash will eat as bootk8cpu, dumping text and data separated and concatenating all in one file before run data2c.

Elbing Miss 9 years ago
parent
commit
516518fa30

+ 9 - 8
sys/src/9/k10/build.bash

@@ -111,16 +111,17 @@ compiling()
 	data2c bootk8cpu_out boot$CONF.all.out >> k8cpu.root.c
 
 	# We haven't these for now. Must be concatenated text+data as with boot$CONF.elf.out.
+	# You need to run BUILDKFACTOTUM into /sys/src/cmd/auth/factotum
+	# in order to have working this.
 
-	#cp /amd64/bin/auth/factotum factotum
-	#objcopy -j .text  -O binary factotum.elf.out factotum.code.out
-	#objcopy -j .data  -O binary factotum.elf.out factotum.data.out
-	#file factotum*.out
-	#cat factotum.code.out factotum.data.out >> factotum.all.out
-    #data2c _amd64_bin_auth_factotum  factotum.all.out >> k8cpu.root.c
+	objcopy -j .text  -O binary /sys/src/cmd/auth/factotum/factotum.elf.out factotum.code.out
+	objcopy -j .data  -O binary /sys/src/cmd/auth/factotum/factotum.elf.out factotum.data.out
+	file factotum*.out
+	cat factotum.code.out factotum.data.out >> factotum.all.out
+	data2c _amd64_bin_auth_factotum  factotum.all.out >> k8cpu.root.c
 
-    #cp /amd64/bin/ip/ipconfig ipconfig
-    #objcopy -j .text  -O binary ipconfig.elf.out ipconfig.code.out
+	#cp /amd64/bin/ip/ipconfig ipconfig
+	#objcopy -j .text  -O binary ipconfig.elf.out ipconfig.code.out
 	#objcopy -j .data  -O binary ipconfig.elf.out ipconfig.data.out
 	#file ipconfig*.out
 	#cat ipconfig.code.out ipconfig.data.out >> ipconfig.all.out

+ 4 - 4
sys/src/9/k10/hack.S

@@ -1,7 +1,7 @@
-.global _amd64_bin_auth_factotumcode
-_amd64_bin_auth_factotumcode: popq %rdi; movq $_amd64_bin_auth_factotumcode, %rsi; call badcall // ndnr
-.global _amd64_bin_auth_factotumlen
-_amd64_bin_auth_factotumlen: popq %rdi; movq $_amd64_bin_auth_factotumlen, %rsi; call badcall // ndnr
+//.global _amd64_bin_auth_factotumcode
+//_amd64_bin_auth_factotumcode: popq %rdi; movq $_amd64_bin_auth_factotumcode, %rsi; call badcall // ndnr
+//.global _amd64_bin_auth_factotumlen
+//_amd64_bin_auth_factotumlen: popq %rdi; movq $_amd64_bin_auth_factotumlen, %rsi; call badcall // ndnr
 .global _amd64_bin_ip_ipconfigcode
 _amd64_bin_ip_ipconfigcode: popq %rdi; movq $_amd64_bin_ip_ipconfigcode, %rsi; call badcall // ndnr
 .global _amd64_bin_ip_ipconfiglen

+ 35 - 0
sys/src/cmd/auth/factotum/BUILDKFACTOTUM

@@ -0,0 +1,35 @@
+#!/bin/bash
+set -e
+
+CC=gcc
+CFLAGS="-mcmodel=small -O0 -fplan9-extensions -ffreestanding -fno-builtin -Wall -Wno-missing-braces -Wno-parentheses -Wno-unknown-pragmas -Wuninitialized -Wmaybe-uninitialized -I/amd64/include -I/sys/include -c -g "
+LIB_DIR="/amd64/lib"
+LDFLAGS=-L${LIB_DIR}
+LD=ld
+
+rm -f *.o
+$CC $CFLAGS -c \
+apop.c \
+chap.c \
+confirm.c \
+fs.c \
+httpdigest.c \
+log.c \
+p9any.c \
+p9cr.c \
+p9sk1.c \
+pass.c \
+rpc.c \
+rsa.c \
+secstore.c \
+util.c \
+wep.c \
+hack.S \
+
+echo "linking.."
+echo
+$LD -static -o factotum.elf.out *.o $LDFLAGS -l9p -lauth -lauthsrv -lndb -lsec -lString -lthread -lmp -lip -lc -emain -Ttext=0x200020
+
+$CC $CFLAGS -c fgui.c 
+$LD -static -o fgui.elf.out fgui.o $LDFLAGS -lcontrol -ldraw -l9p -lauth -lauthsrv -lndb -lsec -lString -lthread -lmp -lip -lc -emain -Ttext=0x200020
+rm *.o

+ 2 - 2
sys/src/cmd/auth/factotum/dat.h

@@ -204,7 +204,7 @@ void		askuser(char*);
 int		attrnamefmt(Fmt *fmt);
 int		canusekey(Fsstate*, Key*);
 void		closekey(Key*);
-uchar	*convAI2M(AuthInfo*, uchar*, int);
+unsigned char	*convAI2M(AuthInfo*, unsigned char*, int);
 void		disablekey(Key*);
 char		*estrappend(char*, char*, ...);
 #pragma varargck argpos estrappend 2
@@ -243,5 +243,5 @@ extern Proto p9cr, vnc;			/* p9cr.c */
 extern Proto pass;			/* pass.c */
 extern Proto rsa;			/* rsa.c */
 extern Proto wep;			/* wep.c */
-/* extern Proto srs;			/* srs.c */
+/* extern Proto srs;*/			/* srs.c */
 extern Proto httpdigest;		/* httpdigest.c */

+ 1 - 1
sys/src/cmd/auth/factotum/fgui.c

@@ -204,7 +204,7 @@ readreq(void *a)
 		sleep(5000);
 	}
 }
-#endif asdf
+#endif //asdf
 
 /*
  *  open/close the keyboard, mouse and resize channels

+ 3 - 3
sys/src/cmd/auth/factotum/fs.c

@@ -226,7 +226,7 @@ private(void)
 }
 
 static void
-notifyf(void*, char *s)
+notifyf(void* v, char *s)
 {
 	if(strncmp(s, "interrupt", 9) == 0)
 		noted(NCONT);
@@ -296,7 +296,7 @@ fillstat(Dir *dir, char *name, int type, int path, uint32_t perm)
 }
 
 static int
-rootdirgen(int n, Dir *dir, void*)
+rootdirgen(int n, Dir *dir, void* v)
 {
 	if(n > 0)
 		return -1;
@@ -305,7 +305,7 @@ rootdirgen(int n, Dir *dir, void*)
 }
 
 static int
-fsdirgen(int n, Dir *dir, void*)
+fsdirgen(int n, Dir *dir, void* v)
 {
 	if(n >= nelem(dirtab))
 		return -1;

+ 17 - 0
sys/src/cmd/auth/factotum/hack.S

@@ -0,0 +1,17 @@
+.globl mpvecadd
+mpvecadd:
+.globl mpvecsub
+mpvecsub:
+.globl mpkaratsuba
+mpkaratsuba:
+.globl mpvecdigmuladd
+mpvecdigmuladd:
+.globl mpdiv
+mpdiv:
+.globl mpdigdiv
+mpdigdiv:
+.globl mpvecdigmuladd
+mpvecdigmuladd:
+.globl mpvecdigmulsub
+mpvecdigmulsub:
+

+ 1 - 1
sys/src/cmd/auth/factotum/p9any.c

@@ -63,7 +63,7 @@ static char *phasenames[Maxphase] =
 };
 
 static int
-p9anyinit(Proto*, Fsstate *fss)
+p9anyinit(Proto* p, Fsstate *fss)
 {
 	int iscli;
 	State *s;

+ 1 - 1
sys/src/cmd/auth/factotum/p9cr.c

@@ -242,7 +242,7 @@ vncclosekey(Key *k)
 }
 
 static int
-vncresponse(Fsstate*, State *s)
+vncresponse(Fsstate* f, State *s)
 {
 	DESstate des;
 

+ 1 - 1
sys/src/cmd/auth/factotum/pass.c

@@ -91,7 +91,7 @@ passread(Fsstate *fss, void *va, uint *n)
 }
 
 static int
-passwrite(Fsstate *fss, void*, uint)
+passwrite(Fsstate *fss, void* v, uint u)
 {
 	return phaseerror(fss, "write");
 }

+ 1 - 1
sys/src/cmd/auth/factotum/rsa.c

@@ -98,7 +98,7 @@ Error:
 }
 
 static int
-rsainit(Proto*, Fsstate *fss)
+rsainit(Proto* p, Fsstate *fss)
 {
 	Keyinfo ki;
 	State *s;

+ 2 - 2
sys/src/cmd/auth/factotum/wep.c

@@ -26,7 +26,7 @@ enum
 };
 
 static int
-wepinit(Proto*, Fsstate *fss)
+wepinit(Proto* p, Fsstate *fss)
 {
 	int ret;
 	Key *k;
@@ -64,7 +64,7 @@ wepclose(Fsstate *fss)
 }
 
 static int
-wepread(Fsstate *fss, void*, uint*)
+wepread(Fsstate *fss, void* v, uint* u)
 {
 	return phaseerror(fss, "read");
 }