Google
 

Trailing-Edge - PDP-10 Archives - SRI_NIC_PERM_SRC_1_19910112 - 6-sources/kryptn.mac
There are 4 other files named kryptn.mac in the archive. Click here to see a list.
	TITLE KRYPTN - Force File Structure Password Encryption - KWPaetzold

	SEARCH MONSYM,MACSYM
	.REQUIRE SYS:MACREL.REL
	SALL
	STDAC.
	.DIRECTIVE FLBLST

	DEFINE SYM(A,B),<A=B>
	DEFINE SYMS(A,B),<A==B>

				;VERSION INFO
	SYMS VWHO,0		;WHO LAST MODIFIED
	SYMS VMAJOR,1		;MAJOR VERSION NUMBER
	SYMS VMINOR,0		;MINOR VERSION NUMBER
	SYMS VEDIT,0		;EDIT NUMBER

	DEFINE TYPE(S),<
	HRROI T1,[ASCIZ\
S\]
	PSOUT>

	DEFINE TYPEN(S),<
	HRROI T1,[ASCIZ\S\]
	PSOUT>

	DEFINE NUMO(A,R,S),<
	MOVE T2,A
	MOVEI T1,.PRIOU
	MOVX T3,<S,,R>
	NOUT
	 JSYSF>

	DEFINE JSYSF,<ERCAL .JSYSF>
	DEFINE NOERR,<ERJMP .+1>

EVEC:				;ENTRY VECTOR
	JRST KRYPTN		;STARTING ADDRESS
	JRST KRYPTN 		;REENTER ADDRESS
	BYTE (3)VWHO(9)VMAJOR(6)VMINOR(18)VEDIT

KRYPTN:				;STARTING ADDRESS
	RESET			;STOP FORK POLUTION
	MOVE P,[IOWD PDLSIZ,PDL] ;GET A STACK POINTER
	MOVEI T1,.FHSLF		;THIS FORK
	RPCAP			;GET OUR PRIVS
	 JSYSF			;HANDLE ERRORS
	TXNN T3,<SC%OPR!SC%WHL>	;ARE WE SPECIAL?
	 JRST [	HALTF		;NO SO JUST STOP
		JRST .-1]	;NO CONTINUES
	TYPE < KRYPTN - Cause File Structure Directory Password Encryption>
	TYPE <>
	TYPE < ******* NOTICE *******>
	TYPE < This is a VERY dangerous program.  If you do not know what you>
	TYPE < are doing get out now!!!!>
	TYPE <>
KRYPT2:
	TYPE < Structure name:  > ;ASK FOR INPUT
	MOVEI T1,.PRIIN		;INPUT FROM TTY
	HRROI T2,STRSTR		;GET THE TARGET STRING POINTER
	MOVEI T3,STRSIZ*5-1	;GET MAX STRING LENGTH
	MOVEI T4,"J"-100	;TERMINATE ON A LINE FEED
	SIN			;STRING INPUT
	 ERJMP KRYPT2		;ASK AGAIN ON ERRORS
	TYPEN < Please Confirm: >
	MOVEI T1,.PRIIN		;INPUT FROM THE TTY
	HRROI T2,STRING		;PUT IT INTO STRING FOR NOW
	MOVEI T3,2		;TWO CHAR MAX
	MOVEI T4,"J"-100	;TERMINATE ON LF
	SIN			;INPUT CONFIRMATION
	 ERJMP KRYPT2		;HANDLE ERROS
	MOVX T1,<POINT 7,STRING> ;GET A POINTER
	ILDB T1,T1		;GET THE FIRST CHARACTER
	CAIE T1,"M"-100		;IS IT A CR?
	 JRST KRYPTN		;NO SO LETS DO IT OVER AGAIN
	MOVX T1,<POINT 7,STRING> ;GET TARGET POINTER
	MOVX T2,<POINT 7,STRSTR> ;GET SOURCE POINTER
	MOVEI T3,6		;SIX CHAR MAX
KRYPT3:				;STRUCTURE NAME LOOP
	ILDB T4,T2		;GET A BYTE
	CAIG T4," "		;CONTROL CHARACTER?
	 JRST KRYPT4		;NO SO WE ARE DONE
	CAIN T4,":"		;CHECK THE DELIMITOR
	 JRST KRYPT4		;THAT WAS IT
	IDPB T4,T1		;DEPOSIT THE BYTE
	SOJG T3,KRYPT3		;LOOP FOR SIX CHARACTERS MAX
KRYPT4:				;NOW APPEND THE REST OF THE STRING
	HRROI T2,[ASCIZ/:<*>/]	;ALL DIRECTORIES OF THIS STRING
	SETZB T3,T4		;NO WIERD LIMITS
	SOUT			;APPEND THE REST OF THE STRING
	 JSYSF
	SETZ T2,		;GET A NULL BYTE
	IDPB T2,T1		;APPEND THE NULL

;	NOW GET THE FIRST DIRECTORY

	MOVX T1,<RC%AWL>	;ALLOW WILD CARDS
	HRROI T2,STRING		;DIRECTORY STRING NAME
	RCDIR			;GET A DIRECTORY NUMBER
	 JSYSF
	MOVEM T3,DIRNUM		;SAVE THE DIRECTORY NUMBER
