Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Progetti e altra roba per Linux git-svn-id: svn://10.65.10.50/trunk@11293 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
05b98fcbb2
commit
2d41198b3e
229
linux/eutron/LEGGIMI
Executable file
229
linux/eutron/LEGGIMI
Executable file
@ -0,0 +1,229 @@
|
|||||||
|
EUTRON SPA
|
||||||
|
INFORMATION SECURITY SOLUTION
|
||||||
|
|
||||||
|
Phone +39-(0)35-697011
|
||||||
|
Fax +39-(0)35-697092
|
||||||
|
|
||||||
|
Internet : http://www.smartkey.eutron.it
|
||||||
|
Technical support : helpdesk@eutron.it
|
||||||
|
Commercial info : info@eutron.it
|
||||||
|
|
||||||
|
|
||||||
|
SmartKey Parallel and USB driver for Linux
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
Questo driver funziona per kernel dal 2.4.10 al 2.4.19 compilato con gcc-3.2.2
|
||||||
|
|
||||||
|
Il pacchetto fornisce un'interfaccia tra i programmi scritti in
|
||||||
|
linguaggio C e il driver della chiave SMARTKEY. L'interfaccia e`
|
||||||
|
completamete compatibile con quella disponibile in ambiente MS-DOS.
|
||||||
|
Questo permette un facile trasporto in ambiente Unix dei programmi
|
||||||
|
sviluppati per il sistema operativo MS-DOS.
|
||||||
|
|
||||||
|
|
||||||
|
CONTENUTO DEL PACCHETTO
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Il pacchetto e` costituito dai seguenti file:
|
||||||
|
|
||||||
|
LEGGIMI Contiene delle informazioni relative al pacchetto.
|
||||||
|
E' il file che state leggendo.
|
||||||
|
clink.o Costituisce l'interfaccia tra le applicazioni in
|
||||||
|
linguaggio C e il driver della chiave SMARTKEY.
|
||||||
|
clink.h Definisce la struttura dell'interfaccia di clink.o.
|
||||||
|
Deve essere incluso nei file C che utilizzano la
|
||||||
|
chiave SMARTKEY.
|
||||||
|
smartdem.c Esempio di utilizzo della chiave SMARTKEY scritto in
|
||||||
|
linguaggio C.
|
||||||
|
smartdem Forma eseguibile del programma esempio.
|
||||||
|
skey*.o Driver della chiave
|
||||||
|
skinstall Script per l'installazione automatica
|
||||||
|
skuninstall Script per la disinstallazione automatica
|
||||||
|
skeyver Utility per impostare la versione del kernel nel modulo skey.o
|
||||||
|
|
||||||
|
|
||||||
|
SUPPORTO USB
|
||||||
|
------------
|
||||||
|
|
||||||
|
Il driver SmartKey, come ogni altro driver USB, richiede che i moduli USB
|
||||||
|
del kernel siano caricati ed attivi.
|
||||||
|
Generalmente questo si puo' ottenere con i comandi :
|
||||||
|
|
||||||
|
insmod usbcore
|
||||||
|
insmod usb-uhci
|
||||||
|
|
||||||
|
per PC con con USB controller UHCI di Intel, VIA, ...
|
||||||
|
|
||||||
|
insmod usbcore
|
||||||
|
insmod usb-ohci
|
||||||
|
|
||||||
|
per PC con un USB controller OHCI di Compaq, iMacs, OPTi, SiS, ALi...
|
||||||
|
|
||||||
|
|
||||||
|
AGGIORNAMENTO
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Per aggiornare i precedenti driver SmartKey e' necessario rilinkare la
|
||||||
|
propria applicazione con il nuovo oggetto clink.o.
|
||||||
|
|
||||||
|
Se questo non viene effettuato, l'applicazione sara' in grado di funzionare
|
||||||
|
solo con la prima chiave USB inserita e solo con le chiavi parallele
|
||||||
|
agli indirizzi 0x3BC e 0x378. Si perderebbe l'uso della porta parallela
|
||||||
|
all'indirizzo 0x278 sostituito con la prima chiave USB.
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLAZIONE AUTOMATICA
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Avviare lo script skinstall con i permessi di root con i comandi:
|
||||||
|
|
||||||
|
chmod a+x skinstall
|
||||||
|
./skinstall
|
||||||
|
|
||||||
|
L'installazione prevede la configurazione del sistema per il caricamento
|
||||||
|
automatico del modulo SmartKey al primo utilizzo.
|
||||||
|
|
||||||
|
Per disinstallare il driver utilizzare invece i comandi:
|
||||||
|
|
||||||
|
chmod a+x skuninstall
|
||||||
|
./skuninstall
|
||||||
|
|
||||||
|
Ad ogni cambiamento di versione del kernel e' necessaria una reinstallazione.
|
||||||
|
|
||||||
|
Per avviare il l'applicazione di demo utilizzare i comandi :
|
||||||
|
|
||||||
|
chmod a+x smartdem
|
||||||
|
./smartdem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLAZIONE MANUALE
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Per installare il driver si segua la procedura seguente:
|
||||||
|
|
||||||
|
1) Entrare nel sistema come super-user.
|
||||||
|
|
||||||
|
2) Posizionarsi nel direttorio /dev con il comando:
|
||||||
|
|
||||||
|
cd /dev
|
||||||
|
|
||||||
|
creare i file di accesso alla chiave mediante i comandi:
|
||||||
|
|
||||||
|
mknod skey0 c 59 0
|
||||||
|
mknod skey1 c 59 1
|
||||||
|
mknod skey2 c 59 2
|
||||||
|
mknod skey3 c 59 3
|
||||||
|
mknod skey4 c 59 4
|
||||||
|
mknod skey5 c 59 5
|
||||||
|
|
||||||
|
e cambiare le proprieta` e il gruppo dei file mediante i comandi:
|
||||||
|
|
||||||
|
chmod 666 skey?
|
||||||
|
chgrp daemon skey?
|
||||||
|
|
||||||
|
3) Identificare il driver per la propria configurazione. Ci sono varie
|
||||||
|
possibilita':
|
||||||
|
|
||||||
|
skey_R.o Kernel monoprocessore con le informazioni
|
||||||
|
di versione
|
||||||
|
skey_Rsmp_.o Kernel multiprocessore con le informazioni
|
||||||
|
di versione
|
||||||
|
skey_Rsmp.o Kernel multiprocessore con le informazioni
|
||||||
|
di versione specifico per RedHat
|
||||||
|
skey.o Kernel monoprocessore senza le informazioni
|
||||||
|
di versione
|
||||||
|
|
||||||
|
Un semplice test e' il comando :
|
||||||
|
|
||||||
|
grep printk /proc/ksyms
|
||||||
|
|
||||||
|
e dato l'output :
|
||||||
|
|
||||||
|
... printk_R1b7d4074 driver skey_R.o
|
||||||
|
... printk_Rsmp_1b7d4074 driver skey_Rsmp_.o
|
||||||
|
... printk_Rsmp1b7d4074 driver skey_Rsmp.o
|
||||||
|
altro driver skey.o
|
||||||
|
|
||||||
|
Rinominare quindi il driver identificato con il nome skey.o
|
||||||
|
|
||||||
|
4) Configurare il modulo skey.o con la versione di kernel corrente:
|
||||||
|
|
||||||
|
chmod a+x skeyver
|
||||||
|
./skeyver skey.o
|
||||||
|
|
||||||
|
5) Il driver skey.o e` sotto forma di modulo caricabile dinamicamente.
|
||||||
|
Quindi, prima di essere utilizzato, deve essere caricato con il comando:
|
||||||
|
|
||||||
|
insmod skey
|
||||||
|
|
||||||
|
6) Per configurare il driver per il caricamento automatico al primo
|
||||||
|
utilizzo effettuare le seguenti operazioni:
|
||||||
|
|
||||||
|
6.1) Aggiungere la riga:
|
||||||
|
|
||||||
|
alias char-major-59 skey
|
||||||
|
|
||||||
|
in fondo al file /etc/conf.modules
|
||||||
|
|
||||||
|
6.2) Copiare il file skey.o nella directory /lib/modules/KERNELVERSION/misc,
|
||||||
|
dove KERNELVERSION e' la versione del kernel.
|
||||||
|
La versione del kernel viene mostrata con il comando :
|
||||||
|
|
||||||
|
uname -r
|
||||||
|
|
||||||
|
6.3) Aggiornare le dipendenze dei moduli con il comando:
|
||||||
|
|
||||||
|
depmod -a
|
||||||
|
|
||||||
|
6.4) Scaricare dalla memoria una eventuale copia del driver con il comando:
|
||||||
|
|
||||||
|
rmmod skey
|
||||||
|
|
||||||
|
e verificare il caricamento automatico del modulo con il comando:
|
||||||
|
|
||||||
|
modprobe skey
|
||||||
|
|
||||||
|
L'assenza di messaggi di errore indica che il caricamento
|
||||||
|
e' avvenuto.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UTILIZZO
|
||||||
|
--------
|
||||||
|
|
||||||
|
Per utilizzare l'interfaccia clink.o e` necessario copiare il file nel
|
||||||
|
direttorio di lavoro e collegarlo agli altri file oggetto costituenti
|
||||||
|
il programma da proteggere. Nei file del programma applicativo che
|
||||||
|
utilizzano il modulo clink.o e` necessario includere il file clink.h.
|
||||||
|
Nel caso in cui il compilatore C utilizzato non sia ANSI-C e`
|
||||||
|
necessario usare l'opzione di compilazione -DNO_ANSI_C.
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURAZIONE
|
||||||
|
--------------
|
||||||
|
|
||||||
|
Se si sta utilizzando una porta Parallela PCI che usa un indirizzo di IO
|
||||||
|
non standard, e' necessario specificare l'indirizzo effettivo di IO della
|
||||||
|
porta con l'argomento "port" del modulo.
|
||||||
|
|
||||||
|
L'argomento accetta fino a tre valori separati da virgole. I valori di
|
||||||
|
default sono 0x378, 0x278, 0x3bc.
|
||||||
|
|
||||||
|
Per esempio :
|
||||||
|
|
||||||
|
insmod skey port=0x800
|
||||||
|
|
||||||
|
o
|
||||||
|
|
||||||
|
insmod skey port=0x800,0x810,0x820
|
||||||
|
|
||||||
|
|
||||||
|
Su sistemi con bus usb OHCI (Open Host Controller Interface),
|
||||||
|
generalmenti presenti su tutte le schede aggiuntive PCI USB,
|
||||||
|
e' necessario aggiungere l'argomento "fastusb=0"
|
||||||
|
|
||||||
|
Per esempio :
|
||||||
|
|
||||||
|
insmod skey fastusb=0
|
||||||
|
|
224
linux/eutron/README
Executable file
224
linux/eutron/README
Executable file
@ -0,0 +1,224 @@
|
|||||||
|
EUTRON SPA
|
||||||
|
INFORMATION SECURITY SOLUTION
|
||||||
|
|
||||||
|
Phone +39-(0)35-697011
|
||||||
|
Fax +39-(0)35-697092
|
||||||
|
|
||||||
|
Internet : http://www.smartkey.eutron.com
|
||||||
|
Technical support : helpdesk@eutron.com
|
||||||
|
Commercial info : info@eutron.com
|
||||||
|
|
||||||
|
|
||||||
|
SmartKey Parallel and USB driver for Linux
|
||||||
|
------------------------------------------
|
||||||
|
|
||||||
|
This driver works for kernel from 2.4.10 to 2.4.19 compiled with gcc-3.2.2
|
||||||
|
|
||||||
|
The application provides an interface between the C language and
|
||||||
|
the driver of the SMARTKEY key. The application is totally compatible
|
||||||
|
with the one available under MS-DOS. This makes it easy to port
|
||||||
|
programs written for the MS-DOS operating system to the Unix environment.
|
||||||
|
|
||||||
|
|
||||||
|
CONTENTS OF THE APPLICATION
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
The application contains the following files:
|
||||||
|
|
||||||
|
README This contains information about the application.
|
||||||
|
It's the file you are reading now.
|
||||||
|
clink.o This is the interface between C programs and the SMARTKEY
|
||||||
|
driver.
|
||||||
|
clink.h This outlines the structure of the clink.o interface.
|
||||||
|
It has to be used in the C files that use the SMARTKEY key.
|
||||||
|
smartdem.c An example, written in C, of how to use the SMARTKEY key.
|
||||||
|
smartdem Executable of the sample program.
|
||||||
|
skey*.o Drivers of the key
|
||||||
|
skinstall Script for automatic installation
|
||||||
|
skuninstall Script for automatic uninstalling
|
||||||
|
skeyver Utility for setting the version of the kernel in the skey.o
|
||||||
|
module
|
||||||
|
|
||||||
|
USB SUPPORT
|
||||||
|
-----------
|
||||||
|
|
||||||
|
The Smarkey driver, like any other USB driver, requires that the USB
|
||||||
|
modules of the kernel are active and running.
|
||||||
|
Generally you can obtain this running these commands :
|
||||||
|
|
||||||
|
insmod usbcore
|
||||||
|
insmod usb-uhci
|
||||||
|
|
||||||
|
for PCs with an USB controller UHCI by Intel, VIA, ...
|
||||||
|
|
||||||
|
insmod usbcore
|
||||||
|
insmod usb-ohci
|
||||||
|
|
||||||
|
for PCs with an USB controller OHCI by Compaq, iMacs, OPTi, SiS, ALi...
|
||||||
|
|
||||||
|
|
||||||
|
UPGRADING
|
||||||
|
---------
|
||||||
|
|
||||||
|
To upgrade from the previous version of the SmartKey driver you need
|
||||||
|
to relink your application with the new clink.o object.
|
||||||
|
|
||||||
|
If you don't relink, your application will work only with the first USB
|
||||||
|
key inserted and with the parallel port addresses 0x3BC and 0x378.
|
||||||
|
You will lose the access at the parallel port at address 0x278 substituted
|
||||||
|
with the first USB key.
|
||||||
|
|
||||||
|
|
||||||
|
AUTOMATIC INSTALLATION PROCEDURE
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
Start the skinstall script with root rights using the commands:
|
||||||
|
|
||||||
|
chmod a+x skinstall
|
||||||
|
./skinstall
|
||||||
|
|
||||||
|
The installation will configure the system for the automatic loading of the
|
||||||
|
SmartKey module the first time it is run.
|
||||||
|
|
||||||
|
To uninstall the driver use the commands:
|
||||||
|
|
||||||
|
chmod a+x skuninstall
|
||||||
|
./skuninstall
|
||||||
|
|
||||||
|
Every time the version of the kernel changes, you will have to perform the
|
||||||
|
installation again.
|
||||||
|
|
||||||
|
To start the demo application use the commands:
|
||||||
|
|
||||||
|
chmod a+x smartdem
|
||||||
|
./smartdem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MANUAL INSTALLATION PROCEDURE
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
To install the driver follow this procedure:
|
||||||
|
|
||||||
|
1) Access the system as a super-user.
|
||||||
|
|
||||||
|
2) Go to the /dev directory using the command:
|
||||||
|
|
||||||
|
cd /dev
|
||||||
|
|
||||||
|
create the file for accessing the key using the commands:
|
||||||
|
|
||||||
|
mknod skey0 c 59 0
|
||||||
|
mknod skey1 c 59 1
|
||||||
|
mknod skey2 c 59 2
|
||||||
|
mknod skey3 c 59 3
|
||||||
|
mknod skey4 c 59 4
|
||||||
|
mknod skey5 c 59 5
|
||||||
|
|
||||||
|
and change the properties and the group of files using the commands:
|
||||||
|
|
||||||
|
chmod 666 skey?
|
||||||
|
chgrp daemon skey?
|
||||||
|
|
||||||
|
3) Identify the correct driver for your particular configuration. There are
|
||||||
|
three alternatives:
|
||||||
|
|
||||||
|
skey_R.o Kernel mono-processor with version information
|
||||||
|
skey_Rsmp_.o Kernel multi-processor with version information
|
||||||
|
skey_Rsmp.o Kernel multi-processor with version information for
|
||||||
|
RedHad
|
||||||
|
skey.o Kernel mono-processor without version information
|
||||||
|
|
||||||
|
|
||||||
|
A simple test can be carried out using the command:
|
||||||
|
|
||||||
|
grep printk /proc/ksyms
|
||||||
|
|
||||||
|
on receiving the output :
|
||||||
|
|
||||||
|
... printk_R1b7d4074 driver skey_R.o
|
||||||
|
... printk_Rsmp_1b7d4074 driver skey_Rsmp_.o
|
||||||
|
... printk_Rsmp1b7d4074 driver skey_Rsmp.o
|
||||||
|
other driver skey.o
|
||||||
|
|
||||||
|
Re-name the driver identified with the name skey.o
|
||||||
|
|
||||||
|
4) Configure the skey.o module with the current version of the kernel:
|
||||||
|
|
||||||
|
chmod a+x skeyver
|
||||||
|
./skeyver skey.o
|
||||||
|
|
||||||
|
5) The driver skey.o is in the form of a dynamically loadable module.
|
||||||
|
Therefore before it can be used, it has to be loaded with the command:
|
||||||
|
|
||||||
|
insmod skey
|
||||||
|
|
||||||
|
6) To configure the driver for automatic loading the first time it is run,
|
||||||
|
do the following:
|
||||||
|
|
||||||
|
6.1) Add the line:
|
||||||
|
|
||||||
|
alias char-major-59 skey
|
||||||
|
|
||||||
|
at the end of the file /etc/conf.modules
|
||||||
|
|
||||||
|
6.2) Copy the file skey.o to the directory /lib/modules/KERNELVERSION/misc,
|
||||||
|
where KERNELVERSION is the version of the kernel.
|
||||||
|
The version of the kernel can be viewed using the command:
|
||||||
|
|
||||||
|
uname -r
|
||||||
|
|
||||||
|
6.3) Update the dependencies of the modules using the command:
|
||||||
|
|
||||||
|
depmod -a
|
||||||
|
|
||||||
|
6.4) Remove any copies of the driver that might be in memory by using the
|
||||||
|
command:
|
||||||
|
|
||||||
|
rmmod skey
|
||||||
|
|
||||||
|
and check automatic loading of the module using the command:
|
||||||
|
|
||||||
|
modprobe skey
|
||||||
|
|
||||||
|
If there are no error messages it means that loading was successful.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
USE
|
||||||
|
---
|
||||||
|
|
||||||
|
In order to use the clink.o interface you have to copy the file to the
|
||||||
|
working directory and link it to the other object files which make up the
|
||||||
|
program to protect. You will have to include the file clink.h in the program
|
||||||
|
files that use the clink.o module. If the C compiler you are using isn't
|
||||||
|
ANSI-C, you will have to use the compile option -DNO_ANSI_C.
|
||||||
|
|
||||||
|
|
||||||
|
CONFIGURATION
|
||||||
|
-------------
|
||||||
|
|
||||||
|
If you are using a PCI Parallel port which doesn't use a standard IO
|
||||||
|
address you need to specify the effective address of the IO port with
|
||||||
|
the "port" module argument.
|
||||||
|
|
||||||
|
The argument accept up to 3 values separated by commas. The default values
|
||||||
|
are 0x378, 0x278, 0x3bc.
|
||||||
|
|
||||||
|
For example :
|
||||||
|
|
||||||
|
insmod skey port=0x800
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
insmod skey port=0x800,0x810,0x820
|
||||||
|
|
||||||
|
|
||||||
|
If you are using an OHCI (Open Host Controller Interface) USB bus,
|
||||||
|
generally present in all the additional PCI USB port, you need to
|
||||||
|
specify the module argument "fastusb=0".
|
||||||
|
|
||||||
|
For example :
|
||||||
|
|
||||||
|
insmod skey fastusb=0
|
||||||
|
|
84
linux/eutron/clink.h
Executable file
84
linux/eutron/clink.h
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* SmartKey Driver
|
||||||
|
* Copyright EUTRON 1993-2002
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __SMARTKEY_H
|
||||||
|
#define __SMARTKEY_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Smartkey mode codes */
|
||||||
|
|
||||||
|
#define SCRAMBLING_MODE 's'
|
||||||
|
#define READING_MODE 'r'
|
||||||
|
#define WRITING_MODE 'w'
|
||||||
|
#define FIXING_MODE 'f'
|
||||||
|
#define LOCATING_MODE 'l'
|
||||||
|
#define COMPARING_MODE 'c'
|
||||||
|
#define PROGRAMMING_MODE 'p'
|
||||||
|
#define MODEL_READING_MODE 'm'
|
||||||
|
#define ENCRYPTING_MODE 'e'
|
||||||
|
#define SERIAL_NUMBER_READING_MODE 'n'
|
||||||
|
#define FIX_READING_MODE 'x'
|
||||||
|
#define EXT_MODEL_READING_MODE 'h'
|
||||||
|
#define FAIL_COUNTER_READING_MODE 'a'
|
||||||
|
#define BLOCK_READING_MODE ('b' | ((unsigned)'r' << 8))
|
||||||
|
#define BLOCK_WRITING_MODE ('b' | ((unsigned)'w' << 8))
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Smartkey models */
|
||||||
|
|
||||||
|
#define SKEY_NONE '0' /* No Smartkey */
|
||||||
|
#define SKEY_FX '1' /* Smartkey mod. FX */
|
||||||
|
#define SKEY_PR '2' /* Smartkey mod. PR */
|
||||||
|
#define SKEY_EP '3' /* Smartkey mod. EP */
|
||||||
|
#define SKEY_SP '9' /* Smartkey mod. SP */
|
||||||
|
#define SKEY_NET 'A' /* Smartkey mod. NET */
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Return codes */
|
||||||
|
|
||||||
|
#define ST_OK 0 /* No errors */
|
||||||
|
#define ST_NONE_KEY -1 /* No Smartkey present */
|
||||||
|
#define ST_SYNT_ERR -2 /* Syntax error */
|
||||||
|
#define ST_LABEL_FAILED -3 /* Uncorrect label */
|
||||||
|
#define ST_PW_DATA_FAILED -4 /* Uncorrect password or data */
|
||||||
|
#define ST_HW_FAILURE -20 /* Smartkey damaged */
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Field length */
|
||||||
|
|
||||||
|
#define LABEL_LENGTH 16
|
||||||
|
#define PASSWORD_LENGTH 16
|
||||||
|
#define DATA_LENGTH 64
|
||||||
|
#define EXTENDED_DATA_LENGTH 352
|
||||||
|
#define SCRAMBLE_LENGTH 8
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Communication structure definition */
|
||||||
|
|
||||||
|
typedef struct smartkey {
|
||||||
|
short lpt;
|
||||||
|
short command;
|
||||||
|
unsigned char label[LABEL_LENGTH];
|
||||||
|
unsigned char password[PASSWORD_LENGTH];
|
||||||
|
unsigned char data[DATA_LENGTH];
|
||||||
|
short fail_counter;
|
||||||
|
short status;
|
||||||
|
unsigned char ext_data[EXTENDED_DATA_LENGTH];
|
||||||
|
} SKEY_DATA;
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Interface function prototype */
|
||||||
|
|
||||||
|
int clink(SKEY_DATA*);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
BIN
linux/eutron/clink.o
Executable file
BIN
linux/eutron/clink.o
Executable file
Binary file not shown.
28
linux/eutron/error-report
Executable file
28
linux/eutron/error-report
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo COMMAND ksyms > EUTRON.txt 2>&1
|
||||||
|
cat /proc/ksyms >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND uname -r >> EUTRON.txt 2>&1
|
||||||
|
uname -r >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND ls lib/modules/./misc >> EUTRON.txt 2>&1
|
||||||
|
ls /lib/modules/`uname -r`/misc >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND depmod -a -e >> EUTRON.txt 2>&1
|
||||||
|
depmod -a -e >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND insmod -V >> EUTRON.txt 2>&1
|
||||||
|
insmod -V >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND cat conf.modules >> EUTRON.txt 2>&1
|
||||||
|
cat /etc/conf.modules >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND cat modules.conf >> EUTRON.txt 2>&1
|
||||||
|
cat /etc/modules.conf >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND cat rc.local >> EUTRON.txt 2>&1
|
||||||
|
cat /etc/rc.d/rc.local >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND remove module in memory: rmmod skey >> EUTRON.txt 2>&1
|
||||||
|
rmmod skey >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND list module: lsmod >> EUTRON.txt 2>&1
|
||||||
|
lsmod >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND automatic loading: modprobe skey >> EUTRON.txt 2>&1
|
||||||
|
modprobe skey >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND list module: lsmod >> EUTRON.txt 2>&1
|
||||||
|
lsmod >> EUTRON.txt 2>&1
|
||||||
|
echo COMMAND remove module in memory: rmmod skey >> EUTRON.txt 2>&1
|
||||||
|
rmmod skey >> EUTRON.txt 2>&1
|
||||||
|
echo Please send the file EUTRON.txt to the helpdesk support
|
BIN
linux/eutron/skey.o
Executable file
BIN
linux/eutron/skey.o
Executable file
Binary file not shown.
BIN
linux/eutron/skey_R.o
Executable file
BIN
linux/eutron/skey_R.o
Executable file
Binary file not shown.
BIN
linux/eutron/skey_Rsmp.o
Executable file
BIN
linux/eutron/skey_Rsmp.o
Executable file
Binary file not shown.
BIN
linux/eutron/skey_Rsmp_.o
Executable file
BIN
linux/eutron/skey_Rsmp_.o
Executable file
Binary file not shown.
BIN
linux/eutron/skeyver
Executable file
BIN
linux/eutron/skeyver
Executable file
Binary file not shown.
97
linux/eutron/skinstall
Executable file
97
linux/eutron/skinstall
Executable file
@ -0,0 +1,97 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION=`uname -r`
|
||||||
|
|
||||||
|
# Set execute permission
|
||||||
|
chmod a+x skinstall skuninstall smartdem skeyver error-report
|
||||||
|
|
||||||
|
# Remove the loaded module
|
||||||
|
(lsmod | grep skey > /dev/null) && rmmod skey
|
||||||
|
|
||||||
|
# Copy the module
|
||||||
|
if ! install -d -o root -g root /lib/modules/$VERSION/misc ; then
|
||||||
|
echo Error creating the directory /lib/modules/$VERSION/misc/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if grep printk_R1b7d4074 /proc/ksyms > /dev/null ; then
|
||||||
|
if ! install -D -o root -g root -m 644 skey_R.o /lib/modules/$VERSION/misc/skey.o ; then
|
||||||
|
echo Error copying module skey_R.o in /lib/modules/$VERSION/misc/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif grep printk_Rsmp_1b7d4074 /proc/ksyms > /dev/null ; then
|
||||||
|
if ! install -D -o root -g root -m 644 skey_Rsmp_.o /lib/modules/$VERSION/misc/skey.o ; then
|
||||||
|
echo Error copying module skey_Rsmp_.o in /lib/modules/$VERSION/misc/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
elif grep printk_Rsmp1b7d4074 /proc/ksyms > /dev/null ; then
|
||||||
|
if ! install -D -o root -g root -m 644 skey_Rsmp.o /lib/modules/$VERSION/misc/skey.o ; then
|
||||||
|
echo Error copying module skey_Rsmp.o in /lib/modules/$VERSION/misc/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if ! install -D -o root -g root -m 644 skey.o /lib/modules/$VERSION/misc/skey.o ; then
|
||||||
|
echo Error copying module skey.o in /lib/modules/$VERSION/misc/
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove devices
|
||||||
|
[ -e /dev/skey0 ] && rm -f /dev/skey0
|
||||||
|
[ -e /dev/skey1 ] && rm -f /dev/skey1
|
||||||
|
[ -e /dev/skey2 ] && rm -f /dev/skey2
|
||||||
|
[ -e /dev/skey3 ] && rm -f /dev/skey3
|
||||||
|
[ -e /dev/skey4 ] && rm -f /dev/skey4
|
||||||
|
[ -e /dev/skey5 ] && rm -f /dev/skey5
|
||||||
|
|
||||||
|
# Create devices
|
||||||
|
mknod /dev/skey0 c 59 0
|
||||||
|
chmod 666 /dev/skey0
|
||||||
|
chgrp daemon /dev/skey0
|
||||||
|
mknod /dev/skey1 c 59 1
|
||||||
|
chmod 666 /dev/skey1
|
||||||
|
chgrp daemon /dev/skey1
|
||||||
|
mknod /dev/skey2 c 59 2
|
||||||
|
chmod 666 /dev/skey2
|
||||||
|
chgrp daemon /dev/skey2
|
||||||
|
mknod /dev/skey3 c 59 3
|
||||||
|
chmod 666 /dev/skey3
|
||||||
|
chgrp daemon /dev/skey3
|
||||||
|
mknod /dev/skey4 c 59 4
|
||||||
|
chmod 666 /dev/skey4
|
||||||
|
chgrp daemon /dev/skey4
|
||||||
|
mknod /dev/skey5 c 59 5
|
||||||
|
chmod 666 /dev/skey5
|
||||||
|
chgrp daemon /dev/skey5
|
||||||
|
|
||||||
|
# Configure the module
|
||||||
|
if ! ./skeyver /lib/modules/$VERSION/misc/skey.o > /dev/null ; then
|
||||||
|
echo Error setting module version
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add alias for the module
|
||||||
|
if [ -e /etc/modules.conf ] ; then
|
||||||
|
CONFMODULES=/etc/modules.conf
|
||||||
|
else
|
||||||
|
CONFMODULES=/etc/conf.modules
|
||||||
|
fi
|
||||||
|
cp $CONFMODULES $CONFMODULES.orig
|
||||||
|
cat $CONFMODULES.orig | grep -v "char-major-59" > $CONFMODULES
|
||||||
|
echo alias char-major-59 skey >> $CONFMODULES
|
||||||
|
|
||||||
|
# Run depmod
|
||||||
|
echo Updating modules dependencies
|
||||||
|
if ! depmod -a ; then
|
||||||
|
echo Error running depmod
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Manually load the module the first time
|
||||||
|
if ! modprobe skey ; then
|
||||||
|
echo Error loading the module
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo SmartKey driver installed
|
||||||
|
|
||||||
|
exit 0
|
37
linux/eutron/skuninstall
Executable file
37
linux/eutron/skuninstall
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
VERSION=`uname -r`
|
||||||
|
|
||||||
|
# Set execute permission
|
||||||
|
chmod a+x skinstall skuninstall smartdem skeyver error-report
|
||||||
|
|
||||||
|
# Remove devices
|
||||||
|
[ -r /dev/skey0 ] && rm -f /dev/skey0
|
||||||
|
[ -r /dev/skey1 ] && rm -f /dev/skey1
|
||||||
|
[ -r /dev/skey2 ] && rm -f /dev/skey2
|
||||||
|
|
||||||
|
# Remove the module
|
||||||
|
[ -r /lib/modules/$VERSION/misc/skey.o ] && rm -f /lib/modules/$VERSION/misc/skey.o
|
||||||
|
|
||||||
|
# Remove alias for the module
|
||||||
|
if [ -e /etc/modules.conf ] ; then
|
||||||
|
CONFMODULES=/etc/modules.conf
|
||||||
|
else
|
||||||
|
CONFMODULES=/etc/conf.modules
|
||||||
|
fi
|
||||||
|
cp $CONFMODULES $CONFMODULES.orig
|
||||||
|
cat $CONFMODULES.orig | grep -v "char-major-59" > $CONFMODULES
|
||||||
|
|
||||||
|
# Remove the loaded module
|
||||||
|
(lsmod | grep skey > /dev/null) && rmmod skey
|
||||||
|
|
||||||
|
# Run depmod
|
||||||
|
echo Updating modules dependencies
|
||||||
|
if ! depmod -a ; then
|
||||||
|
echo Error running depmod
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo SmartKey driver uninstalled
|
||||||
|
|
||||||
|
exit 0
|
BIN
linux/eutron/smartdem
Executable file
BIN
linux/eutron/smartdem
Executable file
Binary file not shown.
237
linux/eutron/smartdem.c
Executable file
237
linux/eutron/smartdem.c
Executable file
@ -0,0 +1,237 @@
|
|||||||
|
/*
|
||||||
|
* SmartKey Demo Program
|
||||||
|
* Copyright EUTRON 1993-2002
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "clink.h"
|
||||||
|
|
||||||
|
static void print_error(int err)
|
||||||
|
{
|
||||||
|
switch (err) {
|
||||||
|
case ST_NONE_KEY :
|
||||||
|
printf("ST_NONE_KEY : Key Not Found\n");
|
||||||
|
break;
|
||||||
|
case ST_SYNT_ERR :
|
||||||
|
printf("ST_SYNT_ERR : Syntax Error\n");
|
||||||
|
break;
|
||||||
|
case ST_LABEL_FAILED :
|
||||||
|
printf("ST_LABEL_FAILED : Wrong Label\n");
|
||||||
|
break;
|
||||||
|
case ST_PW_DATA_FAILED :
|
||||||
|
printf("ST_PW_DATA_FAILED : Wrong Password\n");
|
||||||
|
break;
|
||||||
|
case ST_HW_FAILURE :
|
||||||
|
printf("ST_HW_FAILURE : Hardware failure\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("%04x : Unrecognizable Status\n", err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
SKEY_DATA skey;
|
||||||
|
int i;
|
||||||
|
unsigned model;
|
||||||
|
|
||||||
|
printf("SmartKey Demo Program\n\n");
|
||||||
|
|
||||||
|
/* Initialize */
|
||||||
|
memset(&skey,0,sizeof(skey));
|
||||||
|
|
||||||
|
/* Set the Label */
|
||||||
|
strncpy(skey.label, "SMARTKEY", LABEL_LENGTH);
|
||||||
|
|
||||||
|
/* Locating */
|
||||||
|
printf("Locating : ");
|
||||||
|
skey.command = LOCATING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("SmartKey found on port %d\n", skey.lpt);
|
||||||
|
|
||||||
|
/* Scrambling */
|
||||||
|
printf("Scrambling ");
|
||||||
|
|
||||||
|
memcpy(skey.data, "12345678", SCRAMBLE_LENGTH);
|
||||||
|
skey.command = SCRAMBLING_MODE;
|
||||||
|
|
||||||
|
for(i=0;i<SCRAMBLE_LENGTH;++i)
|
||||||
|
printf("%02x", (unsigned)skey.data[i]);
|
||||||
|
|
||||||
|
printf(" : ");
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<SCRAMBLE_LENGTH;++i)
|
||||||
|
printf("%02x", (unsigned)skey.data[i]);
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
/* Serial */
|
||||||
|
printf("Serial : ");
|
||||||
|
skey.command = SERIAL_NUMBER_READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%02x%02x%02x%02x\n", (unsigned)skey.data[3], (unsigned)skey.data[2], (unsigned)skey.data[1], (unsigned)skey.data[0]);
|
||||||
|
|
||||||
|
/* Model */
|
||||||
|
printf("Model : ");
|
||||||
|
skey.command = MODEL_READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (skey.data[0]) {
|
||||||
|
case SKEY_FX : printf("model FX"); break;
|
||||||
|
case SKEY_PR : printf("model PR"); break;
|
||||||
|
case SKEY_EP : printf("model EP"); break;
|
||||||
|
case SKEY_SP : printf("model SP"); break;
|
||||||
|
case SKEY_NET : printf("model NET"); break;
|
||||||
|
default : printf("model unknow"); break;
|
||||||
|
}
|
||||||
|
switch (skey.data[1]) {
|
||||||
|
case '0' : printf(", memory 0 byte"); break;
|
||||||
|
case '1' : printf(", memory 64 byte"); break;
|
||||||
|
case '2' : printf(", memory 192 byte"); break;
|
||||||
|
case '3' : printf(", memory 416 byte"); break;
|
||||||
|
default : printf(", memory unknow"); break;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
/* Ext Model */
|
||||||
|
printf("Ext Model : ");
|
||||||
|
skey.command = EXT_MODEL_READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
model = skey.data[0];
|
||||||
|
|
||||||
|
switch (skey.data[0]) {
|
||||||
|
case SKEY_FX : printf("model FX"); break;
|
||||||
|
case SKEY_PR : printf("model PR"); break;
|
||||||
|
case SKEY_EP : printf("model EP"); break;
|
||||||
|
case SKEY_SP : printf("model SP"); break;
|
||||||
|
case SKEY_NET : printf("model NET"); break;
|
||||||
|
default : printf("model unknow"); break;
|
||||||
|
}
|
||||||
|
switch (skey.data[1]) {
|
||||||
|
case '0' : printf(", memory 0 byte"); break;
|
||||||
|
case '1' : printf(", memory 64 byte"); break;
|
||||||
|
case '2' : printf(", memory 192 byte"); break;
|
||||||
|
case '3' : printf(", memory 416 byte"); break;
|
||||||
|
default : printf(", memory unknow"); break;
|
||||||
|
}
|
||||||
|
switch (skey.data[2]) {
|
||||||
|
case 0 : printf(", type A"); break;
|
||||||
|
case 1 : printf(", type B"); break;
|
||||||
|
case 2 : printf(", type ASIC"); break;
|
||||||
|
case 3 : printf(", type USB"); break;
|
||||||
|
default : printf(", type unknow"); break;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
/* set the password */
|
||||||
|
strncpy(skey.password, "EUTRON", PASSWORD_LENGTH);
|
||||||
|
|
||||||
|
if (model == SKEY_EP || model == SKEY_SP || model == SKEY_NET) {
|
||||||
|
|
||||||
|
/* Fix */
|
||||||
|
printf("Fix : ");
|
||||||
|
skey.command = FIX_READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s\n", skey.data[0]!=0 ? "yes" : "no" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model == SKEY_EP || model == SKEY_SP || model == SKEY_NET) {
|
||||||
|
|
||||||
|
/* Fail Counter */
|
||||||
|
printf("Fail Counter : ");
|
||||||
|
skey.command = FAIL_COUNTER_READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d\n",skey.fail_counter);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model == SKEY_PR || model == SKEY_EP || model == SKEY_SP || model == SKEY_NET) {
|
||||||
|
|
||||||
|
/* Reading */
|
||||||
|
printf("Reading: ");
|
||||||
|
|
||||||
|
skey.command = READING_MODE;
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<DATA_LENGTH;++i)
|
||||||
|
if (skey.data[i] >= 32 && skey.data[i] <= 127)
|
||||||
|
printf("%c", (char)skey.data[i]);
|
||||||
|
else
|
||||||
|
printf(" ");
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
/* Reading */
|
||||||
|
printf("Writing: ");
|
||||||
|
|
||||||
|
skey.command = WRITING_MODE;
|
||||||
|
memset(skey.data,0,DATA_LENGTH);
|
||||||
|
strncpy(skey.data,"SECURITY DATA",DATA_LENGTH);
|
||||||
|
|
||||||
|
clink(&skey);
|
||||||
|
if (skey.status != ST_OK) {
|
||||||
|
print_error(skey.status);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<DATA_LENGTH;++i)
|
||||||
|
if (skey.data[i] >= 32 && skey.data[i] <= 127)
|
||||||
|
printf("%c", (char)skey.data[i]);
|
||||||
|
else
|
||||||
|
printf(" ");
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
198
linux/hardlock/INSTALL
Executable file
198
linux/hardlock/INSTALL
Executable file
@ -0,0 +1,198 @@
|
|||||||
|
|
||||||
|
Installation instructions for Aladdin key driver and daemon
|
||||||
|
==============================================================
|
||||||
|
|
||||||
|
In order for the hardware key access to work, a kernel mode driver
|
||||||
|
(aksparlnx.o) and a daemon (aksusbd) have to be loaded.
|
||||||
|
|
||||||
|
All described actions should be executed as root.
|
||||||
|
|
||||||
|
|
||||||
|
Driver Installation (aksparlnx.o)
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
Generating the Device Node
|
||||||
|
|
||||||
|
For the driver to be accessible, a /dev/Hardlock device node has to be
|
||||||
|
generated. It should use the same major number as is used when loading
|
||||||
|
the driver (major=xxx command line to insmod, or 42 default).
|
||||||
|
|
||||||
|
The device node is generated with the following command:
|
||||||
|
|
||||||
|
mknod /dev/Hardlock c 42 0
|
||||||
|
|
||||||
|
Allow everyone to access the node:
|
||||||
|
|
||||||
|
chmod 666 /dev/Hardlock
|
||||||
|
|
||||||
|
Alternatively, if the access to Aladdin keys should be restricted to a
|
||||||
|
special group of users (e.g. group aladdin):
|
||||||
|
|
||||||
|
chgrp aladdin /dev/Hardlock
|
||||||
|
chmod 660 /dev/Hardlock
|
||||||
|
|
||||||
|
|
||||||
|
Initializing the Parport System
|
||||||
|
|
||||||
|
The aksparlnx driver uses the Linux parport driver in order to get
|
||||||
|
access to the parallel port in a manner which does not disturb other
|
||||||
|
users of the parallel port (e.g. printer, zip drive).
|
||||||
|
|
||||||
|
So before loading the aksparlnx driver the parport system must be
|
||||||
|
initialized:
|
||||||
|
|
||||||
|
modprobe parport_pc
|
||||||
|
|
||||||
|
The parport driver will report in the system log the parallel ports it
|
||||||
|
has found in the system. aksparlnx will by default be able to access
|
||||||
|
keys on any of these ports.
|
||||||
|
|
||||||
|
|
||||||
|
Loading the Driver
|
||||||
|
|
||||||
|
Then the aksparlnx driver should be loaded with the command:
|
||||||
|
|
||||||
|
insmod <path_to_driver>/aksparlnx.o
|
||||||
|
|
||||||
|
If the driver successfully loaded, a system log message is generated:
|
||||||
|
|
||||||
|
Feb 2 12:16:01 panther kernel: aksparlnx: EYE/HASP driver v1.01/API v3.77/major 42 loaded (ppi)
|
||||||
|
|
||||||
|
If the driver fails to load, an error message is generated in the
|
||||||
|
system log.
|
||||||
|
|
||||||
|
The loading of the driver (modprobe and insmod) should be incorporated
|
||||||
|
into a startup script, so that on subsequent system boots the driver
|
||||||
|
is readily available.
|
||||||
|
|
||||||
|
|
||||||
|
Aladdin daemon (aksusbd)
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
In order for the daemon to access USB keys, the so-called usbdevfs
|
||||||
|
must be mounted on /proc/bus/usb.
|
||||||
|
On newer distributions it is mounted automatically (e.g SuSe 7.0). It
|
||||||
|
can be manually mounted with the command
|
||||||
|
|
||||||
|
mount -t usbdevfs none /proc/bus/usb
|
||||||
|
|
||||||
|
In order for the daemon to access parallel port keys, the kernel
|
||||||
|
driver aksparlnx must be installed before starting aksusbd.
|
||||||
|
|
||||||
|
Load the daemon by starting it:
|
||||||
|
|
||||||
|
<path>/aksusbd
|
||||||
|
|
||||||
|
The daemon will fork and put itself into the background. Successful
|
||||||
|
installation can be verified in the syslog:
|
||||||
|
|
||||||
|
Feb 2 12:42:43 panther aksusbd:[21772]: loaded, daemon version: 1.00, key API (USB) version: 3.77, key API (parallel) version: 3.77
|
||||||
|
|
||||||
|
It reports its version, the version of the API used for USB, and the
|
||||||
|
version of the API inside the kernel driver (for parallel port keys).
|
||||||
|
|
||||||
|
If the kernel driver happens to be unavailable when aksusbd is
|
||||||
|
launched, parallel port keys cannot be accessed, but USB keys are
|
||||||
|
still accessible. The system log reflects this status:
|
||||||
|
|
||||||
|
Feb 2 12:46:11 panther aksusbd:[21789]: loaded, daemon version: 1.00, key API (USB) version: 3.77 (parallel driver not available)
|
||||||
|
|
||||||
|
If /proc/bus/usb is not mounted when launching aksusbd, the daemon
|
||||||
|
does not load:
|
||||||
|
|
||||||
|
Feb 2 12:52:05 panther aksusbd:[21804]: cannot open /proc/bus/usb/devices: No such file or directory
|
||||||
|
|
||||||
|
Preferably the daemon should be started at system boot up time with
|
||||||
|
some script located in /etc/rc.d/init.d or /etc/init.d (depending on
|
||||||
|
Linux distribution).
|
||||||
|
|
||||||
|
|
||||||
|
Options for aksparlnx.o
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Types of diagnostic messages:
|
||||||
|
-----------------------------
|
||||||
|
You can use the switch loglevel to select which types of diagnostic
|
||||||
|
will be issued by the driver. Possible values are:
|
||||||
|
|
||||||
|
0 - nothing, only errors
|
||||||
|
1 - normal (default)
|
||||||
|
2 - verbose
|
||||||
|
3 - ultra verbose
|
||||||
|
|
||||||
|
The messages are logged in syslog with priority kern.info
|
||||||
|
(and kern.debug). Refer to /etc/syslog.conf to see where the messages
|
||||||
|
will be put, usally it is the file /var/log/messages.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
insmod aksparlnx.o loglevel=2
|
||||||
|
|
||||||
|
|
||||||
|
Change device major number:
|
||||||
|
---------------------------
|
||||||
|
The driver uses device major number 42 by default. You can
|
||||||
|
change this by giving an argument to the insmod command:
|
||||||
|
|
||||||
|
insmod aksparlnx.o major=123
|
||||||
|
|
||||||
|
You have to change the driver special file also:
|
||||||
|
|
||||||
|
mknod /dev/Hardlock c 123 0
|
||||||
|
|
||||||
|
|
||||||
|
Port addresses:
|
||||||
|
---------------
|
||||||
|
If you have a parallel port in the system which by chance isn't
|
||||||
|
detected by the Linux parport driver (and therefore not seen by
|
||||||
|
aksparlnx.o), you can tell aksparlnx.o of the existence of this
|
||||||
|
port:
|
||||||
|
|
||||||
|
insmod aksparlnx.o hlportaddress=0x278
|
||||||
|
|
||||||
|
BEWARE: You should know what you do! Giving an illegal port
|
||||||
|
address here may reliably crash the system!
|
||||||
|
|
||||||
|
|
||||||
|
Timeout:
|
||||||
|
--------
|
||||||
|
You can specify the maximum amount of time the driver waits when
|
||||||
|
requesting exclusive port access from the parport driver. The value
|
||||||
|
used is 1/100 of a second. The default value is 100 (= 1 second).
|
||||||
|
|
||||||
|
insmod aksparlnx.o timeout=200
|
||||||
|
|
||||||
|
After this time (in this example 2 seconds) the request will be
|
||||||
|
aborted with a PORT_BUSY error.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Options for aksusbd
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
Types of diagnostic messages:
|
||||||
|
-----------------------------
|
||||||
|
You can use the switch loglevel to select which types of diagnostic
|
||||||
|
will be issued by the daemon. Possible values are:
|
||||||
|
|
||||||
|
0 - nothing, only errors
|
||||||
|
1 - normal (default)
|
||||||
|
2 - verbose
|
||||||
|
3 - ultra verbose
|
||||||
|
|
||||||
|
The messages are logged in syslog with priority kern.info
|
||||||
|
(and kern.debug). Refer to /etc/syslog.conf to see where the messages
|
||||||
|
will be put, usally it is the file /var/log/messages.
|
||||||
|
|
||||||
|
e.g.
|
||||||
|
aksusbd -l 2
|
||||||
|
|
||||||
|
|
||||||
|
Permissions:
|
||||||
|
------------
|
||||||
|
The Unix domain socket /tmp/.aksusb is used by the applications to
|
||||||
|
access aksusbd. This is created with permissions 666 by
|
||||||
|
default. You can tell aksusbd to use different permissions:
|
||||||
|
|
||||||
|
aksusbd -u 660
|
||||||
|
|
||||||
|
|
57
linux/hardlock/README
Executable file
57
linux/hardlock/README
Executable file
@ -0,0 +1,57 @@
|
|||||||
|
|
||||||
|
Hardlock Driver v1.05 for Linux v2.2/v2.4
|
||||||
|
=========================================
|
||||||
|
|
||||||
|
|
||||||
|
Installation
|
||||||
|
------------
|
||||||
|
|
||||||
|
Please refer to the file INSTALL for installation instructions.
|
||||||
|
|
||||||
|
What's new?
|
||||||
|
-----------
|
||||||
|
|
||||||
|
* Drivers updated to 1.05 and versions for newer Linux kernels.
|
||||||
|
* Enhanced security.
|
||||||
|
|
||||||
|
Old news (from previous releases):
|
||||||
|
* Hardlock USB is now supported.
|
||||||
|
USB key access is managed with a new daemon, aksusbd. Since both
|
||||||
|
the parallel and the USB key accesses are routed through this daemon,
|
||||||
|
it must always be installed, even if USB access isn't needed.
|
||||||
|
* Since the kernel mode driver now also supports the HASP key,
|
||||||
|
it's name has been renamed from hardlock.o to aksparlnx.o.
|
||||||
|
The entry in /dev is still /dev/Hardlock, since this affects
|
||||||
|
existing applications.
|
||||||
|
* Kernel driver now uses parport method to share parallel port
|
||||||
|
with other drivers. Printing and Hardlock access shouldn't
|
||||||
|
disturb each other any more.
|
||||||
|
|
||||||
|
|
||||||
|
Demo-Programs
|
||||||
|
-------------
|
||||||
|
|
||||||
|
The demo program 'hl-demo' and its sources are in the usr subdirectory.
|
||||||
|
|
||||||
|
Type 'make' in the usr directory to rebuild 'hl-demo'.
|
||||||
|
(If make says "Nothing to be done for 'all'" or similar, try
|
||||||
|
"make clean all".)
|
||||||
|
|
||||||
|
hlapi_c.c is the high level library of the Hardlock functions.
|
||||||
|
|
||||||
|
You find more documentation about programming for the Hardlock in the
|
||||||
|
Hardlock High-Level-API reference manual. Suggested readings are also the
|
||||||
|
Hardlock Technical manual and, for special needs, the Low-Level-API reference
|
||||||
|
manual.
|
||||||
|
|
||||||
|
|
||||||
|
Known Problems / Shortcomings
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
- Hardlock Twin in serial mode is not supported.
|
||||||
|
|
||||||
|
|
||||||
|
aksparlnx.o version: 1.05
|
||||||
|
aksusbd version: 1.5
|
||||||
|
API version: 3.81
|
||||||
|
|
BIN
linux/hardlock/aksparlnx-redhat-1.05-1.i386.rpm
Executable file
BIN
linux/hardlock/aksparlnx-redhat-1.05-1.i386.rpm
Executable file
Binary file not shown.
BIN
linux/hardlock/aksparlnx-suse-1.05-2.i386.rpm
Executable file
BIN
linux/hardlock/aksparlnx-suse-1.05-2.i386.rpm
Executable file
Binary file not shown.
BIN
linux/hardlock/aksusbd-redhat-1.5-1.i386.rpm
Executable file
BIN
linux/hardlock/aksusbd-redhat-1.5-1.i386.rpm
Executable file
Binary file not shown.
BIN
linux/hardlock/aksusbd-suse-1.5-2.i386.rpm
Executable file
BIN
linux/hardlock/aksusbd-suse-1.5-2.i386.rpm
Executable file
Binary file not shown.
8
linux/hardlock/hlserver/files.txt
Executable file
8
linux/hardlock/hlserver/files.txt
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
readme.txt HL-Server for Linux readme (english)
|
||||||
|
liesmich.txt HL-Server for Linux readme (german)
|
||||||
|
history.txt History of changes
|
||||||
|
|
||||||
|
hlserver.tgz contains HL-Server for Linux executable
|
||||||
|
unpack with "tar -xzf hlserver.tgz"
|
||||||
|
|
17
linux/hardlock/hlserver/history.txt
Executable file
17
linux/hardlock/hlserver/history.txt
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
=============================================================================
|
||||||
|
HL-Server for Linux - History of changes
|
||||||
|
=============================================================================
|
||||||
|
|
||||||
|
4.57 November 2002
|
||||||
|
|
||||||
|
- full LiMaS implementation
|
||||||
|
- supports HL-Server USB keys
|
||||||
|
- added driver/API/aksusbd version detection for aksmon
|
||||||
|
|
||||||
|
4.46 March 2002
|
||||||
|
|
||||||
|
- initial release
|
||||||
|
(the version number 4.46 reflects the HL-Server core version)
|
||||||
|
|
||||||
|
|
BIN
linux/hardlock/hlserver/hlserver.tgz
Executable file
BIN
linux/hardlock/hlserver/hlserver.tgz
Executable file
Binary file not shown.
91
linux/hardlock/hlserver/liesmich.txt
Executable file
91
linux/hardlock/hlserver/liesmich.txt
Executable file
@ -0,0 +1,91 @@
|
|||||||
|
|
||||||
|
=========================================================================
|
||||||
|
HL-Server fuer Linux 11/2002
|
||||||
|
=========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
Allgemeines/Einfuehrung
|
||||||
|
=======================
|
||||||
|
|
||||||
|
HL-Server fuer Linux ist funktionsidentisch zum HL-Server fuer Win32
|
||||||
|
(HLS32 und HLS32SVC) und zum HL-Server NLM. Eine Applikation, die den
|
||||||
|
HL-Server nutzt, erkennt keinen Unterschied zwischen diesen Varianten.
|
||||||
|
Ebenso sind die benutzten HL-Server-Hardlocks identisch, so dass Sie fuer
|
||||||
|
jeden Anwendungsfall die passende Variante frei waehlen koennen.
|
||||||
|
HL-Server fuer Linux unterstuetzt das IP/UDP-Protokoll und benutzt
|
||||||
|
Port 3047 (IANA-registriert).
|
||||||
|
|
||||||
|
Mit einem Demo-Hardlock (Moduladresse 29809) koennen Sie den HL-Server
|
||||||
|
auch ohne ein HL-Server-Hardlock ausprobieren.
|
||||||
|
|
||||||
|
HL-Server fuer Linux laeuft wahlweise als Daemon (option -d) oder als
|
||||||
|
Applikation (-a). Der Applikationsmodus dient dabei hauptsaechlich zum
|
||||||
|
Testen und zur Untersuchung eventueller Probleme; dabei wird auf der
|
||||||
|
Console ein Trace aller Client-Anfragen angezeigt (aehnlich wie beim
|
||||||
|
HLS32.EXE unter WIN32 durch Doppelklick auf das Hardlock-Icon).
|
||||||
|
|
||||||
|
HL-Server fuer Linux kann mit AKSMON (Aladdin Monitor) von einem Win32-
|
||||||
|
Rechner aus administriert und ueberwacht werden, der Monitor selbst ist
|
||||||
|
unter Linux nicht lauffaehig.
|
||||||
|
|
||||||
|
HL-Server fuer Linux beinhaltet das komplette LiMaS und unterstützt alle
|
||||||
|
verfügbaren HL-Server-Hardlocks (USB, parallel und intern).
|
||||||
|
|
||||||
|
|
||||||
|
Starten des HL-Server fuer Linux
|
||||||
|
================================
|
||||||
|
|
||||||
|
Bevor HL-Server fuer Linux gestartet werden kann, muessen die
|
||||||
|
Hardlock-Treiber (aksparlnx.o und aksusbd) geladen sein.
|
||||||
|
Bitte lesen Sie dazu install.txt des Hardlock-Treibers.
|
||||||
|
|
||||||
|
HL-Server fuer Linux von der Console mit
|
||||||
|
|
||||||
|
hlserver [optionen]
|
||||||
|
|
||||||
|
gestartet.
|
||||||
|
|
||||||
|
Hardlock Server unterstuetzt unter Linux folgende Optionen:
|
||||||
|
|
||||||
|
-h Hilfe
|
||||||
|
-a Start als Applikation
|
||||||
|
-d Start als Daemon
|
||||||
|
-module:n[,m] Modul Addresse [,max Anzahl logins] (unterstuetzt bis zu 10 Module)
|
||||||
|
(optional, Module werden bei Aufruf automatisch hinzugefuegt)
|
||||||
|
-timeout:n Timeout Wert in Minuten (1..9999, 0=kein Timeout,Default=15)
|
||||||
|
-zombie Zombie Modus fuer Logins aktivieren
|
||||||
|
|
||||||
|
Zum Starten muss -a oder -d immer angegeben werden.
|
||||||
|
|
||||||
|
Beispiele:
|
||||||
|
|
||||||
|
hlserver -d
|
||||||
|
|
||||||
|
HL-Server wird ohne Anmeldung von Hardlocks als Daemon gestartet.
|
||||||
|
Sobald eine Client-Applikation ein unbekanntes Hardlock anfragt, wird es
|
||||||
|
gesucht und im Erfolgsfalle automatisch hinzugefuegt.
|
||||||
|
|
||||||
|
Wir empfehlen, "hlserver -d" an geeigneter Stelle in einem Startup-
|
||||||
|
Script einzufuegen.
|
||||||
|
|
||||||
|
Der HL-Server dokumentiert im Syslog (meistens in /var/log/messages)
|
||||||
|
Start und Stop sowie das An- und Abmelden von Hardlocks.
|
||||||
|
|
||||||
|
hlserver -m:29809 -d
|
||||||
|
|
||||||
|
HL-Server wird als Daemon gestartet und das Hardlock 29809 angemeldet.
|
||||||
|
Wird das Hardlock nicht gefunden, terminiert der Deamon sofort wieder.
|
||||||
|
|
||||||
|
|
||||||
|
Beenden des HL-Server
|
||||||
|
=====================
|
||||||
|
|
||||||
|
Das Stoppen des Daemons erfolgt wie ueblich mit "kill <processid>".
|
||||||
|
(HL-Server benutzt Posix-Threads, daher erscheint er in der Process List
|
||||||
|
mehrfach; es genuegt natuerlich, den ersten Thread zu killen, die
|
||||||
|
weiteren terminieren dann automatisch)
|
||||||
|
|
||||||
|
Die Applikation kann mit ^C beendet werden.
|
||||||
|
|
||||||
|
|
||||||
|
|
87
linux/hardlock/hlserver/readme.txt
Executable file
87
linux/hardlock/hlserver/readme.txt
Executable file
@ -0,0 +1,87 @@
|
|||||||
|
|
||||||
|
=========================================================================
|
||||||
|
HL-Server for Linux 11/2002
|
||||||
|
=========================================================================
|
||||||
|
|
||||||
|
|
||||||
|
General/Introduction
|
||||||
|
====================
|
||||||
|
|
||||||
|
HL-Server for Linux provides the same functionality as HL-Server for
|
||||||
|
Win32 (HLS32 and HLS32SVC) and HL-Server NLM. An application using the
|
||||||
|
HL-Server cannot recognize any difference between them. The Hardlocks
|
||||||
|
used are the same, so you can select the HL-Server that fits best into
|
||||||
|
your customers network environment. HL-Server for Linux supports IP/UDP
|
||||||
|
protocol and uses port 3047 (IANA-registered) for communications.
|
||||||
|
|
||||||
|
Using a demo Hardlock (module address 29809), you can test the HL-Server
|
||||||
|
without needing an HL-Server-Hardlock.
|
||||||
|
|
||||||
|
HL-Server can be started as a daemon (option -d) or as a console
|
||||||
|
application (-a). Console application mode can be used to track down
|
||||||
|
possible problems; it shows a trace of all client requests, similar to
|
||||||
|
the trace show by HLS32.EXE on Win32 after double clicking the Hardlock
|
||||||
|
Icon.
|
||||||
|
|
||||||
|
HL-Server for Linux can be watched and administered by AKSMON (Aladdin
|
||||||
|
Monitor) running on a Win32 machine; AKSMON itself does not run on Linux.
|
||||||
|
|
||||||
|
HL-Server for Linux also fully implements LiMaS and supports all
|
||||||
|
available HL-Server types (USB, parallel, internal).
|
||||||
|
|
||||||
|
|
||||||
|
Starting HL-Server for Linux
|
||||||
|
============================
|
||||||
|
|
||||||
|
Before HL-Server for Linux can be started, the Hardlock drivers
|
||||||
|
(aksparlnx.o and aksusbd) must be installed. Please consult the
|
||||||
|
install.txt file of the Hardlock driver for information.
|
||||||
|
|
||||||
|
HL-Server is started from the console with
|
||||||
|
|
||||||
|
hlserver [options]
|
||||||
|
|
||||||
|
The following options are supported:
|
||||||
|
|
||||||
|
-h display help
|
||||||
|
-a run as application (not as daemon)
|
||||||
|
-d run as daemon
|
||||||
|
-module:n[,m] module address [,max logins] of Hardlock (up to 10 times)
|
||||||
|
(optional, modules are auto-added when requested)
|
||||||
|
-timeout:n timeout value in minutes (1..9999, 0=none, default=15)
|
||||||
|
-zombie enable zombie mode for timed out logins
|
||||||
|
|
||||||
|
(all parameters may be abbreviated by their first letter)
|
||||||
|
|
||||||
|
You must specify at least the -a or -d option.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
hlserver -d
|
||||||
|
|
||||||
|
HL-Server starts as a daemon without registering any Hardlock.
|
||||||
|
Whenever a client application request an unknown Hardlock, HL-Server
|
||||||
|
looks for that Hardlock and adds it automatically, if available.
|
||||||
|
|
||||||
|
It is recommended to insert "hlserver -d" into the appropriate
|
||||||
|
startup script of the machine.
|
||||||
|
|
||||||
|
The daemon writes its start/stop events and adding/removing of
|
||||||
|
a hardlock to the syslog (normally in /var/log/messages).
|
||||||
|
|
||||||
|
hlserver -m:29809 -d
|
||||||
|
|
||||||
|
HL-Server starts as a daemon and tries to register Hardlock 29809.
|
||||||
|
If the Hardlock is not found, the daemon stops immediately.
|
||||||
|
|
||||||
|
|
||||||
|
Stopping the HL-Server
|
||||||
|
======================
|
||||||
|
|
||||||
|
The daemon is stopped as usual by "kill <processid>".
|
||||||
|
(HL-Server uses Posix threads, so it appears several times in the process
|
||||||
|
list; just kill the first thread, the others stop automatically.)
|
||||||
|
|
||||||
|
The application can be stopped with ^C.
|
||||||
|
|
||||||
|
|
BIN
linux/hardlock/linux105.tgz
Executable file
BIN
linux/hardlock/linux105.tgz
Executable file
Binary file not shown.
65
linux/hardlock/readme
Executable file
65
linux/hardlock/readme
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
|
||||||
|
Aladdin Knowledge Systems, Germany
|
||||||
|
|
||||||
|
Gabriele-Muenter-Str. 1
|
||||||
|
D-82110 Germering
|
||||||
|
Germany
|
||||||
|
|
||||||
|
TEL: ++49-89-894221-0
|
||||||
|
|
||||||
|
FAX: ++49-89-894221-40
|
||||||
|
Support: ++49-89-894221-33
|
||||||
|
|
||||||
|
Support/Development: tech@aladdin.de
|
||||||
|
Sales/Information: info@aladdin.de
|
||||||
|
|
||||||
|
Please visit our homepage on http://www.aladdin.de
|
||||||
|
|
||||||
|
|
||||||
|
Hardlock for Linux x86, Version 1.05, Oct-2002
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
Depending on the distribution used, one can install the drivers either
|
||||||
|
with rpm or manually, by extracting a tar archive.
|
||||||
|
|
||||||
|
|
||||||
|
Installing with RPM
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
If you use SuSE 7.3, 8.0 or 8.1, install the SuSE RPM packages:
|
||||||
|
|
||||||
|
rpm -i aksusbd-suse-1.5-2.i386.rpm
|
||||||
|
rpm -i aksparlnx-suse-1.05-2.i386.rpm
|
||||||
|
|
||||||
|
If you use RedHat 7.2 or 7.3, install the RedHat RPM packages:
|
||||||
|
|
||||||
|
rpm -i aksusbd-redhat-1.5-1.i386.rpm
|
||||||
|
rpm -i aksparlnx-redhat-1.05-1.i386.rpm
|
||||||
|
|
||||||
|
The aksusbd-xxx packages contain the USB daemon and are always
|
||||||
|
needed. The installation of aksparlnx-xxx is optional and only
|
||||||
|
neccessary if you use parallel port Hardlocks.
|
||||||
|
|
||||||
|
The rpm packages only contain the software needed to access
|
||||||
|
Hardlocks. The developer library and examples files for using Hardlock
|
||||||
|
in your application are contained in the tar archive only.
|
||||||
|
|
||||||
|
|
||||||
|
Installing the tar archive
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Unpack the archive with
|
||||||
|
|
||||||
|
tar -xzf [path/]linux105.tgz
|
||||||
|
|
||||||
|
It will create a hardlock subdirectory. The archive contains a README
|
||||||
|
file with more detailed installation instructions for aksusbd and
|
||||||
|
aksparlnx.
|
||||||
|
|
||||||
|
|
||||||
|
For further information about integrating Hardlock protection into your
|
||||||
|
application please refer to the printed documentation available from
|
||||||
|
Aladdin Knowledge Systems (High-API documentation) as well as the files
|
||||||
|
in the DOC directory.
|
||||||
|
|
||||||
|
{end-of-file, README}
|
BIN
linux/hardlock/sbin/aksusbd
Executable file
BIN
linux/hardlock/sbin/aksusbd
Executable file
Binary file not shown.
BIN
linux/hardlock/tools/get-key
Executable file
BIN
linux/hardlock/tools/get-key
Executable file
Binary file not shown.
BIN
linux/hardlock/tools/getports
Executable file
BIN
linux/hardlock/tools/getports
Executable file
Binary file not shown.
BIN
linux/hardlock/tools/hl-code
Executable file
BIN
linux/hardlock/tools/hl-code
Executable file
Binary file not shown.
BIN
linux/hardlock/tools/lxdrvver
Executable file
BIN
linux/hardlock/tools/lxdrvver
Executable file
Binary file not shown.
30
linux/hardlock/usr/Makefile
Executable file
30
linux/hardlock/usr/Makefile
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
# $Id: Makefile,v 1.1 2003-06-26 17:31:40 alex Exp $
|
||||||
|
#
|
||||||
|
# Makefile to create Hardlock Demo for Linux
|
||||||
|
#
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Author: alex $
|
||||||
|
#
|
||||||
|
|
||||||
|
CC = gcc
|
||||||
|
CFLAGS = -ansi -fomit-frame-pointer -fno-strength-reduce -Wall -DLINUX
|
||||||
|
|
||||||
|
all: hl-demo
|
||||||
|
|
||||||
|
rus: rusquery rusget ruswrite
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f hl-demo rusquery rusget ruswrite
|
||||||
|
|
||||||
|
hl-demo: libhlapi_lnx.a fastapi.h hlapi_c.h hl-demo.c
|
||||||
|
$(CC) $(CFLAGS) hl-demo.c -L. -lhlapi_lnx -o $@
|
||||||
|
|
||||||
|
rusquery: libhlapi_lnx.a fastapi.h hlapi_c.h rus/rusquery.c
|
||||||
|
$(CC) $(CFLAGS) -I . -I rus rus/rusquery.c -L. -lhlapi_lnx -o $@
|
||||||
|
|
||||||
|
rusget: libhlapi_lnx.a fastapi.h hlapi_c.h rus/rusget.c
|
||||||
|
$(CC) $(CFLAGS) -I . -I rus rus/rusget.c -L. -lhlapi_lnx -o $@
|
||||||
|
|
||||||
|
ruswrite: libhlapi_lnx.a fastapi.h hlapi_c.h rus/ruswrite.c
|
||||||
|
$(CC) $(CFLAGS) -I . -I rus rus/ruswrite.c -L. -lhlapi_lnx -o $@
|
||||||
|
|
638
linux/hardlock/usr/fastapi.h
Executable file
638
linux/hardlock/usr/fastapi.h
Executable file
@ -0,0 +1,638 @@
|
|||||||
|
/****************************************************************************/
|
||||||
|
/** **/
|
||||||
|
/** Hardlock **/
|
||||||
|
/** API-Structures and definitions **/
|
||||||
|
/** **/
|
||||||
|
/** This file contains some helpful defines to access a Hardlock using **/
|
||||||
|
/** the application programming interface (API) for Hardlock. **/
|
||||||
|
/** **/
|
||||||
|
/** Aladdin Germany **/
|
||||||
|
/** **/
|
||||||
|
/** Revision history **/
|
||||||
|
/** ----------------
|
||||||
|
*** $Log: not supported by cvs2svn $
|
||||||
|
*** Revision 1.46 2000/12/19 16:37:41 chris
|
||||||
|
*** detect MacOS X
|
||||||
|
***
|
||||||
|
***
|
||||||
|
*** Revision 1.45 2000/07/30 22:22:17 chris
|
||||||
|
*** ia64 detection
|
||||||
|
***
|
||||||
|
*** Revision 1.44 2000/07/10 09:45:09 chris
|
||||||
|
*** Module2 field
|
||||||
|
***
|
||||||
|
*** Revision 1.43 2000/05/25 14:11:43 chris
|
||||||
|
*** added some HASP stuff
|
||||||
|
***
|
||||||
|
*** Revision 1.42 2000/03/21 14:18:28 chris
|
||||||
|
*** HL_SIS and HL_LIS structure definitions
|
||||||
|
***
|
||||||
|
*** Revision 1.41 2000/02/18 14:04:44 chris
|
||||||
|
*** fixed pascal define for CygWin & MingW32
|
||||||
|
***
|
||||||
|
*** Revision 1.40 1999/12/06 13:06:11 chris
|
||||||
|
*** fixed structure packing for MSC compiler
|
||||||
|
***
|
||||||
|
*** Revision 1.39 1999/11/28 01:39:46 chris
|
||||||
|
*** added 64bit support (only tested with AlphaLinux currently)
|
||||||
|
***
|
||||||
|
*** Revision 1.38 1999/10/07 11:28:45 chris
|
||||||
|
*** Duplicate revision
|
||||||
|
***
|
||||||
|
*** Revision 1.37 1999/10/07 11:28:45 Henri
|
||||||
|
*** Removed uneeded TLV defines.
|
||||||
|
***
|
||||||
|
*** Revision 1.36 1999/10/07 10:47:04 Henri
|
||||||
|
*** Removed unused flags.
|
||||||
|
***
|
||||||
|
*** Revision 1.35 1999/09/30 09:27:46 Henri
|
||||||
|
*** Added PORT_BUSY.
|
||||||
|
***
|
||||||
|
*** Revision 1.34 1999/09/24 07:49:43 Werner
|
||||||
|
*** Added RUS_RTB_EXPIRED and RUS_SERIAL_MISMATCH
|
||||||
|
*** error codes.
|
||||||
|
***
|
||||||
|
*** Revision 1.33 1999/09/21 12:06:57 Henri
|
||||||
|
*** Arranged error codes.
|
||||||
|
***
|
||||||
|
*** Revision 1.32 1999/09/20 12:56:28 Werner
|
||||||
|
*** Added FORCE_ALF_CREATE constant.
|
||||||
|
***
|
||||||
|
*** Revision 1.31 1999/09/15 17:04:18 Henri
|
||||||
|
*** Changed WriteLicense.
|
||||||
|
***
|
||||||
|
*** Revision 1.30 1999/09/01 15:06:44 Adi
|
||||||
|
*** Added special handling of global expiration date.
|
||||||
|
***
|
||||||
|
*** Revision 1.29 1999/08/16 13:03:58 chris
|
||||||
|
*** restore previous structure packing after HL_API definition
|
||||||
|
*** (for MSVC)
|
||||||
|
***
|
||||||
|
*** Revision 1.28 1999/08/08 23:10:55 chris
|
||||||
|
*** added 2 bytes to reserved field: API structure was 2 bytes too short
|
||||||
|
***
|
||||||
|
*** Revision 1.27 1999/08/04 13:04:41 chris
|
||||||
|
*** API_FFS_GETRUSINFO define
|
||||||
|
***
|
||||||
|
*** Revision 1.26 1999/08/04 11:03:33 chris
|
||||||
|
*** API_FFS_WRITE_LIC definition and some more status codes
|
||||||
|
***
|
||||||
|
*** Revision 1.25 1999/08/03 20:36:15 chris
|
||||||
|
*** renamed FIB structure to RUS_FIB to avoid clash
|
||||||
|
*** with api_defs.h
|
||||||
|
***
|
||||||
|
*** Revision 1.24 1999/07/26 10:58:28 Henri
|
||||||
|
*** Added FIB structure.
|
||||||
|
***
|
||||||
|
*** Revision 1.23 1999/07/19 10:29:35 Henri
|
||||||
|
*** Renamed define for BUFFER_TOO_SMALL
|
||||||
|
***
|
||||||
|
*** Revision 1.22 1999/07/19 10:11:30 Henri
|
||||||
|
*** Added RUS functionality.
|
||||||
|
***
|
||||||
|
*** Revision 1.21 1998/10/21 15:56:53 Henri
|
||||||
|
*** Changed defines for Borland Builder.
|
||||||
|
***
|
||||||
|
*** Revision 1.20 1998/08/14 11:33:54 Henri
|
||||||
|
*** Changed driver comment.
|
||||||
|
***
|
||||||
|
*** Revision 1.19 1998/07/10 12:34:05 Henri
|
||||||
|
*** Added define for Borland Builder.
|
||||||
|
***
|
||||||
|
*** Revision 1.18 1998/06/29 09:01:36 Henri
|
||||||
|
*** Extended API struc.
|
||||||
|
***
|
||||||
|
*** Revision 1.17 1998/06/08 16:36:31 chris
|
||||||
|
*** fixed structure packing on gcc version 2.7 and above
|
||||||
|
***
|
||||||
|
*** Revision 1.16 1998/05/08 14:11:33 Henri
|
||||||
|
*** Added defines for HL_READID.
|
||||||
|
***
|
||||||
|
*** Revision 1.15 1998/04/07 13:14:59 chris
|
||||||
|
*** added API_READ_ID function code
|
||||||
|
***
|
||||||
|
*** Revision 1.14 1998/02/17 21:56:19 Henri
|
||||||
|
*** Added pragma pack(1) for Watcom 11/DOS
|
||||||
|
***
|
||||||
|
*** Revision 1.13 1997/07/01 13:56:54 henri
|
||||||
|
*** Fixed defines for LabView.
|
||||||
|
***
|
||||||
|
*** Revision 1.12 1997/04/28 15:30:53 chris
|
||||||
|
*** define UNIX32 ifdef __QNX__
|
||||||
|
***
|
||||||
|
*** Revision 1.11 1997/02/03 18:08:36 henri
|
||||||
|
*** Renamed error 17
|
||||||
|
***
|
||||||
|
*** Revision 1.10 1997/01/30 17:16:55 henri
|
||||||
|
*** Added LM return codes.
|
||||||
|
***
|
||||||
|
*** Revision 1.9 1997/01/28 08:23:30 henri
|
||||||
|
*** Missed a semicolon ;-)
|
||||||
|
***
|
||||||
|
*** Revision 1.8 1997/01/27 17:57:11 henri
|
||||||
|
*** Added slot number in API structure.
|
||||||
|
***
|
||||||
|
*** Revision 1.7 1997/01/16 18:18:11 henri
|
||||||
|
*** Added API_LMINIT function code.
|
||||||
|
***
|
||||||
|
*** Revision 1.6 1996/11/13 16:55:49 chris
|
||||||
|
*** added SOLARIS & UNIX32 define
|
||||||
|
***
|
||||||
|
*** Revision 1.5 1996/08/12 16:23:43 henri
|
||||||
|
*** Added VCS log.
|
||||||
|
***
|
||||||
|
**/
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
#if !defined(_FASTAPI_H_)
|
||||||
|
#define _FASTAPI_H_
|
||||||
|
|
||||||
|
#if defined(LINUX) || defined(SOLARIS) || defined(SCO) || defined(__QNX__) || defined(DARWIN) || defined(MACOSX)
|
||||||
|
#define UNIX32
|
||||||
|
#if defined(__alpha__) || defined(__ia64__)
|
||||||
|
#ifndef __64BIT__
|
||||||
|
#define __64BIT__
|
||||||
|
#endif
|
||||||
|
#define NO_UNALIGN
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OS2__
|
||||||
|
#ifdef INTERNAL_16BITDLL
|
||||||
|
#define LOAD_DS
|
||||||
|
#else
|
||||||
|
#ifdef __WATCOMC__
|
||||||
|
#ifdef __386__ /* not the 16bit compiler */
|
||||||
|
#include <os2.h>
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <os2.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef OS_16
|
||||||
|
#define RET_ Word
|
||||||
|
#define FAR_ far pascal
|
||||||
|
#define DATAFAR_ far
|
||||||
|
#else
|
||||||
|
#define RET_ APIRET
|
||||||
|
#define FAR_
|
||||||
|
#define CALL_ APIENTRY
|
||||||
|
#define DATAFAR_
|
||||||
|
#endif
|
||||||
|
#pragma pack(2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef UNIX32
|
||||||
|
#define __386__
|
||||||
|
#define pascal
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define __386__
|
||||||
|
#if !defined(__CYGWIN__) && !defined(__MINGW32__)
|
||||||
|
#define pascal
|
||||||
|
#endif
|
||||||
|
#if ((__GNUC__==2) && (__GNUC_MINOR__>=7)) || (__GNUC__>2)
|
||||||
|
#define ALIGN_GCC __attribute__ ((__packed__))
|
||||||
|
#ifdef NO_UNALIGN
|
||||||
|
#define AS_ALIGN __attribute__ ((__aligned__(8)))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 900
|
||||||
|
#pragma pack(push,_fastapi_h_,1)
|
||||||
|
#else
|
||||||
|
#pragma pack(1)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(WINNT) || defined(__WIN32__) || defined(_WIN32)
|
||||||
|
#ifndef __386__ /* Watcom doesnt like it */
|
||||||
|
#define __386__
|
||||||
|
#endif
|
||||||
|
#ifdef DLL
|
||||||
|
#define CALL_ __stdcall
|
||||||
|
#else
|
||||||
|
#define CALL_
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DOS386 /* Symantec C */
|
||||||
|
#define __386__
|
||||||
|
#pragma pack(2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __HIGHC__ /* Metaware High C */
|
||||||
|
#define __386__
|
||||||
|
#define _PACKED _Packed
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __ZTC__ /* Zortech C */
|
||||||
|
#define __386__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef SALFORD /* Salford C */
|
||||||
|
#define ALIGN_ 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __WATCOMC__
|
||||||
|
#pragma pack(1)
|
||||||
|
#ifndef __386__
|
||||||
|
#ifndef OS_16
|
||||||
|
#define CALL_ cdecl
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _CVI_ /* LabWindows/CVI */
|
||||||
|
#define RET_ Word
|
||||||
|
#ifndef _NI_mswin32_
|
||||||
|
#define CALL_ pascal
|
||||||
|
#else /* No pascal in WIN32-Version of LabWindows/CVI 4.0.1 */
|
||||||
|
#define CALL_ _stdcall
|
||||||
|
#endif
|
||||||
|
#ifndef __386__ /* __386__ defined by LabWindows/CVI */
|
||||||
|
#define FAR_ far
|
||||||
|
#define DATAFAR_ far
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __386__
|
||||||
|
#define DATAFAR_
|
||||||
|
#define FAR_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HLHIGH_DLL
|
||||||
|
#define CALL_ pascal _export
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LOAD_DS
|
||||||
|
#define CALL_ _loadds
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef CALL_
|
||||||
|
#define CALL_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _PACKED
|
||||||
|
#define _PACKED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ALIGN_GCC
|
||||||
|
# define ALIGN_GCC
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DATAFAR_
|
||||||
|
#define DATAFAR_ far
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FAR_
|
||||||
|
#define FAR_ far
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RET_
|
||||||
|
#define RET_ Word
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef ALIGN_
|
||||||
|
#define ALIGN_
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef AS_ALIGN
|
||||||
|
#define AS_ALIGN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* -------------------------------- */
|
||||||
|
/* Definitions and API structures : */
|
||||||
|
/* -------------------------------- */
|
||||||
|
#ifdef __64BIT__
|
||||||
|
typedef unsigned int Long;
|
||||||
|
typedef unsigned long Int64;
|
||||||
|
#else
|
||||||
|
typedef unsigned long Long;
|
||||||
|
#endif
|
||||||
|
#ifndef __BCPLUSPLUS__
|
||||||
|
typedef unsigned char Byte;
|
||||||
|
typedef unsigned short Word;
|
||||||
|
#else
|
||||||
|
#ifndef VCL_H
|
||||||
|
typedef unsigned char Byte;
|
||||||
|
typedef unsigned short Word;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifndef __64BIT__
|
||||||
|
#define set_data_ptr(api,buf) (api)->Data=(Byte DATAFAR_ *)(buf)
|
||||||
|
#define get_data_ptr(api) ((void *)((api)->Data))
|
||||||
|
#else /* above macros for <=32 bit, below macros for >32 bit */
|
||||||
|
#define set_data_ptr(api,buf) do { (api)->Data=(((Long)(buf)) & 0xffffffffu); \
|
||||||
|
(api)->DataHigh=(((Long)(((Int64)(buf))>>32)) \
|
||||||
|
& 0xffffffffu);} while (0)
|
||||||
|
#define get_data_ptr(api) ((void *)((Int64)((api)->Data) | \
|
||||||
|
(((Int64)((api)->DataHigh))<<32)))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Word Use_Key;
|
||||||
|
Byte Key[8];
|
||||||
|
} ALIGN_GCC DES_MODE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Word ModAd; /* Hardlock module address */
|
||||||
|
Word Reg; /* Memory register adress */
|
||||||
|
Word Value; /* Memory value */
|
||||||
|
Byte Reserved[4];
|
||||||
|
} ALIGN_GCC EYE_MODE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Long PW1; /* HASP passwords */
|
||||||
|
Long PW2;
|
||||||
|
Word P1;
|
||||||
|
} ALIGN_GCC HASP_MODE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Word LT_Reserved;
|
||||||
|
Word Reg; /* Memory register adress */
|
||||||
|
Word Value; /* Memory value */
|
||||||
|
Word Password[2]; /* Access passwords */
|
||||||
|
} ALIGN_GCC LT_MODE;
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
DES_MODE Des;
|
||||||
|
EYE_MODE Eye;
|
||||||
|
LT_MODE Lt;
|
||||||
|
HASP_MODE Hasp;
|
||||||
|
} HARDWARE;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Word P2;
|
||||||
|
Word P3;
|
||||||
|
} ALIGN_GCC HASP_MODE2;
|
||||||
|
|
||||||
|
typedef union
|
||||||
|
{
|
||||||
|
HASP_MODE2 Hasp2;
|
||||||
|
} HARDWARE2;
|
||||||
|
|
||||||
|
typedef struct rus_fib
|
||||||
|
{
|
||||||
|
Byte MARKER[2];
|
||||||
|
Long SERIAL_ID;
|
||||||
|
Byte VERSION[2];
|
||||||
|
Word FIXED;
|
||||||
|
Word VAR;
|
||||||
|
Word CRC;
|
||||||
|
} ALIGN_GCC RUS_FIB;
|
||||||
|
|
||||||
|
typedef _PACKED struct ALIGN_ hl_api
|
||||||
|
{
|
||||||
|
Byte API_Version_ID[2]; /* Version */
|
||||||
|
Word API_Options[2]; /* API Optionflags */
|
||||||
|
Word ModID; /* Modul-ID (EYE = 0...) */
|
||||||
|
HARDWARE Module; /* Hardware type */
|
||||||
|
|
||||||
|
#ifdef __OS2__ /* Pointer to cipher data */
|
||||||
|
#ifdef OS_16
|
||||||
|
void far *Data;
|
||||||
|
#else
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
void FAR16PTR Data;
|
||||||
|
#else
|
||||||
|
void * _Seg16 Data;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#ifndef __64BIT__
|
||||||
|
void DATAFAR_ *Data;
|
||||||
|
#else
|
||||||
|
Long Data; /* low part only */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Word Bcnt; /* Number of blocks */
|
||||||
|
Word Function; /* Function number */
|
||||||
|
Word Status; /* Actual status */
|
||||||
|
Word Remote; /* Remote or local?? */
|
||||||
|
Word Port; /* Port address if local */
|
||||||
|
Word Speed; /* Speed of port if local */
|
||||||
|
Word NetUsers; /* Current Logins (HL-Server) */
|
||||||
|
Byte ID_Ref[8]; /* Referencestring */
|
||||||
|
Byte ID_Verify[8]; /* Encrypted ID_Ref */
|
||||||
|
Long Task_ID; /* Multitasking program ID */
|
||||||
|
Word MaxUsers; /* Maximum Logins (HL-Server) */
|
||||||
|
Long Timeout; /* Login Timeout in minutes */
|
||||||
|
Word ShortLife; /* (multiple use) */
|
||||||
|
Word Application; /* Application number */
|
||||||
|
Word Protocol; /* Protocol flags */
|
||||||
|
Word PM_Host; /* DOS Extender type */
|
||||||
|
Long OSspecific; /* ptr to OS specific data */
|
||||||
|
Word PortMask; /* Default local search (in) */
|
||||||
|
Word PortFlags; /* Default local search (out) */
|
||||||
|
Word EnvMask; /* Use env string search (in) */
|
||||||
|
Word EnvFlags; /* Use env string search (out) */
|
||||||
|
Byte EEFlags; /* EE type flags */
|
||||||
|
Word Prot4Info; /* (internal use) */
|
||||||
|
Byte FuncOptions; /* Enable add. functionality */
|
||||||
|
Word Slot_ID; /* Licence slot number */
|
||||||
|
Word Slot_ID_HIGH; /* Licence slot High value */
|
||||||
|
Word RUS_ExpDate; /* RUS Expiration date */
|
||||||
|
Long DataHigh; /* Pointer to data high value */
|
||||||
|
#ifndef __64BIT__
|
||||||
|
void DATAFAR_ *VendorKey; /* Pointer to RUS vendor key */
|
||||||
|
#else
|
||||||
|
Long VendorKey; /* dto. */
|
||||||
|
#endif
|
||||||
|
Long VendorKeyHigh; /* Vendor key high value */
|
||||||
|
Long OSspecificHigh; /* ptr to OS specific data */
|
||||||
|
Long RUS_MaxInfo; /* RUS max user/counter */
|
||||||
|
Long RUS_CurInfo; /* RUS current user/counter */
|
||||||
|
RUS_FIB RUS_Fib; /* RUS FIB structure */
|
||||||
|
HARDWARE2 Module2; /* 2nd hw dependend fields */
|
||||||
|
Byte Reserved2[122]; /* Reserved area */
|
||||||
|
} ALIGN_GCC AS_ALIGN HL_API, LT_API, HS_API;
|
||||||
|
|
||||||
|
typedef _PACKED struct ALIGN_ { /* HL_LIS slot information */
|
||||||
|
Long max_user;
|
||||||
|
Long cur_user;
|
||||||
|
Word exp_date;
|
||||||
|
Byte flag; /* singularity flag */
|
||||||
|
Byte res; /* filler to make structure size multiple of 4 bytes */
|
||||||
|
} ALIGN_GCC HL_SIS;
|
||||||
|
|
||||||
|
/* License Information Structure (HL_LIS) */
|
||||||
|
typedef _PACKED struct ALIGN_ {
|
||||||
|
Word current_date;
|
||||||
|
Word res;
|
||||||
|
Long num_slots;
|
||||||
|
Word glob_exp_date;
|
||||||
|
Word res2; /* filler to make size multiple of 4 bytes */
|
||||||
|
HL_SIS slots[1];
|
||||||
|
} ALIGN_GCC HL_LIS;
|
||||||
|
|
||||||
|
#ifdef UNIX32
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __OS2__
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#if _MSC_VER >= 900
|
||||||
|
#pragma pack(pop,_fastapi_h_)
|
||||||
|
#else
|
||||||
|
#pragma pack()
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* ------------- */
|
||||||
|
/* Module-ID's : */
|
||||||
|
/* ------------- */
|
||||||
|
#define EYE_DONGLE 0 /* Hardlock E-Y-E */
|
||||||
|
#define DES_DONGLE 1 /* FAST DES */
|
||||||
|
#define LT_DONGLE 3 /* Hardlock LT */
|
||||||
|
#define HASP_DONGLE 4 /* HASP */
|
||||||
|
|
||||||
|
/* --------------------- */
|
||||||
|
/* API function calls : */
|
||||||
|
/* --------------------- */
|
||||||
|
#define API_INIT 0 /* Init API structure */
|
||||||
|
#define API_DOWN 1 /* Free API structure */
|
||||||
|
#define API_FORCE_DOWN 31 /* Force deinintialization */
|
||||||
|
#define API_MULTI_SHELL_ON 2 /* MTS is enabled */
|
||||||
|
#define API_MULTI_SHELL_OFF 3 /* MTS is disabled */
|
||||||
|
#define API_MULTI_ON 4 /* Enable MTS */
|
||||||
|
#define API_MULTI_OFF 5 /* Disable MTS */
|
||||||
|
#define API_AVAIL 6 /* Dongle available? */
|
||||||
|
#define API_LOGIN 7 /* Login dongle server */
|
||||||
|
#define API_LOGOUT 8 /* Logout dongle server */
|
||||||
|
#define API_INFO 9 /* Get API informations */
|
||||||
|
#define API_GET_TASKID 32 /* Get TaskID from API */
|
||||||
|
#define API_LOGIN_INFO 34 /* Get API Login informations */
|
||||||
|
|
||||||
|
/* --------------------------- */
|
||||||
|
/* Data and memory functions : */
|
||||||
|
/* --------------------------- */
|
||||||
|
#define API_KEYE 11 /* Use KEYE for encryption */
|
||||||
|
#define API_READ 20 /* Read one word of dongle EEPROM */
|
||||||
|
#define API_WRITE 21 /* Write one word of dongle EEPROM */
|
||||||
|
#define API_READ_BLOCK 23 /* Read EEPROM in one block */
|
||||||
|
#define API_WRITE_BLOCK 24 /* Write EEPROM in one block */
|
||||||
|
#define API_READ_ID 29 /* Read USB ID memory */
|
||||||
|
#define API_ABORT 51 /* Critical Error Abort */
|
||||||
|
|
||||||
|
/* -------------- */
|
||||||
|
/* LM functions : */
|
||||||
|
/* -------------- */
|
||||||
|
#define API_LMINIT 40 /* LM compatible API_INIT replacement */
|
||||||
|
#define API_LMPING 41 /* checks if LM dongle and slot is available */
|
||||||
|
#define API_LMINFO 42 /* info about currently used LIMA */
|
||||||
|
|
||||||
|
/* --------------- */
|
||||||
|
/* RUS functions : */
|
||||||
|
/* --------------- */
|
||||||
|
#define API_FFS_INIT 256 /* RUS init function, downed with API_DOWN */
|
||||||
|
#define API_FFS_ISRUSHL 257 /* Is RUS HL ? */
|
||||||
|
#define API_FFS_LOGIN 258 /* RUS Login to Hardlock server */
|
||||||
|
#define API_FFS_CHECK_LIC 259 /* RUS Create LIS */
|
||||||
|
#define API_FFS_READ_LICBLOCK 260 /* RUS Read LIC Block */
|
||||||
|
#define API_FFS_QUERY_SLOT 261 /* RUS query slot function */
|
||||||
|
#define API_FFS_FREE_SLOT 262 /* RUS free slot */
|
||||||
|
#define API_FFS_OCCUPY_SLOT 263 /* RUS occupies a slot */
|
||||||
|
#define API_FFS_INC_CNTR 264 /* RUS counter increment */
|
||||||
|
#define API_FFS_PARSERTB 265 /* RUS Parse RTB */
|
||||||
|
#define API_FFS_GET_HWDEP_INFO 266 /* RUS get hardware dependent information */
|
||||||
|
#define API_FFS_WRITE_LIC 267 /* RUS write updated license information */
|
||||||
|
#define API_FFS_GETRUSINFO 269 /* get RUS info */
|
||||||
|
|
||||||
|
/* -------------------- */
|
||||||
|
/* Dongle access mode : */
|
||||||
|
/* -------------------- */
|
||||||
|
#define LOCAL_DEVICE 1 /* Query local HL only */
|
||||||
|
#define NET_DEVICE 2 /* Query remote HL only */
|
||||||
|
#define DONT_CARE 3 /* Query local or remote HL */
|
||||||
|
|
||||||
|
/* -------------------- */
|
||||||
|
/* EnvMask/Port Flags : */
|
||||||
|
/* -------------------- */
|
||||||
|
#define USB_DEVICE 256 /* Port flag for USB use */
|
||||||
|
#define IGNORE_ENVIRONMENT 0x8000 /* Ignore HL_SEARCH */
|
||||||
|
#define EEF_NOAUTOUSB 8 /* No automatic USB search */
|
||||||
|
|
||||||
|
/* ---------- */
|
||||||
|
/* RUS flags: */
|
||||||
|
/* ---------- */
|
||||||
|
#define FORCE_RUS 1 /* Enable RUS init without VK */
|
||||||
|
#define FORCE_ALF_CREATE 1 /* Force creation of ALF file in HLM_WRITELICENSE */
|
||||||
|
|
||||||
|
/* ------------------ */
|
||||||
|
/* API PM_Host ID's : */
|
||||||
|
/* ------------------ */
|
||||||
|
#define API_XTD_DETECT 0
|
||||||
|
#define API_XTD_DPMI 1 /* QDPMI, Borland, Windows ... */
|
||||||
|
#define API_XTD_PHAR386 2
|
||||||
|
#define API_XTD_PHAR286 3
|
||||||
|
#define API_XTD_CODEBLDR 4 /* Intel Code Builder */
|
||||||
|
#define API_XTD_COBOLXM 5
|
||||||
|
|
||||||
|
/* ------------------ */
|
||||||
|
/* API Status Codes : */
|
||||||
|
/* ------------------ */
|
||||||
|
#define STATUS_OK 0 /* API call was succesfull */
|
||||||
|
#define NOT_INIT 1 /* DONGLE not initialized */
|
||||||
|
#define ALREADY_INIT 2 /* Already initialized */
|
||||||
|
#define UNKNOWN_DONGLE 3 /* Device not supported */
|
||||||
|
#define UNKNOWN_FUNCTION 4 /* Function not supported */
|
||||||
|
#define HLS_FULL 6 /* HL-Server login table full */
|
||||||
|
#define NO_DONGLE 7 /* No device available */
|
||||||
|
#define NETWORK_ERROR 8 /* A network error occured */
|
||||||
|
#define NO_ACCESS 9 /* No device available */
|
||||||
|
#define INVALID_PARAM 10 /* A wrong parameter occured */
|
||||||
|
#define VERSION_MISMATCH 11 /* HL-Server not API version */
|
||||||
|
#define DOS_ALLOC_ERROR 12 /* Error on memory allocation */
|
||||||
|
#define CANNOT_OPEN_DRIVER 14 /* Can not open Hardlock driver */
|
||||||
|
#define INVALID_ENV 15 /* Invalid environment string */
|
||||||
|
#define DYNALINK_FAILED 16 /* Unable to get a function entry */
|
||||||
|
#define INVALID_LIC 17 /* No valid licence info (LM) */
|
||||||
|
#define NO_LICENSE 18 /* Slot/licence not enabled (LM) */
|
||||||
|
#define PORT_BUSY 19 /* Cannot acquire port */
|
||||||
|
#define RUS_NO_DEVICE 20 /* Key is no Hardlock RUS key */
|
||||||
|
#define RUS_INVALID_LIC 21 /* Invalid RUS license */
|
||||||
|
#define RUS_SYNC_ERR 22 /* FIB in key and api struc mismatch */
|
||||||
|
#define NOT_IMPLEMENTED 23 /* not (yet) implemented */
|
||||||
|
#define BUFFER_TOO_SMALL 24 /* Buffer for function too small */
|
||||||
|
#define UNKNOWN_HW_TYPE 25 /* unknown hardware descriptor */
|
||||||
|
#define RUS_INV_FBPOS 26 /* unknown fixed block position */
|
||||||
|
#define RUS_INVALID_SLOT 27 /* Non-existing slot number given */
|
||||||
|
#define RUS_DATE_FAKE 28 /* RUS Date fake detected */
|
||||||
|
#define RUS_COUNT_DOWN 29 /* RUS dead counter limit reached */
|
||||||
|
#define RUS_INVALID_VK 30 /* RUS Vendor key is invalid */
|
||||||
|
#define RUS_NO_LIC_FILE 31 /* RUS License file not found */
|
||||||
|
#define RUS_INV_VBLOCK 32 /* RUS invalid variable block */
|
||||||
|
#define RUS_LIC_FILE_WRITE_ERR 33 /* error writing (updated) license file */
|
||||||
|
#define RUS_NO_INFO_AVAILABLE 34 /* GET_HWDEP_INFO: no info there */
|
||||||
|
#define RUS_INFO_PACK_ERR 35 /* " " " " : cannot TLV encode data */
|
||||||
|
#define RUS_LIC_WRITE_ERR 36 /* write license failed */
|
||||||
|
#define RUS_DATE_EXPIRED 37 /* RUS Expiration Date reached. */
|
||||||
|
#define TS_DETECTED 38 /* Term. Server / Citrix Winframe detected*/
|
||||||
|
#define RUS_INVALID_RTB 39 /* Invalid updated data (RTB) */
|
||||||
|
#define RUS_RTB_EXPIRED 40 /* Update data (RTB) has expired. */
|
||||||
|
#define RUS_SERIAL_MISMATCH 41 /* Update data serial does not match */
|
||||||
|
#define TOO_MANY_USERS 256 /* Login table full (remote) */
|
||||||
|
#define SELECT_DOWN 257 /* Printer not On-line */
|
||||||
|
#define NO_SERIALID 258 /* Serial ID not readable or n/a */
|
||||||
|
|
||||||
|
#endif /*_FASTAPI_H_*/
|
||||||
|
/* eof */
|
||||||
|
|
BIN
linux/hardlock/usr/hl-demo
Executable file
BIN
linux/hardlock/usr/hl-demo
Executable file
Binary file not shown.
295
linux/hardlock/usr/hl-demo.c
Executable file
295
linux/hardlock/usr/hl-demo.c
Executable file
@ -0,0 +1,295 @@
|
|||||||
|
/****************************************************************************/
|
||||||
|
/** **/
|
||||||
|
/** Hardlock Demo Program **/
|
||||||
|
/** **/
|
||||||
|
/** This demo program is based on the Hardlock application interface, **/
|
||||||
|
/** called API, to access a Hardlock via a local or a remote port. **/
|
||||||
|
/** To access the Hardlock remote, HL-Server must be installed first. **/
|
||||||
|
/** **/
|
||||||
|
/** ///FAST Software Security - Group Aladdin **/
|
||||||
|
/** **/
|
||||||
|
/** Computer: IBM PC or compatible **/
|
||||||
|
/** OS : MS-PC/DOS 2.0 or higher, OS/2, Windows NT **/
|
||||||
|
/** Language: 16/32 bit C (TURBO C, MSC, WATCOM) **/
|
||||||
|
/** **/
|
||||||
|
/** Note **/
|
||||||
|
/** ---- **/
|
||||||
|
/** The following demo program is not meant to represent a real good **/
|
||||||
|
/** implementation of software protection into your application. It **/
|
||||||
|
/** demonstrates the basic use of the Hardlock API functions and is **/
|
||||||
|
/** thus as short and simple as possible. Please read the manual **/
|
||||||
|
/** carefully to get an insight in the strategy of the implementation. **/
|
||||||
|
/** Please keep in mind that there is no general solution for a good **/
|
||||||
|
/** protection. We provide you with the necessary functions, the **/
|
||||||
|
/** implementation itself is up to you and your imagination. **/
|
||||||
|
/** **/
|
||||||
|
/** Revision history **/
|
||||||
|
/** ----------------
|
||||||
|
*** $Log: not supported by cvs2svn $
|
||||||
|
*** Revision 1.4 1999/12/15 09:52:54 chris
|
||||||
|
*** don't print control chars
|
||||||
|
***
|
||||||
|
***
|
||||||
|
*** Revision 1.3 1998/07/13 16:27:57 chris
|
||||||
|
*** Added HL_READID call
|
||||||
|
***
|
||||||
|
*** Revision 1.2 1997/02/14 11:14:28 chris
|
||||||
|
*** added LM error messages
|
||||||
|
***
|
||||||
|
*** Revision 1.1 1996/11/13 20:08:09 chris
|
||||||
|
*** Initial revision
|
||||||
|
**/
|
||||||
|
/****************************************************************************/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "hlapi_c.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* Module address of Hardlock test device and RefKey/VerKey. We generated */
|
||||||
|
/* the VerifyKey with TESTAPI.EXE. The API use the keys to identify the */
|
||||||
|
/* Hardlock with the correct encoding. */
|
||||||
|
/* The keys defined here are only valid for the demo module. */
|
||||||
|
/* You have to change module address AND VerKey for your specific Hardlock! */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
#define MODAD 29809
|
||||||
|
Byte RefKey[8] = {'H','A','R','D','L','O','C','K'};
|
||||||
|
Byte VerKey[8] = {0x18,0x4C,0x97,0xF0,0xC0,0x7A,0x08,0x88};
|
||||||
|
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
/* CryptStr contains the encrypted message : */
|
||||||
|
/* "The Answer to the Great Question" */
|
||||||
|
/* (only valid for the demo module). */
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
Byte CryptStr[33] =
|
||||||
|
{0x2D, 0xD4, 0x16, 0xA3, 0x19, 0x5C, 0xC2, 0x18,
|
||||||
|
0xAB, 0xA3, 0x8C, 0xDC, 0x8E, 0x66, 0xD4, 0xAB,
|
||||||
|
0x8F, 0xC0, 0x2F, 0x19, 0x39, 0xBA, 0x76, 0x5C,
|
||||||
|
0xE2, 0x06, 0x7C, 0x98, 0xC8, 0xA3, 0x55, 0x24,
|
||||||
|
0x00};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
char Text[33]; /* Temp. Var. */
|
||||||
|
Word n, Reg, Val; /* Counter, Register & Value */
|
||||||
|
Word TestOK; /* Return value from subroutines */
|
||||||
|
Byte Memory[128]; /* Save old Hardlock RAM & ROM */
|
||||||
|
Byte OldMem[128]; /* " " */
|
||||||
|
Byte NewRAM[33]; /* New Hardlock RAM */
|
||||||
|
Long SerialID = 0; /* Module internal serial ID */
|
||||||
|
|
||||||
|
printf("\n+---------------+");
|
||||||
|
printf("\n| Hardlock Demo |");
|
||||||
|
printf("\n+---------------+\n\n");
|
||||||
|
|
||||||
|
/* ------------------------------------- */
|
||||||
|
/* First we need to initialize the API : */
|
||||||
|
/* ------------------------------------- */
|
||||||
|
TestOK = HL_LOGIN(MODAD, DONT_CARE, RefKey, VerKey);
|
||||||
|
if(TestOK != STATUS_OK)
|
||||||
|
{
|
||||||
|
switch (TestOK)
|
||||||
|
{
|
||||||
|
case NETWORK_ERROR:
|
||||||
|
printf(" Sorry, a network error occured, maybe protocol (IPX/Netbios) not loaded!!\n\n");
|
||||||
|
break;
|
||||||
|
case NO_DONGLE:
|
||||||
|
printf(" Sorry, no Hardlock with this ID found!!\n\n");
|
||||||
|
break;
|
||||||
|
case VERSION_MISMATCH:
|
||||||
|
printf(" Sorry, version mismatch between API and HL-Server or device driver!!\n\n");
|
||||||
|
break;
|
||||||
|
case TOO_MANY_USERS:
|
||||||
|
printf(" Sorry, too many logins to HL-Server. Login table full!!\n\n");
|
||||||
|
break;
|
||||||
|
case CANNOT_OPEN_DRIVER:
|
||||||
|
printf(" Sorry, cannot open driver, maybe Hardlock driver not installed!!\n\n");
|
||||||
|
break;
|
||||||
|
case INVALID_ENV:
|
||||||
|
printf(" Sorry, invalid environment search string!! (HL_SEARCH)\n\n");
|
||||||
|
break;
|
||||||
|
case INVALID_LIC:
|
||||||
|
printf(" Sorry, no valid licence memory image found!! (LM)\n\n");
|
||||||
|
break;
|
||||||
|
case NO_LICENSE:
|
||||||
|
printf(" Sorry, no licence information for the requested slot!! (LM)\n\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf(" Sorry, an unexpected error occured!! ERROR: %d\n\n", TestOK);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return (TestOK);
|
||||||
|
}
|
||||||
|
printf("\n Hardlock with Module address\t\t: %d\n", MODAD);
|
||||||
|
|
||||||
|
/* ---------------------------- */
|
||||||
|
/* Get the API version number : */
|
||||||
|
/* ---------------------------- */
|
||||||
|
printf(" The API version is\t\t\t: %d\n",HL_VERSION());
|
||||||
|
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
/* Looking for the Hardlock with the expected coding. */
|
||||||
|
/* ----------------------------------------------------- */
|
||||||
|
if(HL_AVAIL() == STATUS_OK)
|
||||||
|
printf(" The connected Hardlock is\t\t: Test device\n");
|
||||||
|
else
|
||||||
|
printf(" The connected Hardlock is\t\t: Not the test device\n");
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
/* Now we can get some informations about the connected module. */
|
||||||
|
/* ------------------------------------------------------------ */
|
||||||
|
TestOK = HL_ACCINF();
|
||||||
|
switch (TestOK)
|
||||||
|
{
|
||||||
|
case LOCAL_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t\t: Local\n");
|
||||||
|
printf(" Connected to the local port address\t: 0x%03X\n", HL_PORTINF());
|
||||||
|
break;
|
||||||
|
case NET_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t\t: Remote\n");
|
||||||
|
printf(" The HL-Server version is\t\t: %d\n", HL_HLSVERS());
|
||||||
|
printf(" Connected to the remote port address\t: 0x%03X\n", HL_PORTINF());
|
||||||
|
printf(" Number of users logged in HL-Server is\t: %d\n", HL_USERINF());
|
||||||
|
printf(" The max. number of HL-Server logins is\t: %d\n", HL_MAXUSER());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf(" The Hardlock access is\t\t: No access\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
/* Read the internal serial number of Hardlock USB Module */
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
TestOK = HL_READID((Word *)&SerialID, ((Word *)&SerialID)+1);
|
||||||
|
switch (TestOK)
|
||||||
|
{
|
||||||
|
case STATUS_OK:
|
||||||
|
printf(" The serial number ID is\t\t: %lu (0x%08lX)\n", SerialID, SerialID);
|
||||||
|
break;
|
||||||
|
case NO_SERIALID:
|
||||||
|
printf(" The serial number ID is\t\t: not available for this Key\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf(" Cannot determine serial ID, API error:\t: %i\n", TestOK);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
/* Now we decrypt the message from CryptStr. Maybe we use */
|
||||||
|
/* the message in our application. */
|
||||||
|
/* ------------------------------------------------------ */
|
||||||
|
printf("\n The encrypted message is\t\t: ");
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c",(CryptStr[n] < 32 || CryptStr[n] > 126) ? '.' : CryptStr[n]);
|
||||||
|
|
||||||
|
TestOK = HL_AVAIL();
|
||||||
|
|
||||||
|
if (TestOK == STATUS_OK)
|
||||||
|
TestOK = HL_CODE(CryptStr, 4);
|
||||||
|
if(TestOK == STATUS_OK)
|
||||||
|
{
|
||||||
|
/* ------------------------------------------------- */
|
||||||
|
/* HL_CODE returned 0, CryptStr should be decrypted. */
|
||||||
|
/* ------------------------------------------------- */
|
||||||
|
printf("\n The decrypted message is\t\t: ");
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c",(CryptStr[n] < 32 || CryptStr[n] > 126) ? '.' : CryptStr[n]);
|
||||||
|
|
||||||
|
HL_CODE(CryptStr, 4);
|
||||||
|
printf("\n Encrypted again\t\t\t: ");
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c",(CryptStr[n] < 32 || CryptStr[n] > 126) ? '.' : CryptStr[n]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* ----------------------------------------------------------------------*/
|
||||||
|
/* HL_CODE returned an other value, maybe someone removed the Hardlock ? */
|
||||||
|
/* ----------------------------------------------------------------------*/
|
||||||
|
printf("\n Sorry, the decryption has failed!");
|
||||||
|
|
||||||
|
/* ---------------------------------------------------- */
|
||||||
|
/* We're looking for the memory option of the Hardlock. */
|
||||||
|
/* ---------------------------------------------------- */
|
||||||
|
TestOK = HL_MEMINF();
|
||||||
|
if(TestOK == STATUS_OK)
|
||||||
|
{
|
||||||
|
printf("\n\n Hardlock with memory\t\t\t: Yes\n");
|
||||||
|
|
||||||
|
/* ------------------------------------------------------- */
|
||||||
|
/* Now we can work with the memory. Let's read the string */
|
||||||
|
/* written in register 48 to 63. */
|
||||||
|
/* ------------------------------------------------------- */
|
||||||
|
for(n = 0, Reg = 48; Reg < 64; Reg++)
|
||||||
|
{
|
||||||
|
/* -------------------------------------------------------- */
|
||||||
|
/* The memory is organized as 16 bit registers, so we have */
|
||||||
|
/* to perform a typecasting. */
|
||||||
|
/* -------------------------------------------------------- */
|
||||||
|
HL_READ(Reg, &Val);
|
||||||
|
Text[n++] = (char) (Val >> 8);
|
||||||
|
Text[n++] = (char) (Val & 255);
|
||||||
|
}
|
||||||
|
/* ---------------------------------- */
|
||||||
|
/* We terminate the string with 0 ... */
|
||||||
|
/* ---------------------------------- */
|
||||||
|
Text[n] = '\0';
|
||||||
|
|
||||||
|
/* ----------------- */
|
||||||
|
/* ... and print it. */
|
||||||
|
/* ----------------- */
|
||||||
|
printf(" Read all registers of RAM area (Intel)\t: [");
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c", ((unsigned char) Text[n] < 32 || (unsigned char) Text[n] > 126) ? '.' : Text[n]);
|
||||||
|
printf("]\n\n");
|
||||||
|
|
||||||
|
/* ------------------------------------*/
|
||||||
|
/* Read RAM & ROM memory in one block. */
|
||||||
|
/* ------------------------------------*/
|
||||||
|
TestOK = HL_READBL(Memory);
|
||||||
|
if (TestOK == STATUS_OK)
|
||||||
|
{
|
||||||
|
printf(" Read whole memory in one block\t\t: [");
|
||||||
|
for (n = 0; n < 4; n++)
|
||||||
|
{
|
||||||
|
if (n > 0)
|
||||||
|
printf(" \t\t\t\t\t [");
|
||||||
|
for (Reg = 32 * n; Reg < (32 + 32 * n); Reg++)
|
||||||
|
printf("%c",(Memory[Reg] < 32 || Memory[Reg] > 126) ? '.' : Memory[Reg]);
|
||||||
|
if (n < 3)
|
||||||
|
printf("]ROM\n");
|
||||||
|
else
|
||||||
|
printf("]RAM\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" Read whole memory in one block\t\t: Failed\n");
|
||||||
|
|
||||||
|
/* ---------------------------------------- */
|
||||||
|
/* Write new RAM area (no error handling) : */
|
||||||
|
/* ---------------------------------------- */
|
||||||
|
strncpy((char *) NewRAM,"This is the new RAM contents !!!",32);
|
||||||
|
printf(" Write new Hardlock RAM data (save old) : ");
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c", (NewRAM[n] < 32 || NewRAM[n] > 128) ? '.' : NewRAM[n] );
|
||||||
|
printf("\n");
|
||||||
|
HL_READBL(OldMem);
|
||||||
|
HL_WRITEBL(NewRAM);
|
||||||
|
printf(" Read contents of RAM area \t\t: [");
|
||||||
|
HL_READBL(Memory);
|
||||||
|
for (n = 0; n <= 32; n++)
|
||||||
|
NewRAM[n] = Memory[96 + n];
|
||||||
|
for (n = 0; n < 32; n++)
|
||||||
|
printf("%c", (NewRAM[n] < 32 || NewRAM[n] > 128) ? '.' : NewRAM[n] );
|
||||||
|
printf("]\n\n");
|
||||||
|
for (n = 0; n <= 32; n++)
|
||||||
|
NewRAM[n] = OldMem[96 + n];
|
||||||
|
HL_WRITEBL(NewRAM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("\n\n Hardlock with memory\t\t: No\n\n");
|
||||||
|
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
/* At last we have to release the API structure. */
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
return (HL_LOGOUT());
|
||||||
|
}
|
1449
linux/hardlock/usr/hlapi_c.c
Executable file
1449
linux/hardlock/usr/hlapi_c.c
Executable file
File diff suppressed because it is too large
Load Diff
72
linux/hardlock/usr/hlapi_c.h
Executable file
72
linux/hardlock/usr/hlapi_c.h
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
/* $Id: hlapi_c.h,v 1.1 2003-06-26 17:31:42 alex Exp $ */
|
||||||
|
|
||||||
|
#include "fastapi.h"
|
||||||
|
|
||||||
|
/* --------------------- */
|
||||||
|
/* Function prototypes : */
|
||||||
|
/* --------------------- */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ------------------ */
|
||||||
|
/* Basic Hardlock API */
|
||||||
|
/* ------------------ */
|
||||||
|
RET_ FAR_ CALL_ HL_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey);
|
||||||
|
RET_ FAR_ CALL_ HL_LOGOUT (void);
|
||||||
|
RET_ FAR_ CALL_ HL_AVAIL (void);
|
||||||
|
RET_ FAR_ CALL_ HL_PORTINF (void);
|
||||||
|
RET_ FAR_ CALL_ HL_ACCINF (void);
|
||||||
|
RET_ FAR_ CALL_ HL_USERINF (void);
|
||||||
|
RET_ FAR_ CALL_ HL_MAXUSER (void);
|
||||||
|
RET_ FAR_ CALL_ HL_MEMINF (void);
|
||||||
|
RET_ FAR_ CALL_ HL_CODE (void DATAFAR_ *Data, Word Count);
|
||||||
|
RET_ FAR_ CALL_ HL_WRITE (Word Reg, Word Value);
|
||||||
|
RET_ FAR_ CALL_ HL_READ (Word Reg, Word DATAFAR_ *Value);
|
||||||
|
RET_ FAR_ CALL_ HL_READBL (Byte DATAFAR_ *Eeprom);
|
||||||
|
RET_ FAR_ CALL_ HL_WRITEBL (Byte DATAFAR_ *Eeprom);
|
||||||
|
RET_ FAR_ CALL_ HL_ABORT (void);
|
||||||
|
RET_ FAR_ CALL_ HL_VERSION (void);
|
||||||
|
RET_ FAR_ CALL_ HL_HLSVERS (void);
|
||||||
|
RET_ FAR_ CALL_ HL_SELECT (HL_API DATAFAR_ *hl_ptr);
|
||||||
|
RET_ FAR_ CALL_ HL_READID (Word DATAFAR_ *IDLow, Word DATAFAR_ *IDHigh);
|
||||||
|
|
||||||
|
/* ---------------- */
|
||||||
|
/* Hardlock RUS API */
|
||||||
|
/* ---------------- */
|
||||||
|
RET_ FAR_ CALL_ HLM_LOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey, Byte DATAFAR_ * VKey, Long RUSOptions, Byte DATAFAR_ * SearchStr);
|
||||||
|
RET_ FAR_ CALL_ HLM_OCCUPYSLOT (Long Slot);
|
||||||
|
RET_ FAR_ CALL_ HLM_FREESLOT (Long Slot);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKSLOT (Long Slot, Long * MaxUser, Long * CurrentUser);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKCOUNTER (Word IncVal, Long * MaxCounter, Long * CurrentCounter);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKEXPDATE (Long Slot, Word * Year, Word * Month, Word * Day);
|
||||||
|
RET_ FAR_ CALL_ HLM_GETRUSINFO (Long * BufLen, Byte DATAFAR_ * RTBBuffer, Word Base64);
|
||||||
|
RET_ FAR_ CALL_ HLM_WRITELICENSE (Long BufLen, Byte DATAFAR_ * RTBBuffer, Word Access, Byte DATAFAR_ * SearchStr,Word Options);
|
||||||
|
RET_ FAR_ CALL_ HLM_ISRUSHL (Long * ID);
|
||||||
|
RET_ FAR_ CALL_ HLM_CHECKALLSLOTS (Long *BufLen, HL_LIS *Buffer);
|
||||||
|
RET_ FAR_ CALL_ HLM_LOGOUT (void);
|
||||||
|
|
||||||
|
/* ---------------------- */
|
||||||
|
/* Hardlock Error Routine */
|
||||||
|
/* ---------------------- */
|
||||||
|
const char * FAR_ CALL_ HL_ERRMSG (Word num, Long options, Byte ** errdefine, Byte ** errextmsg);
|
||||||
|
|
||||||
|
/* ------------------------------------------- */
|
||||||
|
/* Obsolete functions, for compatiblity only!! */
|
||||||
|
/* ------------------------------------------- */
|
||||||
|
#ifndef __OS2__
|
||||||
|
void FAR_ CALL_ HL_ON (Word Port, Word ModAd);
|
||||||
|
void FAR_ CALL_ HL_OFF (Word Port);
|
||||||
|
Word FAR_ CALL_ K_EYE (Word Port, char DATAFAR_ *Inp, Word BlkCnt);
|
||||||
|
void FAR_ CALL_ HL_WR (Word Port, Word Reg, Word Val);
|
||||||
|
Word FAR_ CALL_ HL_RD (Word Port, Word Reg);
|
||||||
|
void FAR_ CALL_ INT_ON (void);
|
||||||
|
void FAR_ CALL_ INT_OFF (void);
|
||||||
|
#endif
|
||||||
|
RET_ FAR_ CALL_ HL_CALC (Word i1, Word i2, Word i3, Word i4);
|
||||||
|
RET_ FAR_ CALL_ HL_LMLOGIN (Word ModAd, Word Access, Byte DATAFAR_ *RefKey, Byte DATAFAR_ *VerKey, Word SlotID, Byte DATAFAR_ *SearchStr);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
/* eof */
|
17
linux/hardlock/usr/rus/demo.h
Executable file
17
linux/hardlock/usr/rus/demo.h
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
/* Hardlock RUS Vendor Key (Runtime) */
|
||||||
|
/* Key Identification: demo.h */
|
||||||
|
/* Key Description: */
|
||||||
|
/* Aladdin Knowledge Systems */
|
||||||
|
/* Demo Vendor Key */
|
||||||
|
/* Creation date: Tuesday, August 17, 1999 at 10:06:05 AM */
|
||||||
|
|
||||||
|
unsigned char svk[]=
|
||||||
|
{
|
||||||
|
0x37, 0x0c, 0xb2, 0x07, 0x9f, 0x9a, 0x84, 0xf6,
|
||||||
|
0xba, 0x04, 0x09, 0x53, 0x59, 0x30, 0xa2, 0xa3,
|
||||||
|
0x3a, 0xec, 0xc5, 0xc7, 0xe8, 0xff, 0x34, 0x9b,
|
||||||
|
0x78, 0x65, 0xbb, 0x93, 0x50, 0x37, 0xc5, 0x7c,
|
||||||
|
0x04, 0xd8, 0x77, 0x19, 0x6e, 0x2b, 0x51, 0xc0,
|
||||||
|
0x08, 0xa8, 0xa0, 0x76, 0x0b, 0x2b, 0x76
|
||||||
|
};
|
||||||
|
|
140
linux/hardlock/usr/rus/rusget.c
Executable file
140
linux/hardlock/usr/rus/rusget.c
Executable file
@ -0,0 +1,140 @@
|
|||||||
|
/****************************************************************************/
|
||||||
|
/** **/
|
||||||
|
/** Hardlock RUS Demo Program **/
|
||||||
|
/** **/
|
||||||
|
/** This demo program is based on the Hardlock application interface, **/
|
||||||
|
/** called API, to access a Hardlock via a local or a remote port. **/
|
||||||
|
/** To access the Hardlock remote, HL-Server must be installed first. **/
|
||||||
|
/** **/
|
||||||
|
/** Aladdin Knowledge Systems, Germany **/
|
||||||
|
/** **/
|
||||||
|
/** Note **/
|
||||||
|
/** ---- **/
|
||||||
|
/** The following demo program is not meant to represent a real good **/
|
||||||
|
/** implementation of software protection into your application. It **/
|
||||||
|
/** demonstrates the basic use of the Hardlock API functions and is **/
|
||||||
|
/** thus as short and simple as possible. Please read the manual **/
|
||||||
|
/** carefully to get an insight in the strategy of the implementation. **/
|
||||||
|
/** Please keep in mind that there is no general solution for a good **/
|
||||||
|
/** protection. We provide you with the necessary functions, the **/
|
||||||
|
/** implementation itself is up to you and your imagination. **/
|
||||||
|
/** **/
|
||||||
|
/** Revision history **/
|
||||||
|
/** ----------------
|
||||||
|
*** $Log: not supported by cvs2svn $
|
||||||
|
*** Revision 1.3 2000/02/03 16:41:55 chris
|
||||||
|
*** adapted to new error message routine (HL_ERRMSG)
|
||||||
|
***
|
||||||
|
***
|
||||||
|
*** Revision 1.2 1999/10/13 16:31:19 chris
|
||||||
|
*** removed warnings
|
||||||
|
***
|
||||||
|
*** Revision 1.1 1999/10/13 16:14:22 chris
|
||||||
|
*** Initial revision
|
||||||
|
**/
|
||||||
|
/****************************************************************************/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include "hlapi_c.h"
|
||||||
|
#include "demo.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* Module address of Hardlock test device and RefKey/VerKey. We generated */
|
||||||
|
/* the VerifyKey with Latteccino. The API use the keys to identify the */
|
||||||
|
/* Hardlock with the correct encoding. */
|
||||||
|
/* The keys defined here are only valid for the demo module. */
|
||||||
|
/* You have to change module address AND VerKey for your specific Hardlock! */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#define MODAD 29809
|
||||||
|
Byte RefKey[8] = {'H','A','R','D','L','O','C','K'};
|
||||||
|
Byte VerKey[8] = {0x18,0x4C,0x97,0xF0,0xC0,0x7A,0x08,0x88};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Word res; /* Return value from subroutines */
|
||||||
|
Long BufLen;
|
||||||
|
Byte *LicBuffer;
|
||||||
|
FILE *licf;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
printf("\n+----------------------------+");
|
||||||
|
printf("\n| Hardlock RUS Get Data Test |");
|
||||||
|
printf("\n+----------------------------+\n");
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
{
|
||||||
|
printf(" Usage: %s <rus info block file>\n",*argv);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
licf = fopen(*(argv+1),"wb");
|
||||||
|
if (!licf)
|
||||||
|
{
|
||||||
|
printf(" Cannot create license file: %s\n",*(argv+1));
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ------------------------------------- */
|
||||||
|
/* First we need to initialize the API : */
|
||||||
|
/* ------------------------------------- */
|
||||||
|
res = HLM_LOGIN(MODAD, DONT_CARE, RefKey, VerKey, svk, 0, 0);
|
||||||
|
if(res != STATUS_OK)
|
||||||
|
{
|
||||||
|
printf(" Login: %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
return (res);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n RUS Hardlock with Module address: %d\n", MODAD);
|
||||||
|
|
||||||
|
res = HL_ACCINF();
|
||||||
|
switch (res)
|
||||||
|
{
|
||||||
|
case LOCAL_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t : Local\n");
|
||||||
|
break;
|
||||||
|
case NET_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t : Remote\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf(" The Hardlock access is\t\t : No access\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
printf(" Getting RUS Data\n");
|
||||||
|
printf(" ================\n");
|
||||||
|
BufLen = 0;
|
||||||
|
res = HLM_GETRUSINFO (&BufLen, NULL, 1);
|
||||||
|
if (res != STATUS_OK && res != BUFFER_TOO_SMALL)
|
||||||
|
printf(" GetRUSInfo returns: %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf(" Needed Length : %ld\n", BufLen);
|
||||||
|
LicBuffer = (Byte *) malloc(BufLen);
|
||||||
|
|
||||||
|
if (LicBuffer)
|
||||||
|
{
|
||||||
|
res = HLM_GETRUSINFO (&BufLen, LicBuffer, 1);
|
||||||
|
printf(" RusInfo returns : %d\n", res);
|
||||||
|
|
||||||
|
num = fwrite(LicBuffer, 1, BufLen, licf);
|
||||||
|
printf(" License length : %d bytes\n", num);
|
||||||
|
printf(" File written : %s\n", *(argv+1));
|
||||||
|
fclose(licf);
|
||||||
|
|
||||||
|
if (!num)
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
/* At last we have to release the API structure. */
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
return (HL_LOGOUT());
|
||||||
|
}
|
||||||
|
|
183
linux/hardlock/usr/rus/rusquery.c
Executable file
183
linux/hardlock/usr/rus/rusquery.c
Executable file
@ -0,0 +1,183 @@
|
|||||||
|
/****************************************************************************/
|
||||||
|
/** **/
|
||||||
|
/** Hardlock RUS Demo Program **/
|
||||||
|
/** **/
|
||||||
|
/** This demo program is based on the Hardlock application interface, **/
|
||||||
|
/** called API, to access a Hardlock via a local or a remote port. **/
|
||||||
|
/** To access the Hardlock remote, HL-Server must be installed first. **/
|
||||||
|
/** **/
|
||||||
|
/** Aladdin Knowledge Systems, Germany **/
|
||||||
|
/** **/
|
||||||
|
/** Note **/
|
||||||
|
/** ---- **/
|
||||||
|
/** The following demo program is not meant to represent a real good **/
|
||||||
|
/** implementation of software protection into your application. It **/
|
||||||
|
/** demonstrates the basic use of the Hardlock API functions and is **/
|
||||||
|
/** thus as short and simple as possible. Please read the manual **/
|
||||||
|
/** carefully to get an insight in the strategy of the implementation. **/
|
||||||
|
/** Please keep in mind that there is no general solution for a good **/
|
||||||
|
/** protection. We provide you with the necessary functions, the **/
|
||||||
|
/** implementation itself is up to you and your imagination. **/
|
||||||
|
/** **/
|
||||||
|
/** Revision history **/
|
||||||
|
/** ----------------
|
||||||
|
*** $Log: not supported by cvs2svn $
|
||||||
|
*** Revision 1.3 2000/02/03 16:42:13 chris
|
||||||
|
*** adapted to new error message routine (HL_ERRMSG)
|
||||||
|
***
|
||||||
|
***
|
||||||
|
*** Revision 1.2 1999/10/13 16:28:54 chris
|
||||||
|
*** fixed printf argument
|
||||||
|
***
|
||||||
|
*** Revision 1.1 1999/10/13 16:14:30 chris
|
||||||
|
*** Initial revision
|
||||||
|
**/
|
||||||
|
/****************************************************************************/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "hlapi_c.h"
|
||||||
|
#include "demo.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* Module address of Hardlock test device and RefKey/VerKey. We generated */
|
||||||
|
/* the VerifyKey with Latteccino. The API use the keys to identify the */
|
||||||
|
/* Hardlock with the correct encoding. */
|
||||||
|
/* The keys defined here are only valid for the demo module. */
|
||||||
|
/* You have to change module address AND VerKey for your specific Hardlock! */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#define MODAD 29809
|
||||||
|
Byte RefKey[8] = {'H','A','R','D','L','O','C','K'};
|
||||||
|
Byte VerKey[8] = {0x18,0x4C,0x97,0xF0,0xC0,0x7A,0x08,0x88};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
Word res; /* Return value from subroutines */
|
||||||
|
Long SlotCnt = 0;
|
||||||
|
Long MaxUser = 0;
|
||||||
|
Long CurrentUser = 0;
|
||||||
|
Long MaxCounter = 0;
|
||||||
|
Long CurrentCounter = 0;
|
||||||
|
Long ID = 0;
|
||||||
|
Word Year, Month, Day;
|
||||||
|
|
||||||
|
|
||||||
|
printf("\n+-------------------------+");
|
||||||
|
printf("\n| Hardlock RUS Query Test |");
|
||||||
|
printf("\n+-------------------------+\n");
|
||||||
|
|
||||||
|
/* ------------------------------------- */
|
||||||
|
/* First we need to initialize the API : */
|
||||||
|
/* ------------------------------------- */
|
||||||
|
res = HLM_LOGIN(MODAD, DONT_CARE, RefKey, VerKey, svk, 0, 0);
|
||||||
|
if(res != STATUS_OK)
|
||||||
|
{
|
||||||
|
printf(" Login: %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
return (res);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n RUS Hardlock with Module address: %d\n", MODAD);
|
||||||
|
|
||||||
|
res = HL_ACCINF();
|
||||||
|
switch (res)
|
||||||
|
{
|
||||||
|
case LOCAL_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t : Local\n");
|
||||||
|
break;
|
||||||
|
case NET_DEVICE:
|
||||||
|
printf(" The Hardlock access is\t\t : Remote\n");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf(" The Hardlock access is\t\t : No access\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a RUS Hardlock and display the RUS ID: */
|
||||||
|
/* ------------------------------------------------ */
|
||||||
|
printf("\n");
|
||||||
|
printf(" Checking global data\n");
|
||||||
|
printf(" ====================\n");
|
||||||
|
res = HLM_ISRUSHL(&ID);
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
printf(" RUS ID : %lu (0x%lx)\n", ID, ID);
|
||||||
|
else
|
||||||
|
printf(" RUS ID : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
/* Now read the global expiration date: */
|
||||||
|
/* ------------------------------------ */
|
||||||
|
res = HLM_CHECKEXPDATE(0, &Year, &Month, &Day);
|
||||||
|
if (res == STATUS_OK || res == RUS_DATE_EXPIRED)
|
||||||
|
{
|
||||||
|
printf(" ExpDate : Day:%d Month:%d Year:%d", Day, Month, Year);
|
||||||
|
if (res == RUS_DATE_EXPIRED)
|
||||||
|
printf(" (Expired)\n");
|
||||||
|
else
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" ExpDate : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
/* Check the counter but don't increment it: */
|
||||||
|
/* ----------------------------------------- */
|
||||||
|
res = HLM_CHECKCOUNTER(0, &MaxCounter, &CurrentCounter);
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
{
|
||||||
|
printf(" MaxCounter : %ld\n", MaxCounter);
|
||||||
|
printf(" CurCounter : %ld\n", CurrentCounter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" Counter : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
/* Retrieve the slot data and try a ocuppy and free: */
|
||||||
|
/* ------------------------------------------------- */
|
||||||
|
printf("\n Now Checking slot 1 to 4:\n");
|
||||||
|
|
||||||
|
for (SlotCnt = 1; SlotCnt < 5; SlotCnt++)
|
||||||
|
{
|
||||||
|
printf("\n");
|
||||||
|
printf(" Checking slot #%ld\n", SlotCnt);
|
||||||
|
printf(" =================\n");
|
||||||
|
|
||||||
|
res = HLM_OCCUPYSLOT(SlotCnt);
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
printf(" Occupy : OK\n");
|
||||||
|
else
|
||||||
|
printf(" Occupy : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
res = HLM_CHECKSLOT(SlotCnt, &MaxUser, &CurrentUser);
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
{
|
||||||
|
printf(" MaxUser : %ld\n", MaxUser);
|
||||||
|
printf(" CurUser : %ld\n", CurrentUser);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" User Count : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
res = HLM_CHECKEXPDATE(SlotCnt, &Year, &Month, &Day);
|
||||||
|
if (res == STATUS_OK || res == RUS_DATE_EXPIRED)
|
||||||
|
{
|
||||||
|
printf(" ExpDate : Day:%d Month:%d Year:%d", Day, Month, Year);
|
||||||
|
if (res == RUS_DATE_EXPIRED)
|
||||||
|
printf(" (Expired)\n");
|
||||||
|
else
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf(" ExpDate : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
res = HLM_FREESLOT(SlotCnt);
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
printf(" Free : OK\n");
|
||||||
|
else
|
||||||
|
printf(" Free : %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
/* At last we have to release the API structure. */
|
||||||
|
/* ---------------------------------------------- */
|
||||||
|
return (HL_LOGOUT());
|
||||||
|
}
|
||||||
|
|
99
linux/hardlock/usr/rus/ruswrite.c
Executable file
99
linux/hardlock/usr/rus/ruswrite.c
Executable file
@ -0,0 +1,99 @@
|
|||||||
|
/****************************************************************************/
|
||||||
|
/** **/
|
||||||
|
/** Hardlock RUS Demo Program **/
|
||||||
|
/** **/
|
||||||
|
/** This demo program is based on the Hardlock application interface, **/
|
||||||
|
/** called API, to access a Hardlock via a local or a remote port. **/
|
||||||
|
/** To access the Hardlock remote, HL-Server must be installed first. **/
|
||||||
|
/** **/
|
||||||
|
/** Aladdin Knowledge Systems, Germany **/
|
||||||
|
/** **/
|
||||||
|
/** Note **/
|
||||||
|
/** ---- **/
|
||||||
|
/** The following demo program is not meant to represent a real good **/
|
||||||
|
/** implementation of software protection into your application. It **/
|
||||||
|
/** demonstrates the basic use of the Hardlock API functions and is **/
|
||||||
|
/** thus as short and simple as possible. Please read the manual **/
|
||||||
|
/** carefully to get an insight in the strategy of the implementation. **/
|
||||||
|
/** Please keep in mind that there is no general solution for a good **/
|
||||||
|
/** protection. We provide you with the necessary functions, the **/
|
||||||
|
/** implementation itself is up to you and your imagination. **/
|
||||||
|
/** **/
|
||||||
|
/** Revision history **/
|
||||||
|
/** ---------------- **/
|
||||||
|
/**
|
||||||
|
*** $Log: not supported by cvs2svn $
|
||||||
|
*** Revision 1.3 2000/02/03 16:42:15 chris
|
||||||
|
*** adapted to new error message routine (HL_ERRMSG)
|
||||||
|
***
|
||||||
|
***
|
||||||
|
*** Revision 1.2 1999/10/13 16:35:56 chris
|
||||||
|
*** removed warnings
|
||||||
|
***
|
||||||
|
*** Revision 1.1 1999/10/13 16:14:34 chris
|
||||||
|
*** Initial revision
|
||||||
|
**/
|
||||||
|
/****************************************************************************/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <malloc.h>
|
||||||
|
#include "hlapi_c.h"
|
||||||
|
#include "demo.h"
|
||||||
|
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
/* Module address of Hardlock test device and RefKey/VerKey. We generated */
|
||||||
|
/* the VerifyKey with Latteccino. The API use the keys to identify the */
|
||||||
|
/* Hardlock with the correct encoding. */
|
||||||
|
/* The keys defined here are only valid for the demo module. */
|
||||||
|
/* You have to change module address AND VerKey for your specific Hardlock! */
|
||||||
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
#define MODAD 29809
|
||||||
|
Byte RefKey[8] = {'H','A','R','D','L','O','C','K'};
|
||||||
|
Byte VerKey[8] = {0x18,0x4C,0x97,0xF0,0xC0,0x7A,0x08,0x88};
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
/****************************************************************************/
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
Word res;
|
||||||
|
FILE *licf;
|
||||||
|
Byte *LicBuffer;
|
||||||
|
int num;
|
||||||
|
|
||||||
|
printf("\n+------------------------------+");
|
||||||
|
printf("\n| Hardlock RUS Write Data Test |");
|
||||||
|
printf("\n+------------------------------+\n");
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
{
|
||||||
|
printf(" Usage: %s <update block file>\n",*argv);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
licf = fopen(*(argv+1),"rb");
|
||||||
|
if (!licf)
|
||||||
|
{
|
||||||
|
printf(" Cannot open license file: %s\n",*(argv+1));
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LicBuffer = (Byte *) malloc(0x80000); /* 512k */
|
||||||
|
num = fread(LicBuffer,1,0x80000,licf);
|
||||||
|
printf(" License lenght: %d bytes\n",num);
|
||||||
|
fclose(licf);
|
||||||
|
|
||||||
|
if (!num)
|
||||||
|
return(1);
|
||||||
|
|
||||||
|
res = HLM_WRITELICENSE(num, LicBuffer, DONT_CARE, 0, 0);
|
||||||
|
|
||||||
|
if (res == STATUS_OK)
|
||||||
|
printf(" HLM_WRITELICENSE returned OK\n");
|
||||||
|
else
|
||||||
|
printf(" HLM_WRITELICENSE returned: %s\n", HL_ERRMSG(res, 0, NULL, NULL));
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
BIN
linux/hardlock/usr/rusget
Executable file
BIN
linux/hardlock/usr/rusget
Executable file
Binary file not shown.
BIN
linux/hardlock/usr/rusquery
Executable file
BIN
linux/hardlock/usr/rusquery
Executable file
Binary file not shown.
BIN
linux/hardlock/usr/ruswrite
Executable file
BIN
linux/hardlock/usr/ruswrite
Executable file
Binary file not shown.
BIN
linux/projects/agalib/agalib.mcp
Executable file
BIN
linux/projects/agalib/agalib.mcp
Executable file
Binary file not shown.
BIN
linux/projects/cb/cb.mcp
Executable file
BIN
linux/projects/cb/cb.mcp
Executable file
Binary file not shown.
BIN
linux/projects/uno/uno.mcp
Executable file
BIN
linux/projects/uno/uno.mcp
Executable file
Binary file not shown.
BIN
linux/projects/xi/xi.mcp
Executable file
BIN
linux/projects/xi/xi.mcp
Executable file
Binary file not shown.
BIN
linux/projects/xvaga/xvaga.mcp
Executable file
BIN
linux/projects/xvaga/xvaga.mcp
Executable file
Binary file not shown.
BIN
linux/projects/xvapp/xvapp.mcp
Executable file
BIN
linux/projects/xvapp/xvapp.mcp
Executable file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user