		IFND	SPIRIT_I
SPIRIT_I	SET	1
**
** $VER: spirit.i 1.2 (18.3.98)
**
** include file for spirit keymaker
**
** Copyright (C) 1998 by Sunbeam/DigitalCorruption
**

	IFND	EXEC_TYPES_I
	INCLUDE	"exec/types.i"
	ENDC
	IFND	UTILITY_TAGITEM_I
	INCLUDE	"utility/tagitem.i"
	ENDC

** KeyBase Structure ******************************************************
**
** This structure are pointed in A5.

	STRUCTURE	KeyBase,0
	  APTR		kb_Name		;APTR to Name:
	  APTR		kb_Serial	;APTR to Serial:
	  APTR		kb_Street	;APTR to Street:
	  APTR		kb_City		;APTR to ZIP/City:
	  APTR		kb_Country	;APTR to Country:
	  APTR		kb_Computer	;APTR to Computer:
	  APTR		kb_eMail	;APTR to eMail:
	  APTR		kb_Phone	;APTR to Phone:
	  ULONG		kb_SerialHEX	;see below
	  ULONG		kb_SerialDEC	;see below
	  APTR		kb_KeyBuffer	;APTR to allocated keyfile buffer
	  APTR		kb_TempBuffer	;APTR to allocated temp buffer
          FPTR		kb_SaveFile	;file save function
	LABEL		kb_SIZEOF

** SerialHEX/DEC:
** Here you can find the converted serial number.
** For example the user have entered "12345":
** kb_Serial includes the String kb_SerialDEC includes $12345
** kb_SerialHEX includes $3039

** Flags for SPT_Flags ****************************************************

	BITDEF	FLG,HEXSER,0		;allow in serial hex chars. (A-F)
	BITDEF	FLG,RNDFILL,1		;fill keyfile with random bytes
	BITDEF	FLG,RNDFILLTMP,2	;fill tempbuffer with random bytes
	BITDEF	FLG,CHECKEMPTY,3	;check for empty strings.
					;an empty string or only spaces
					;are not allowed!
	BITDEF	FLG,DYNAMIC,4		;set this flag for dynamic key lengths
	BITDEF	FLG,CRYPTED,5		;will set auto. from the crypt tool!

** Global Flags ***********************************************************

	ENUM	TAG_USER
	EITEM	SPT_Name		;name of the program
	EITEM	SPT_Version		;program version
	EITEM	SPT_Cracker		;name of the cracker
	EITEM	SPT_Group		;group of the cracker
	EITEM	SPT_Date		;creation date
	EITEM	SPT_KeyLength		;length of the keyfile buffer
	EITEM	SPT_KeyName		;keyfile name w/o path
	EITEM	SPT_KeyPath		;the path to the dest
	EITEM	SPT_Encrypt		;pointer to your encrypt routine
	EITEM	SPT_TempBuff		;length of the temp buffer or NULL for none
	EITEM	SPT_Flags		;see above
	EITEM	SPT_KeyAnno		;announcement after key saving (requester)
	EITEM	SPT_NameLen		;length of the max. Name: or NULL -> Disabled
	EITEM	SPT_SerialLen		;^^^
	EITEM	SPT_StreetLen		;^^^
	EITEM	SPT_CityLen		;^^^
	EITEM	SPT_CountryLen		;^^^
	EITEM	SPT_ComputerLen		;^^^
	EITEM	SPT_eMailLen		;^^^
	EITEM	SPT_PhoneLen		;^^^
	EITEM	SPT_EncryptLen		;length of your encrypt code
					;for the external keymodule crypter.
					;see in example.asm!

** Misc Stuff *************************************************************
**
** This Macro-Header must be in every keymodule!
** example:
**       KEYHEAD Tags
**Tags:  dc.l    SPT_Name,Name
**       dc.l    TAG_DONE
**

KEYHEAD	MACRO	;tags
	bra.s	.sc
	dc.b	"SPIRITKM"
	dc.l	\1

.sc	move.l	4.w,a6
	lea	.dn(pc),a1
	jsr	-408(a6)
	tst.l	d0
	beq.s	.nd
	move.l	d0,a6
	jsr	-60(a6)
	move.l	d0,d1
	beq.s	.cd
	lea	.st(pc),a0
	move.l	a0,d2
	moveq	#.stl,d3
	jsr	-48(a6)
.cd	move.l	a6,a1
	move.l	4.w,a6
	jsr	-414(a6)
.nd	moveq	#20,d0
	rts

.st	dc.b	"This is not an executable file.",10
	dc.b	"It's a key module for Spirit.",10,0
.stl	EQU	*-.st
.dn	dc.b	"dos.library",0
	cnop	0,2
	ENDM

** Return Codes ***********************************************************

RETURN_NOERR	EQU	0	;keyfile generated
RETURN_ERR	EQU	-1	;key not generated

***************************************************************************

	ENDC	;SPIRIT_I