KRYPT5:				;THIS IS THE LOOP
	TYPE < Converting >	;PROMPT THE OUTPUT
	HRROI T1,DIRNAM		;PUT DIRECTORY NAME INTO DIRNAM
	MOVE T2,DIRNUM		;GET THE NUMBER
	DIRST			;OUTPUT THE DIRECTORY STRING
	 JSYSF
	HRROI T1,DIRNAM		;GET POINTER TO THE NAME
	PSOUT			;AND OUTPUT IT
	MOVEI T1,.CDPEV+1	;GET ARG BLK LENGTH
	MOVEM T1,DIRBLK+.CDLEN	;SAVE THE LENGTH FOR THE MONITOR TO FIND
	MOVE T1,DIRNUM		;GET THE DIRECTORY NUMBER
	MOVEI T2,DIRBLK		;GET THE DIRECTORY BLOCK ADDRESS
	HRROI T3,DIRCOD		;PASSWORD STORAGE ADDRESS
	GTDIR			;GET THE DIRECTORY INFORMATION
	 JSYSF			;HANDLE ERRORS
	SKIPE .CDPEV+DIRBLK	;ALLREADY ENCRYPTED?
	 JRST KRYPT8		;YES SO DO NOT DO IT AGAIN
	HRROI T1,DIRCOD		;GET THE POOINTER TO THE PASSWORD STRING
	MOVEM T1,DIRBLK+.CDPSW	;AND STORE IT INTO THE BLOCK
	HRROI T1,DIRNAM		;GET POINTER TO THE NAME
	MOVX T2,<CD%PSW!<DIRBLK>B35> ;SET THE PASSWORD
	CRDIR			;ENCRYPT THE MOTHER
	 ERJMP KRYPT7		;HANDLE ERRORS

;	NOW GET THE NEXT DIRECTORY

	TYPEN < [OK]>		;TELL USER IT WORKED
	JRST KRYPT8		;JOIN FLOW

KRYPT7:				;HERE ON CRDIR ERRORS
	TYPEN < [FAILED]>	;TELL USER IT DID NOT WORK
KRYPT8:
	MOVX T1,<RC%STP!RC%AWL>	;ALLOW WILDCARDS AND STEP
	HRROI T2,STRING		;GET THE DIRECTORY STRING
	MOVE T3,DIRNUM		;GET THE LAST DIRECTORY NUMBER
	RCDIR			;GET THE NEXT DIRECTORY NUMBER
	 JSYSF
	JUMPE T3,KRYPT6		;IF ZERO THEN WE ARE ALL DONE
	MOVEM T3,DIRNUM		;SAVE THE DIRECTORY NUMBER
	JRST KRYPT5		;LOOP FOR ALL THE DIRECTORIES

KRYPT6:				;HERE WHEN WE ARE ALL DONE
	HALTF			;STOP
	JRST KRYPTN		;ON CONTINUE LETS DO IT AGAIN

.JSYSF:				;HERE FROM JSYSF MACRO
	MOVEM 17,ERRACS+17	;SAVE AC 17
	MOVEI 17,ERRACS		;GET BLT AC
	BLT 17,ERRACS+16	;SAVE ACS 0-16
	MOVE 17,ERRACS+17	;GET AC 17 BACK
	TYPE <?JSYS ERROR AT USER PC >
	HRRZ T2,0(P)		;GET THE ERROR PC
	MOVEM T2,ERRPC		;SAVE THE ERROR PC
	NUMO T2,10		;OUTPUT THE ERORR PC
	TYPE <?>		;PROMPT THE ERROR STRING
	MOVEI T1,.PRIOU		;OUTPUT TO TTY
	MOVX T2,<.FHSLF,,-1>	;MY LAST ERROR
	SETZB T3,T4		;NO FUNNY LIMITS
	ERSTR			;OUTPUT THE ERROR STRING
	 NOERR			;HANDLE ANY ERRORS
	 NOERR			;HANDLE ANY ERRORS
	HALTF			;STOP
	JRST .-1		;NO CONTINUES

	SYM PDLSIZ,10		;STACK SIZE
	SYM STRSIZ,10		;STRING SIZE
	SYM NAMSIZ,20		;DIRECTORY NAME STRING
	SYM CODSIZ,11		;PASSWORD STORAGE

PDL:	BLOCK PDLSIZ		;PDL STACK
STRSTR:	BLOCK STRSIZ		;STRUCTURE NAME
DIRNUM:	Z			;DIRECTORY NUMBER RETURNED BY RCDIR
DIRNAM:	BLOCK NAMSIZ		;DIRECTORY NAME STORAGE
DIRCOD:	BLOCK CODSIZ		;DIRECTORY PASSWORD STORAGE
DIRBLK:	BLOCK 100		;GTDIR BLOCK STORAGE
STRING:	BLOCK STRSIZ		;DIRECTORY STRING FOR RCDIR
ERRACS:	BLOCK 20		;ERROR AC STORAGE
ERRPC:	Z			;ERROR PC STORAGE

	END <3,,EVEC>		;THATS ALL FOLKS