home *** CD-ROM | disk | FTP | other *** search
/ PC Shareware 1999 March / PCShareware-3-99.iso / IMPLE / DJGPP.RAR / DJGPP2 / CRCLOCKS.ZIP / CRCLOCK.TXT < prev    next >
Text File  |  1997-07-31  |  25KB  |  498 lines

  1. ┌────────────────────────────────────────────────────────────────────────────┐
  2. │ CRCLock Copyright (C) 1997 Jonathan Thorpe. Cause & Effect Industries.     │
  3. │ User Documentation Revision 1.9, Program Revision 2.4                      │
  4. │ ShareWare Version.                                                         │
  5. └────────────────────────────────────────────────────────────────────────────┘
  6.  
  7. ┌──────────┐
  8. │ Contents │
  9. └──────────┘
  10. [ 1] Terms of Usage.
  11. [ 2] What is CRCLock?
  12. [ 3] Features.
  13. [ 4] How does CRCLock work?
  14. [ 5] How safe is CRCLock?
  15. [ 6] The Armorment Levels.
  16. [ 7] Pitfalls and Weaknesses.
  17. [ 8] Improvements in the Pipeline.
  18. [ 9] Using CRCLock in a Program.
  19. [10] Compiling under GNU C (DJGPP).
  20. [11] Setting the CRC with CRCLock.
  21. [12] Error Messages.
  22. [13] What is BOSS?
  23. [14] Reporting Problems.
  24. [15] Official Copyright & Disclaimer.
  25.  
  26. ┌────────────────┐
  27. │ Terms of Usage │
  28. └────────────────┘
  29.  
  30.   At the current time CRCLock is not a Freeware product, CRCLock is a
  31. Shareware product meaning that you have the right to use it for up to 30 days,
  32. after which if you still wish to use CRCLock, you are obliged to register it.
  33. The registration terms and prices are as follows and a complete list of up
  34. to date pricing terms can be found at the CRCLock web site at:
  35. http://www.users.globalnet.co.uk/~jpt/CEI/cei.html, alternately you can link
  36. to this page by going to http://www.users.globalnet.co.uk/~jpt/index.html.
  37.  
  38. Pricing:
  39.  
  40. ┌──────────────┬───────────┬─────────────────────────────────────────────────┐
  41. │ Personal Use │Free       │You can use CRCLock indefinetly and for free, as │
  42. │              │           │long as you do not re-distribute your programs to│
  43. │              │           │other people and/or sell it on for a fee.        │
  44. ├──────────────┼───────────┼─────────────────────────────────────────────────┤
  45. │ Freeware     │Free       │Seen as though your're not making any money,     │
  46. │              │           │neither will I. If you use CRCLock in a Freeware │
  47. │              │           │program, that's fine by me and no fee will be    │
  48. │              │           │charged.                                         │
  49. ├──────────────┼───────────┼─────────────────────────────────────────────────┤
  50. │ Shareware    │£10.00     │If you use CRCLock in a Shareware program, you   │
  51. │              │           │are obliged to pay £10.00. This is an            │
  52. │              │           │insignificant fee to provide you with piece of   │
  53. │              │           │mind, especially if your registration fee is much│
  54. │              │           │higher than mine.                                │
  55. ├──────────────┼───────────┼─────────────────────────────────────────────────┤
  56. │ Commercial   │Negotiable │If you wish to use CRCLock in a commercial       │
  57. │              │           │program then the registration price will vary    │
  58. │              │           │depending on the volume you are intending to     │
  59. │              │           │market and your financial status. For example, a │
  60. │              │           │company will have to pay a greater fee, than a   │
  61. │              │           │standalone person attempting to start a          │
  62. │              │           │commerical venture.                              │
  63. └──────────────┴───────────┴─────────────────────────────────────────────────┘
  64.  
  65. Please go to the CEI website and then to the CRCLock link to find the real
  66. mailing address for payment. Send some e-mail with your registration request
  67. to jpt@globalnet.co.uk and payment plans will be returned to you as soon as
  68. possible.
  69.                            
  70.   In order to use CRCLock in your Public Domain, Freeware, Shareware or
  71. Commerical programs there are no special regulations that must be met except
  72. that you are not allowed to reverse engineer, disassemble or otherwise modify
  73. the CRCLock code (in this case CRCLock refers to both the master setting
  74. program as well as the mobile code). If you are found to have violated the
  75. terms stated above then you can expect full legal action to be taken against
  76. you at the earliest opportunity of the author. Also note that the author
  77. cannot be held responsible for any damage caused to your system or data
  78. via the direct or indirect use of CRCLock. By using CRCLock in a program,
  79. you are acknowledging and aggreeing to this license aggreement.
  80.  
  81. ┌──────────────────┐
  82. │ What is CRCLock? │
  83. └──────────────────┘
  84.  
  85.   CRCLock is a security utility that allows you to add validation security
  86. checks to your own C / C++ and GNU C programs, so that you can make sure
  87. that your code has not been infected with a virus, or tampered with in some
  88. other way, e.g. Reversed engineered by some would be hacker who wants to get
  89. past your copy protection.
  90.  
  91. ┌──────────┐
  92. │ Features │
  93. └──────────┘
  94.  
  95. - 3 Levels of Security Armorment.
  96. - Employs Proven and Very Secure CRC Locking Techniques.
  97. - Fast.
  98. - Provides Filename Authenticity Checking.
  99. - Provides FingerPrint Validation Checks.
  100. - Provides CRC16 and CRC32 support.
  101. - Provides protection to any Overlay data that is appended to the EXE.
  102. - Provides support for 16 and 32 bit compilers including DJGPP v2+.
  103.  
  104. ┌────────────────────────┐
  105. │ How does CRCLock work? │
  106. └────────────────────────┘
  107.   
  108.   CRCLock works on the well proven Cyclic Redundancy Check (CRC) theory.
  109. This technique creates a value that corresponds to all the bits of all the
  110. bytes contained in your source program, based upon a master equation which
  111. can be of varying accuracy. By default CRCLock uses a 4 polynomial equation.
  112. However, it is perfectly feasible for the user to modify this master equation
  113. for their own uses to reduce the risk of CRC duplication, and further increase
  114. the uniqueness of their own program.
  115.   The advantages to this technique are that if any single bit in your program
  116. is changed, it will completely change the output value created by the CRCLock
  117. code. This effect is further amplified by the back propogation technique that
  118. CRCLock uses to calculate its CRC's.
  119.   
  120.   CRCLock provides its security to your programs by creating a security
  121. FingerPrint which is completely unique to your program. This FingerPrint
  122. contains all of the necessary information that CRCLock requires to determine
  123. whether the file is unchanged or not.
  124.  
  125. ┌──────────────────────┐
  126. │ How safe is CRCLock? │
  127. └──────────────────────┘
  128.  
  129.   CRCLock comes with 3 main levels of security (Minimum, Standard and Maximum)
  130. Each different level of security has different advantages and disadvantages
  131. and it is up to you to decide which is best for your program.
  132.   Even under the minimum security setting CRCLock is still very strong, and
  133. it would take the talents of an experienced debugger (hacker) to modify the
  134. code in order to circumvent CRCLock. To help make this hacking process harder
  135. CRCLock implements what I call modular encryption. 
  136.   This is down to how CRCLock calculates the CRC and armors its FingerPrints, 
  137. instead of using just one function (procedure) to calculate the CRC, the 
  138. process is split into many different functions. This means that instead of 
  139. just redirecting one calculation routine the hacker must redirect them all 
  140. and then redirect the modular validation routines before they can bypass 
  141. CRCLock.
  142.   
  143.   You may be thinking "Why can't the hacker just modify the FingerPrint?".
  144. Well, quite simple they could, but the FingerPrint itself is armored. :)
  145. So, changing the FingerPrint would be a major feat of hacking, as with all
  146. security programs it would eventually be possible (by the use of brute force
  147. electronic methods) to break the locking method. This is again where the
  148. various levels of armorment come into play, in the standard and maximum
  149. armorment modes the FingerPrint itself is also protected against modification,
  150. so even if a hacker did break the CRCLock FingerPrint Armorment and change the
  151. embedded CRC, CRCLock would detect a FingerPrint Violation and fail. Either
  152. way the tampering has been detected and your code is safe.
  153.  
  154.  
  155. ┌──────────────────────┐
  156. │ The Armorment Levels │
  157. └──────────────────────┘
  158.  
  159.   You can lock your files using 1 of 3 different methods as mentioned earlier.
  160. They are:
  161.  1 - Minimum Armorment,
  162.  2 - Standard Armorment,
  163.  3 - Maximum Armorment.
  164.  
  165. Minimum Armorment:
  166.  
  167.  Minimum Armorment provides basic level protection for your programs. It is
  168. very fast at execution (practically un-noticable) even on large files.
  169. It provides a 16 bit CRC lock out and is very useful for small files where a
  170. large size increase in the main code would annoy you.
  171.  
  172. Standard Armorment:
  173.  
  174.  Standard Armorment provides a good general protection method. It implements
  175. a 16 bit CRC as with minimum armorment, but it also provides filename security
  176. and FingerPrint validation checking. This armorment level is again very fast
  177. (although it is slightly slower than minimal armorment) and provides good
  178. security.
  179.  Filename validation is a feature that you can use to determine whether
  180. somebody has attempted to rename the master EXE file for your program to
  181. pass it off as one of theirs. If they have you can abort execution.
  182.  
  183. Maximum Armorment:
  184.  
  185.  Maximum Armorment provides the ultimate in security protection for your
  186. programs, at a cost. Maximum security FingerPrints are much bigger than
  187. minimum security FingerPrints and Standard FingerPrints. Also the time
  188. required to calculate a Maximum Security FingerPrint is slightly greater than
  189. that of a standard FingerPrint.
  190.  Maximum level armorment provides:
  191.  - A 32 bit CRC (no change gets through this),
  192.  - Filename Validation,
  193.  - FingerPrint Validation,
  194.  - Much better security on large files (550Kb plus).
  195.  
  196.  
  197. ┌─────────────────────────┐
  198. │ Pitfalls and Weaknesses │
  199. └─────────────────────────┘
  200.  
  201.  16 bit CRC's are very safe, however, there comes a point in the locking
  202. process were the CRC value becomes overloaded and the register is reset by the
  203. CPU. When this happens the CRC is reset to zero and processing continues until
  204. the whole file has been processed. In the end the final value left is the CRC.
  205. This resetting effect means that it may be possible for tampering made to the
  206. file before the reset to be missed by the locking mechanism.
  207.  This resetting effect is extremely unlikely to occur and cause any problems
  208. because if the file is tampered with before the reset, the reset will occur
  209. at a different point in the file, therefore changing the final CRC, which
  210. allows CRCLock to detect the tampering.
  211.  
  212.  However, it was appreciated that this effect may disturb some users and so
  213. the option of a 32 bit CRC was added to the maximum armorment settings.
  214. The above effect is much more likely to occur on large files and so if your
  215. file is rather oversized and you can afford the extra FingerPrint space then
  216. use the maximum armorment settings.
  217.  
  218. Pitfalls:
  219.  Choose your armorment level carefully. Applying maximum armorment to a file
  220. that requires a very fast start up time is silly. This is because the maximum
  221. armorment takes longer to calculate its 32 bit CRC and perform all of its
  222. other validation checks before it will allow execution to continue.
  223. If you need a fast start up time, then you are much better off using minimum
  224. armorment which has no additional checks.
  225.  Other potential problems that you may run into with CRCLock are in the field
  226. of executable compression. Executable (EXE and COM) compressors cannot be
  227. run on any file that is going to be protected by CRCLock. This is because
  228. once the file is compressed, CRCLock will no longer be able to recognise its
  229. TagID and so it will have no way of determining how to lock the file.
  230.  As hope for the future, I am currently working on a version of CRCLock that
  231. can provide limited protection for files that are protected by executable
  232. compressors, however, this revision of CRCLock will not be available for some
  233. time, and will only be available to registered users.
  234.  
  235. ┌──────────────────────────────┐
  236. │ Improvements in the Pipeline │
  237. └──────────────────────────────┘
  238.  
  239. - Variable CRCID Initialisation String for Custom Setup.
  240. - Variable Size Polynomial Equations for Unique Custom CRC Tables.
  241. - Anti-Debugger Technology for the Mobile Code including:
  242. - Turbo Debugger Detection,
  243. - SoftIce Detection,
  244. - Instruction Trace Detection,
  245. - Stealth Mode to catch Interrupt Re-Vectoring.
  246.  
  247.  
  248. ┌────────────────────────────┐
  249. │ Using CRCLock in a Program │
  250. └────────────────────────────┘
  251.  
  252.   To integrate CRCLock into one or more of your programs you need to do
  253. several things. First of all, you need to add the "crclock.h" header file to
  254. your code. Once this is done, you then need to tell CRCLock to scan your
  255. program on startup. It is recommended that you make CRCLock the very first
  256. function in your program to execute, that way you can guarentee no malicious
  257. code is running before your program bothers to check whether it has been
  258. tampered with. Once all of this is done, you're nearly there, all you need to
  259. do now is compile your program and add the mobile code for CRCLock to the
  260. compilation sequence. With Turbo C++ 3.1, this is accomplished as follows:
  261. "tcc -ml -2 myprog.cpp clcodel.obj"
  262.   This will execute the Turbo C compiler, compile your program (myprog.cpp)
  263. and then it will add the CRCLock code for you (clcodel.obj) and resolve any
  264. inter-program references that my exist. You can add any compiler optimizations
  265. that you want to the command line in order to speed up the your code, CRCLock
  266. should be unaffected.
  267.   The last letter of the mobile code name (l in the example above), is the
  268. memory model that the mobile code was compiled with. So in the above example,
  269. "clcodel.obj" was compiled using the Large Memory model. The other memory
  270. models are supported in a similar fashion. For example to compile the above
  271. in the Compact memory model do the following: 
  272. "tcc -mc -2 myprog.cpp clcodec.obj". This only applies to 16 bit compilers
  273. or a compiler that is creating real mode code for you. 32 bit and protected
  274. mode compilers don't use memory models as such (technically they do, but they
  275. only have one, Flat mode, so there easy to support).
  276.  
  277. So to sum all of this up, do the following:
  278. 1) Add the "crclock.h" header file to your code.
  279. 2) Add code to startup CRCLock and perform checks.
  280. 3) Compile code with CRCLock Mobile Code linked in.
  281. 4) Run CRCLock itself, to install a FingerPrint into your program.
  282.  
  283.  Your program is now ready to run on it's own completely standalone without
  284. risk of anybody tampering with it.
  285.  
  286. For more information or if all of this seems a little daunting, see the
  287. provided example program called "myprog.cpp".
  288.  
  289.  
  290. ┌───────────────────────────────┐
  291. │ Compiling under GNU C (DJGPP) │
  292. └───────────────────────────────┘
  293.  
  294.   To compile your program under GNU C (DJGPP), you need version 2 or better
  295. of the program. CRCLock has not been tested on any version prior to 2 and it
  296. has not been tested on the beta versions of DJGPP v2.0 either. However, to
  297. compile your program under DJGPP, you do much the same as above for other
  298. compilers. First of all add the header file to your program then type the
  299. following at the command line:
  300. "gcc -m486 -O2 myprog.c gnucode.o -o myprog.exe"
  301.   
  302.   This will generate a standard stubbed GNU C 32 bit protected mode executable
  303. using 486 processor optimizations (this is the most advanced processor
  304. supported by DJGPP v2.0), using an optimization level of 2 and the output
  305. file will be "myprog.exe". All that's left for you to do now is set the CRC
  306. with CRCLock and pick an armorment level.
  307.  
  308. *** Please note that DJGPP *MUST* have the mobile code and other libraries
  309. *** that are to be linked to your program passed as the LAST parameters on the
  310. *** command line. This is a compiler quirk and not a problem with CRCLock.
  311. *** If you experience problems getting CRCLock to link in with your code,
  312. *** try rearranging the order in which the libraries are linked in.
  313.  
  314. ┌──────────────────────────────┐
  315. │ Setting the CRC with CRCLock │
  316. └──────────────────────────────┘
  317.  
  318.   After compiling your program and linking in the CRCLock mobile code, if you
  319. try to execute it you will be greeted with a message that states that your
  320. program has not been locked by CRCLock and then you are promptly returned to
  321. DOS. Don't worry, your program isn't broken. What has happened is that the
  322. mobile code of CRCLock has detected that it hasn't been locked and secured
  323. by the master setting program (called CRCLOCK.EXE), and so it bombs back to
  324. DOS telling you this. To correct the problem, run CRCLock on your program and
  325. select the level of armorment that you wish to protect your file with.
  326. For example to protect a file called MYPROG.EXE do the following:
  327. "CRCLock myprog.exe"
  328.   
  329.   This will lock the file "myprog.exe" using the standard armorment setting.
  330. To change the armorment use the command-line parameter "-l". To get a list
  331. of the command-line parameters, just type "CRCLock" on its own and press
  332. enter. To lock with maximum armorment you would do the following:
  333. "CRCLock myprog.exe -l3"
  334.  
  335.   The locking process consists of 3 stages that are performed by CRCLock.
  336. The size of your file determines how long this process takes, but you only
  337. have to do it once and the mobile code does not suffer from these speed
  338. problems. 
  339.   The first stage is the file analysis stage, this is the longest
  340. stage and during this operation CRCLock is examining your source code to
  341. determine whether or not CRCLock has been linked in.
  342.   The second stage is the FingerPrint construction stage. During this
  343. operation CRCLock is devising a FingerPrint that is suitable and Unique for
  344. your program.
  345.   The final stage is the armorment and storage of this FingerPrint in your
  346. source file. Once this is complete your file has been locked with the
  347. armorment settings that you specified.
  348.  
  349.  
  350. ┌────────────────┐
  351. │ Error Messages │
  352. └────────────────┘
  353.  
  354. CRCLock Specific:
  355. ─────────────────
  356.  
  357. "Can't open file 'filename.exe' for analysis."
  358.  
  359.   This error is generated by CRCLock when it cannot open the file you
  360. specified on the command line for processing. It is most likely that the
  361. file doesn't exist in the current directory or you made a spelling mistake.
  362. Correct this and you should have no problems.
  363.  
  364. "CRCID not found. CRCLock is not Present or file is already locked."
  365.  
  366.   This message is generated by CRCLock after the file analysis stage. The
  367. message is only generated if CRCLock could not find the TagID that it uses
  368. to determine whether CRCLock has been linked in with your code or not.
  369. If the message appears then the most likely explanation is that you forgot to
  370. link in the CRCLock Mobile Code with your orginal source file. See above on
  371. how to do this. The other possible explanation is that you have already
  372. locked the source file with CRCLock, in which case a second locking would not
  373. be possible.
  374.  
  375. "Multiple Instances of CRCID Found!! ID is not Unique."
  376.  
  377.   This message is only generated by CRCLock when it has found more than one
  378. instance of its TagID in your source file. If this is the case, then CRCLock
  379. does not know which is its own code and which is foriegn so it gives up and
  380. issues this error. The cause of this is most likely that a string in your file
  381. exactly matches (or contains a portion of) the TagID that CRCLock is currently
  382. using. To correct this change this string in your source code, or modify the
  383. TagID (CRCID) that CRCLock searches for. (Note: This function is currently
  384. only available to registered users).
  385.  
  386. CRCLock Mobile Code Specific:
  387. ─────────────────────────────
  388.  
  389. All of the following errors are generated by the BOSS, henceforth they may
  390. not appear exactly as they are shown below, but the wording will be identical.
  391. For more information on the BOSS please see the section further on in this
  392. documentation.
  393.  
  394.  
  395. "CRCLock Requires DOS 3.x of higher."
  396.  
  397.   CRCLock must run on a DOS version of 3.x or higher, otherwise it will not
  398. be able to locate the master filename for its filename checks. This is a
  399. problem with the revisions of DOS that were made by Microsoft. A correction
  400. that allows CRCLock to run on earlier versions of DOS is currently being
  401. worked on.
  402.   If you are confident that the armorment level of the file in question is
  403. MINIMUM then you can use the DOS function SETVER.EXE to fool CRCLock into
  404. thinking that it is running on a later version of DOS. This trick will ONLY
  405. work on the minimum armorment level, the Standard and Maximum levels are
  406. protected against this function.
  407.  
  408. "Self Access Error on file: 'filename.exe'."
  409.  
  410.   The mobile code for CRCLock was unable to access the EXE that it is linked
  411. into. This is most likely to be caused if you have used the DOS utility
  412. SETVER.EXE to modify the OS version number to fool CRCLock into running on
  413. DOS 3.x or less, and if you have locked the file with Standard or Maximum
  414. Armorment. It is also possible that this error may be caused by a sharing
  415. violation. If you are running the DOS Share utility, try removing it from
  416. memory. If you are running under Windows 3.x or 95, then quit to DOS.
  417.  
  418. "CRCLock FingerPrint Not Stored. Run CRCLock First."
  419.  
  420.   The mobile code for CRCLock has detected that the file it is linked to has
  421. not been locked by the CRCLock master program. If this is the case CRCLock
  422. cannot continue the file analysis because it has no reference FingerPrint
  423. with which to work. The solution to this is to simply run the CRCLock master
  424. program and lock the file with your prefered armorment level.
  425.  
  426. "FingerPrint Security Compromised."
  427.  
  428.   This is a particulally serious error. The error states that the CRCLock
  429. mobile code has detected that the FingerPrint locked into the file by the
  430. master program has been tampered with. In this case the remainder of the
  431. internal checks cannot continue because the reference FingerPrint is invalid.
  432. CRCLock will abort the program if this occurs, that way no damage can be done
  433. by the modified code. This error can only be generated by the Standard or the
  434. Maximum Armorment levels because the Minimum Armorment level does not lock
  435. any FingerPrint analysis data, in order to keep the FingerPrint size down.
  436.  
  437. ┌───────────────┐
  438. │ What is BOSS? │
  439. └───────────────┘
  440.  
  441.   BOSS stands for Basic Operations Support System and is an integral part of
  442. both CRCLock and its mobile code. BOSS provides (as the name states) support
  443. for all of the basic functions provided by an operating system and the run
  444. time libraries of most programming languages.
  445.   In the case of CRCLock BOSS performs functions such as file I/O, screen I/O,
  446. parameter checking and error handling. The version of BOSS that is provided
  447. with CRCLock and its mobile code is the cut down version, meaning that only
  448. the functions required by the specific program have been linked in to the
  449. main EXE. This is to keep size down and minimise any redundant code.
  450.   In the full version of BOSS, it is possible for your programs to communicate
  451. with BOSS to modify how it handles certain situations, but because your
  452. programs do not require the use of BOSS, these features are not linked in and
  453. so only the mobile code of CRCLock uses it. Due to this fact, some of the
  454. error messages displayed by CRCLock will be formatted and handled by BOSS,
  455. meaning they will appear differently to that shown in the Errors section of
  456. this document.
  457.  
  458. ┌────────────────────┐
  459. │ Reporting Problems │
  460. └────────────────────┘
  461.  
  462.   If you discover a bug or have noticed a specific problem with CRCLock on a
  463. particular system or under a certain set of circumstances, please detail the
  464. problem in a text file, including the machine specification that the problem
  465. occured on and any resident programs that may have been running, and send the
  466. information to 'jpt@globalnet.co.uk'.
  467.   This address should be valid until October 1997, if you mail this address
  468. and your mailer-daemon returns it as invalid, please download the latest
  469. version of CRCLock from where ever you obtained the first version and check
  470. the documentation for a new address.
  471.  
  472.  
  473. ┌─────────────────────────────────┐
  474. │ Official Copyright & Disclaimer │
  475. └─────────────────────────────────┘
  476.  
  477. Copyright 1995-1997 Cause & Effect Industries. All Rights Reserved.
  478.  
  479.   No part of this publication may be reproduced, transmitted, transcribed, 
  480. stored in a retrieval system, or translated into any other language or 
  481. computer language in whole or in part, in any form or by any means, whether 
  482. it be electronic, mechanical, magnetic, optical, manual or otherwise, without 
  483. prior written consent of Cause & Effect Industries.
  484.  
  485. CAUSE & EFFECT INDUSTRIES DISCLAIMS ALL WARRANTIES AS TO THIS SOFTWARE, 
  486. WHETHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
  487. WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, 
  488. FUNCTIONALITY, DATA INTEGRITY OR PROTECTION.
  489.  
  490.  
  491. CRCLock, BOSS, Cause & Effect Industries, CEI and the CEI logo are all 
  492. registered trademarks of Jonathan Thorpe and Cause & Effect Industries.
  493.  
  494.  
  495. Trademarks of other companies mentioned in this documentation appear for
  496. identification purposes only and are the property of their respective
  497. companies.
  498.