Add Original SDK
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
Fortran Sample Code notes
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
We supply separate sample code for different compilers as they all seem to compile Fortran
|
||||
slightly differently! In general the code is the same. The differences are in defining the
|
||||
DDProtCheck function in our runtime dll and in using random_set and CryptDris functions.
|
||||
The Intel compiler is much stricter and so the code is more complicated in this case
|
||||
(we must use "equivalence" so we can treat the DRIS type as a byte array in some cases).
|
||||
|
||||
Lahey Fortran Sample Code tested using 32-bit Lahey Fortran 7.2 and Visual Studio 2008
|
||||
Intel Fortran Sample Code tested using 32-bit and 64-bit Intel Fortran XE 2011 compiler & VS 2008
|
||||
(also tested with Intel Fortran 10.1 compiler but see note at the bottom of this file).
|
||||
|
||||
g95 has some unusual restrictions such as 132 characters for a line length. Only tested
|
||||
with 32-bit code.
|
||||
|
||||
We have not tested with GFortran but the code should be similar to g95.
|
||||
|
||||
Description of files:
|
||||
|
||||
dlltest.f90 Fortran sample code for Lahey Fortran
|
||||
DllTest.lfproj Visual Studio 2008 Project using Lahey Fortran
|
||||
Dlltest.sln Visual Studio 2008 Solution for Lahey Fortran
|
||||
|
||||
idlltest.f90 Fortran sample code for Intel Fortran
|
||||
iDllTest.vfproj Visual Studio 2008 Project using Intel Fortran
|
||||
iDlltest.sln Visual Studio 2008 Solution for Intel Fortran
|
||||
|
||||
gdlltest.f90 Fortan code using by g95 compiler.
|
||||
|
||||
The sample code contains 10 functions. You will not need to use all these
|
||||
functions in your code. Just use which ever functions are most appropriate
|
||||
and customise in your own way. The sample code is just a guide. You should
|
||||
implement the protection in a stronger way using the techniques described in
|
||||
the "Increasing your Protection" chapter of the manual.
|
||||
|
||||
Code marked with !!!! are places where you should customise the sample code so
|
||||
that it will work properly:
|
||||
|
||||
* Change the MY_SDSN value to the value of your SDSN
|
||||
* Change the MyAlgorithm code (if you call a user algorithm)
|
||||
* Change the CryptDRIS code (if you encrypt the DRIS)
|
||||
* Change the CryptApiData (if you encrypt Data you send to our API)
|
||||
* Change the MyRWAlgorithm code (if encrypt Data you send to our API using the R/W algorithm)
|
||||
|
||||
You will also probably want to replace our error messages with your own.
|
||||
|
||||
Note - you should protect dpwin32.dll and not your program. Because your program
|
||||
is linked to the DLL it is protected. The protected DLL will need to be in the
|
||||
same folder as your compiled program for it to run correctly.
|
||||
|
||||
Note - once dpwin32.dll is protected you will not be able to debug your program -
|
||||
after our API has been called. Our strong anti-debug code will cause the debugger
|
||||
to throw an exception. If you do want to debug your code then you can use our debug
|
||||
module: dpwin32debug.dll, but this should not be used for release. See readme.txt
|
||||
in samples\c for restrictions concerning the debug module.
|
||||
|
||||
Note - if you do not use Lahey/Intel Fortran or you use an earlier version of Visual Studio then
|
||||
you will have to create the solution & project yourself. (Newer versions of Visual Studio will
|
||||
update the project for you). It is not difficult. You have to link with the import library
|
||||
(which is in Microsoft format) dpwin32.lib (so your program knows how our API functions are
|
||||
formatted and the DLL name). For 64-bit compilations you link with dpwin64.lib. Both of these
|
||||
files are in the Modules\import_libs folder (also in Samples\C\import_libs). You should list
|
||||
this files in Project Settings | Linker | Input | Addition Dependencies.
|
||||
|
||||
Note - the Lahey sample only works with 32-bit Fortran (because that is all Lahey supports currently).
|
||||
The code should work with 64-bit Fortran also. However, you will have to change the "unused" element
|
||||
in the DRIS to be integer(8). i.e. 8 bytes and change DRIS_SIZE to 548.
|
||||
|
||||
Note - there appears to be a small bug in the 64-bit Intel 10.1 Fortran compiler. If you use this
|
||||
then you need to remove the word DECORATE in the DDProtCheck function declaration. This keyword is
|
||||
needed for the 32-bit compiler.
|
||||
|
||||
Note - For g95 you should compile like this (for example):
|
||||
g95 -Wno=101 gdlltest.f90 -B c:\c95\lib dpwin32.dll -o gDllTest.exe
|
||||
(the -Wno=101 removes warnings about the EQUIVALENCE statement we have to use in the sample)
|
||||
Reference in New Issue
Block a user