VX/FPT - Security: Making Code Unmaintainable

It is sometimes necessary to release proprietary or sensitive source code to third parties, so that it can be compiled and run in a new environment. VX/FPT can strip comments, remove formatting and rename symbols so that the code is un-maintainable, but still compiles and runs with its original meaning.

The code shown below is part of an (unclassified) F16 aircraft model (Thanks are due to John Hall, John Burnell and Gordon Dickman at DERA Bedford for its use).

           :
            :
      REAL    THTL,   THRSTKN
      REAL    YREFR,  ZREFR
      REAL    YREFT,  ZREFT
C
      REAL    TGEAR
C
      SAVE
C
C
C *********************************************************
C ***             Start of executable code              ***
C *********************************************************
C
C**********************************************************
C***                  Engine dynamics                   ***
C**********************************************************
C
C Initialize the engine power at the initial throttle
C
      IF (FPASS .EQ. 1) THEN
         ZPOW = TGEAR(THROT)
         POW  = TGEAR(THROT)
      ENDIF
C
C Throttle gearing
C
      CPOW =  TGEAR(THROT)
C
C Actual power lag
c ...bypass first order lag, if TENLAG = 0
C
      IF (TENLAG .GE. 0.5) THEN
         CALL PDOT(POW,CPOW,ZPOW)
      ELSE
         POW = CPOW
      ENDIF
C
C Gross thrust look-up table (look up table in metric)
C ...We have no mass flow data, so we can't compute ram drag
C    and hence net thrust
C
      CALL THRUST(POW,ALT,AMACH,GTHRUST)
C
C**********************************************************
C***              Engine sound variable                 ***
C**********************************************************
C
C Scale the engine sound variable for a 20.0 idle value
C
      IF (POW .LE. 50.0) THEN
	   RPMSND = POW / 50.0 * 80.0 + 20.0
      ELSE
	   RPMSND = POW + 50.0
      ENDIF
C
C**********************************************************
C*** Engine forces                                      ***
C**********************************************************
C
      THTL   = THTLN
      PSTL   = PSTLN
C
C     Evaluate sines and cosines of thrust line orientation in body axes.
C
      CTHTL  =  COS(THTL)
      STHTL  =  SIN(THTL)
            :
            :

If the model is to be linked against external libraries, the global names, the names of COMMON blocks and sub-programs, must be preserved. The command to VX/FPT is %hide names:2. The comments are stripped, the formatting is removed and local names are made meaningless:

           :
            :
      REAL A00786,A00787
      REAL A00788,A00789
      REAL A00790,A00791
      REAL TGEAR
      SAVE
      IF (I00727 .EQ. 1) THEN
      A00746=TGEAR(A00730)
      A00743=TGEAR(A00730)
      ENDIF
      A00736=TGEAR(A00730)
      IF (A00729 .GE. 0.5) THEN
      CALL PDOT(A00743,A00736,A00746)
      ELSE
      A00743=A00736
      ENDIF
      CALL THRUST(A00743,A00724,A00725,A00745)
      IF (A00743 .LE. 50.0) THEN
      A00744=A00743/50.0*80.0+20.0
      ELSE
      A00744=A00743+50.0
      ENDIF
      A00786=A00731
      A00765=A00728
      A00751=COS(A00786)
      A00785=SIN(A00786)
            :
            :

Note that TGEAR and THRUST have survived the name translation.

If the program does not call external routines (other than intrinsic functions) all of the names may be changed. The command is %hide names:3. The result is:

           :
            :
      REAL A00786,A00787
      REAL A00788,A00789
      REAL A00790,A00791
      REAL A00792
      SAVE
      IF (I00727 .EQ. 1) THEN
      A00746=A00792(A00730)
      A00743=A00792(A00730)
      ENDIF
      A00736=A00792(A00730)
      IF (A00729 .GE. 0.5) THEN
      CALL A00795(A00743,A00736,A00746)
      ELSE
      A00743=A00736
      ENDIF
      CALL A00796(A00743,A00724,A00725,A00745)
      IF (A00743 .LE. 50.0) THEN
      A00744=A00743/50.0*80.0+20.0
      ELSE
      A00744=A00743+50.0
      ENDIF
      A00786=A00731
      A00765=A00728
      A00751=COS(A00786)
      A00785=SIN(A00786)
            :
            :

The modified code still compiles, links and runs in exactly the same way as the original. However the effort required to recover the meaning and to make the code maintainable would be prohibitive.

 

Back to the VX/FPT Home Page