(**) (***************************************************************************) (** **) (** © Copyright 2010, Hewlett-Packard Development Company, L.P. **) (** **) (** Confidential computer software. Valid license from HP and/or **) (** its subsidiaries required for possession, use, or copying. **) (** **) (** Consistent with FAR 12.211 and 12.212, Commercial Computer Software, **) (** Computer Software Documentation, and Technical Data for Commercial **) (** Items are licensed to the U.S. Government under vendor's standard **) (** commercial license. **) (** **) (** Neither HP nor any of its subsidiaries shall be liable for technical **) (** or editorial errors or omissions contained herein. The information **) (** in this document is provided "as is" without warranty of any kind and **) (** is subject to change without notice. The warranties for HP products **) (** are set forth in the express limited warranty statements accompanying **) (** such products. Nothing herein should be construed as constituting an **) (** additional warranty. **) (** **) (***************************************************************************) (********************************************************************************************************************************) (* Created: 30-Mar-2010 16:22:33 by OpenVMS SDL EV3-3 *) (* Source: 21-SEP-2005 15:44:14 $1$DGA7374:[ENCRYPT.SRC]ENCRYPT_STRUCTURES.SDL;/ *) (********************************************************************************************************************************) MODULE ENCRYPT_STRUCTURES ; [HIDDEN] TYPE (**** Pre-declared data types ****) $BYTE = [BYTE] -128..127; $WORD = [WORD] -32768..32767; $QUAD = [QUAD,UNSAFE] RECORD L0:UNSIGNED; L1:INTEGER; END; $OCTA = [OCTA,UNSAFE] RECORD L0,L1,L2:UNSIGNED; L3:INTEGER; END; $UBYTE = [BYTE] 0..255; $UWORD = [WORD] 0..65535; $UQUAD = [QUAD,UNSAFE] RECORD L0,L1:UNSIGNED; END; $UOCTA = [OCTA,UNSAFE] RECORD L0,L1,L2,L3:UNSIGNED; END; $UOCTAQUAD = [OCTA(2),UNSAFE] RECORD L0,L1,L2,L3,L4,L5,L6,L7:UNSIGNED; END; $PACKED_DEC = [BIT(4),UNSAFE] 0..15; $DEFTYP = [UNSAFE] INTEGER; $DEFPTR = [UNSAFE] ^$DEFTYP; $BOOL = [BIT(1),UNSAFE] BOOLEAN; $BIT2 = [BIT(2),UNSAFE] 0..3; $BIT3 = [BIT(3),UNSAFE] 0..7; $BIT4 = [BIT(4),UNSAFE] 0..15; $BIT5 = [BIT(5),UNSAFE] 0..31; $BIT6 = [BIT(6),UNSAFE] 0..63; $BIT7 = [BIT(7),UNSAFE] 0..127; $BIT8 = [BIT(8),UNSAFE] 0..255; $BIT9 = [BIT(9),UNSAFE] 0..511; $BIT10 = [BIT(10),UNSAFE] 0..1023; $BIT11 = [BIT(11),UNSAFE] 0..2047; $BIT12 = [BIT(12),UNSAFE] 0..4095; $BIT13 = [BIT(13),UNSAFE] 0..8191; $BIT14 = [BIT(14),UNSAFE] 0..16383; $BIT15 = [BIT(15),UNSAFE] 0..32767; $BIT16 = [BIT(16),UNSAFE] 0..65535; $BIT17 = [BIT(17),UNSAFE] 0..131071; $BIT18 = [BIT(18),UNSAFE] 0..262143; $BIT19 = [BIT(19),UNSAFE] 0..524287; $BIT20 = [BIT(20),UNSAFE] 0..1048575; $BIT21 = [BIT(21),UNSAFE] 0..2097151; $BIT22 = [BIT(22),UNSAFE] 0..4194303; $BIT23 = [BIT(23),UNSAFE] 0..8388607; $BIT24 = [BIT(24),UNSAFE] 0..16777215; $BIT25 = [BIT(25),UNSAFE] 0..33554431; $BIT26 = [BIT(26),UNSAFE] 0..67108863; $BIT27 = [BIT(27),UNSAFE] 0..134217727; $BIT28 = [BIT(28),UNSAFE] 0..268435455; $BIT29 = [BIT(29),UNSAFE] 0..536870911; $BIT30 = [BIT(30),UNSAFE] 0..1073741823; $BIT31 = [BIT(31),UNSAFE] 0..2147483647; $BIT32 = [BIT(32),UNSAFE] UNSIGNED; (*** MODULE $ENCSTRDEF ***) (* Definitions for Encryption structures *) (* KEY_SYSTEM system *) (* KEY_GROUP group *) (* KEY_PROCESS process *) (* KEY_JOB job *) (* KEY_LITERAL literal key definition, don't compress *) (* KEY_AES AES Key encryption/decryption *) CONST ENCRYPT$M_KEY_SYSTEM = 1; ENCRYPT$M_KEY_GROUP = 2; ENCRYPT$M_KEY_PROCESS = 4; ENCRYPT$M_KEY_JOB = 8; ENCRYPT$m_avail1 = 16; ENCRYPT$M_KEY_LITERAL = 32; ENCRYPT$M_KEY_AES = 64; TYPE KEY_BITS$TYPE = RECORD ENCRYPT$V_KEY_SYSTEM : [POS(0)] $BOOL; ENCRYPT$V_KEY_GROUP : [POS(1)] $BOOL; ENCRYPT$V_KEY_PROCESS : [POS(2)] $BOOL; ENCRYPT$V_KEY_JOB : [POS(3)] $BOOL; ENCRYPT$v_avail1 : [POS(4)] $BOOL; ENCRYPT$V_KEY_LITERAL : [POS(5)] $BOOL; ENCRYPT$V_KEY_AES : [POS(6)] $BOOL; ENCRYPT$V_FILL_0_ : [POS(7)] $BOOL; END; CONST ENCRYPT$M_VALID_KEY_BITS = 111; (* KEY$SYSTEM system *) (* KEY$GROUP group *) (* KEY$PROCESS process *) (* KEY$JOB job *) (* avail1 unused *) (* KEY$LITERAL literal key definition, don't compress *) (* KEY$AES AES Key encryption/decryption *) CONST ENCRYPT$K_KEY$SYSTEM = 0; ENCRYPT$K_KEY$GROUP = 1; ENCRYPT$K_KEY$PROCESS = 2; ENCRYPT$K_KEY$JOB = 3; ENCRYPT$k_avail1 = 4; ENCRYPT$K_KEY$LITERAL = 5; ENCRYPT$K_KEY$AES = 6; (* FILE_ENCRYPT encrypt/decrypt direction *) (* FILE_DELETE delete source file after operation *) (* FILE_ERASE erase source file when deleting *) (* FILE_LOG log file operation *) (* FILE_UNUSED -unused *) (* FILE_STATISTICS log statistics too *) (* FILE_COMPRESS compress input *) (* FILE_EXTLOG extended log *) (* FILE_IGNORE_CRC Ignore CRC generation/checking *) (* FILE_V011 Generate V1.1-compatible ciphertext file *) (* FILE_KEY_VALUE Pass a key by value *) (* FILE_AES AES File Operation *) CONST ENCRYPT$M_FILE_ENCRYPT = 1; ENCRYPT$M_FILE_DELETE = 2; ENCRYPT$M_FILE_ERASE = 4; ENCRYPT$M_FILE_LOG = 8; ENCRYPT$M_FILE_UNUSED = 16; ENCRYPT$M_FILE_STATISTICS = 32; ENCRYPT$M_FILE_COMPRESS = 64; ENCRYPT$M_FILE_EXTLOG = 128; ENCRYPT$M_FILE_IGNORE_CRC = 256; ENCRYPT$M_FILE_V011 = 512; ENCRYPT$M_FILE_KEY_VALUE = 1024; ENCRYPT$M_FILE_AES = 2048; TYPE FILE_OPS$TYPE = RECORD ENCRYPT$V_FILE_ENCRYPT : [POS(0)] $BOOL; ENCRYPT$V_FILE_DELETE : [POS(1)] $BOOL; ENCRYPT$V_FILE_ERASE : [POS(2)] $BOOL; ENCRYPT$V_FILE_LOG : [POS(3)] $BOOL; ENCRYPT$V_FILE_UNUSED : [POS(4)] $BOOL; ENCRYPT$V_FILE_STATISTICS : [POS(5)] $BOOL; ENCRYPT$V_FILE_COMPRESS : [POS(6)] $BOOL; ENCRYPT$V_FILE_EXTLOG : [POS(7)] $BOOL; ENCRYPT$V_FILE_IGNORE_CRC : [POS(8)] $BOOL; ENCRYPT$V_FILE_V011 : [POS(9)] $BOOL; ENCRYPT$V_FILE_KEY_VALUE : [POS(10)] $BOOL; ENCRYPT$V_FILE_AES : [POS(11)] $BOOL; ENCRYPT$V_FILL_1_ : [POS(12)] $BIT4; END; CONST ENCRYPT$M_VALID_FILE_BITS = 4079; (* KEY_LENGTH /* original key string length *) (* KEYF_IS_COMPRESSED /* key is compressed text *) (* KEYF_LITERAL /* key is literal value *) (* KEYF_TOBE_COMPRESSED /* compression was deferred *) (* KEYF_AES /* Key is AES encrypted *) (* KEYF_UNUSED /* unused *) CONST encrypt$m_keyf_is_compressed = 1; encrypt$m_keyf_literal = 2; encrypt$m_keyf_tobe_compressed = 4; encrypt$m_keyf_aes = 8; TYPE stored_key_flags$TYPE = RECORD CASE INTEGER OF 1: (encrypt$w_key_length : $UWORD; encrypt$r_key_flags_u : [BYTE(2)] RECORD END; ); 2: (encrypt$r_key_flags_w : [POS(16), BYTE(2)] RECORD END; ); 3: (encrypt$w_key_flags : [POS(16)] $UWORD; ); 4: (encrypt$r_key_flags_b : [POS(16), BYTE(2)] RECORD END; ); 5: (encrypt$v_keyf_is_compressed : [POS(16)] $BOOL; encrypt$v_keyf_literal : [POS(17)] $BOOL; encrypt$v_keyf_tobe_compressed : [POS(18)] $BOOL; encrypt$v_keyf_aes : [POS(19)] $BOOL; ) END; CONST ENCRYPT$M_VALID_DES_KEY_FLAGS = 7; ENCRYPT$M_VALID_AES_KEY_FLAGS = 15; (* *) (* Programmable interface itemlist item codes *) (* *) (* Algorithm specific optional parameters. For example with the *) (* DES based algorithms, is defined as the address *) (* of an 8-byte initialization vector (IV) to be used instead of *) (* any residual IV remaining from a previous operation. *) (* The interpretation of these parameters is documented with *) (* the specific algorithms. *) (* optparam_one Optional Parameter *) (* optparam_two Optional Parameter *) (* optparam_three Optional Parameter *) (* optparam_four Optional Parameter *) (* optparam_five Optional Parameter *) (* optparam_six Optional Parameter *) (* optparam_seven Optional Parameter *) (* optparam_eight Optional Parameter *) (* *) (* References the actual key value to be used. Overrides *) (* any key name/value reference supplied in other call *) (* parameters *) (* key_name A key namestring *) (* key_value A key value *) (* key_flags Key interpretation flags *) (* *) (* Algorithm name specification *) (* algorithm_spec algorithm name or type specification *) (* algorithm_type algorithm specification type code *) (* *) (* for encrypt$encrypt_file() parameters *) (* data_algorithm inner algorithm name specification *) (* qual_context common qualifier context *) (* *) (* max maximum itemlist number *) CONST encrypt$k_optparam_one = 1; encrypt$k_optparam_two = 2; encrypt$k_optparam_three = 3; encrypt$k_optparam_four = 4; encrypt$k_optparam_five = 5; encrypt$k_optparam_six = 6; encrypt$k_optparam_seven = 7; encrypt$k_optparam_eight = 8; encrypt$k_key_name = 9; encrypt$k_key_value = 10; encrypt$k_key_flags = 11; encrypt$k_algorithm_spec = 12; encrypt$k_algorithm_type = 13; encrypt$k_data_algorithm = 14; encrypt$k_qual_context = 15; encrypt$k_max = 16; (* *) (* Key name/value switch *) (* *) CONST encrypt$k_name_specified = 0; encrypt$k_value_specified = 1; (* *) (* Define structure for file encryption generated key vector *) (* *) (* FIL_BUFLEN length of this record *) (* FIL_FILEVER file encrypt routine version *) (* FIL_FILEUPD decimal version *) (* ---> FIL_KEY and FIL_IV are assumed to be contiguous *) (* FIL_KEY data key value *) (* FIL_IV initialize vector value *) (* ---> FIL_KEY and FIL_IV are assumed to be contiguous *) (* FIL_ALGCODE file data encryption algorithm code *) (* FIL_FLAGS file encryption flags *) (* FIL_COMPRESSED file was compressed before enc *) (* FIL_LONGCHECKSUM longidudinal checksum present *) (* FIL_ATR_LEN size of attribute record *) (* FIL_COMPRESS_MAX blocks in compress buffer *) (* FIL_ENCRYPT_MAX blocks in encrypt buffer *) (* FIL_DCXMAP_LEN size of DCX map record if present *) (* FIL_ALGNAM_LEN size of data encryption algorithm *) (* FIL_ALGNAM_STR data encryption alg name *) (* /* this is a varying length string with the next allocated field *) (* /* starting 'algnam_len' bytes after 'algnam_str' *) (* FIL_XKEY extended key (counted string) *) (* FIL_XIV extended IV (counted) *) (* FIL_XALGNAM_LEN extended size of data encryption algorithm - AES *) (* FIL_XALGNAM_STR extended ALG name string - for AES *) (* FIL_FILLER filler to pad to 256 bytes *) (* FIL_CHECKSUM structure checksum *) CONST ENCRYPT$M_FIL_COMPRESSED = 1; ENCRYPT$M_FIL_LONGCHECKSUM = 2; TYPE FIL_RECORD$TYPE = RECORD CASE INTEGER OF 1: (ENCRYPT$W_FIL_BUFLEN : $UWORD; ENCRYPT$B_FIL_FILEVER : $UBYTE; ENCRYPT$B_FIL_FILEUPD : $UBYTE; ENCRYPT$Q_FIL_KEY : $UQUAD; ENCRYPT$Q_FIL_IV : $UQUAD; ENCRYPT$L_FIL_ALGCODE : UNSIGNED; ENCRYPT$R_FIL_FLAGS_OVERLAY : [BYTE(4)] RECORD END; ENCRYPT$W_FIL_ATR_LEN : $UWORD; ENCRYPT$W_FIL_COMPRESS_MAX : $UWORD; ENCRYPT$W_FIL_ENCRYPT_MAX : $UWORD; ENCRYPT$R_FIL_DCXLEN_OVERLAY : [BYTE(4)] RECORD END; ENCRYPT$W_FIL_ALGNAM_LEN : $UWORD; ENCRYPT$T_FIL_ALGNAM_STR : PACKED ARRAY [1..6] OF CHAR; ENCRYPT$B_FIL_XKEY : ARRAY [1..80] OF $UBYTE; ENCRYPT$B_FIL_XIV : ARRAY [1..80] OF $UBYTE; ENCRYPT$W_FIL_XALGNAM_LEN : $UWORD; ENCRYPT$T_FIL_XALGNAM_STR : PACKED ARRAY [1..16] OF CHAR; ENCRYPT$B_FIL_FILLER : ARRAY [1..28] OF $BYTE; ENCRYPT$L_FIL_CHECKSUM : UNSIGNED; ); 2: (ENCRYPT$L_FIL_FLAGS : [POS(192)] UNSIGNED; ENCRYPT$L_FIL_DCXMAP_LEN : [POS(272)] UNSIGNED; ); 3: (ENCRYPT$R_FIL_DCXMAP_LEN_WORD : [POS(272), BYTE(4)] RECORD END; ); 4: (ENCRYPT$V_FIL_COMPRESSED : [POS(192)] $BOOL; ENCRYPT$V_FIL_LONGCHECKSUM : [POS(193)] $BOOL; ENCRYPT$W_FIL_DCXMAP_LEN_LOW : [POS(272)] $UWORD; ENCRYPT$W_FIL_DCXMAP_LEN_HIGH : [POS(288)] $UWORD; ) END; (* *) (* Attribute record structure in encrypted data file. The encrypted file *) (* attributes are obtained from the input file fab and a chain of xab *) (* blocks. The fab attributes are copied into a smaller structure, FABATR, *) (* declared below and the xab attributes are copied in toto. *) (* *) (* FILATR_LENGTH length of file attributes *) (* FILATR_FILL_60 unused *) (* FILATR mask of whats present in attrib record *) (* FABATR fabatr present *) (* XABALL xaball present *) (* XABDAT xabdat present *) (* XABFHC xabfhc present *) (* XABPRO xabpro present *) (* PROACL xabpro access control list present *) (* XABSUM xabsum present *) (* UNASSIGNED unassigned bits *) (* ATR_FILLER filler to pad to 256 bytes *) CONST ENCRYPT$M_FABATR = 1; ENCRYPT$M_XABALL = 2; ENCRYPT$M_XABDAT = 4; ENCRYPT$M_XABFHC = 8; ENCRYPT$M_XABPRO = 16; ENCRYPT$M_PROACL = 32; ENCRYPT$M_XABSUM = 64; ENCRYPT$M_UNASSIGNED = -128; TYPE ATR_RECORD$TYPE = RECORD CASE INTEGER OF 1: (ENCRYPT$W_FILATR_LENGTH : $UWORD; ENCRYPT$W_FILATR_FILL_60 : $WORD; ENCRYPT$R_FILATR_OVERLAY : [BYTE(4)] RECORD END; ENCRYPT$B_ATR_FILLER : ARRAY [1..248] OF $BYTE; ); 2: (ENCRYPT$L_FILATR : [POS(32)] UNSIGNED; ); 3: (ENCRYPT$R_FILATR_BITS : [POS(32), BYTE(4)] RECORD END; ); 4: (ENCRYPT$V_FABATR : [POS(32)] $BOOL; ENCRYPT$V_XABALL : [POS(33)] $BOOL; ENCRYPT$V_XABDAT : [POS(34)] $BOOL; ENCRYPT$V_XABFHC : [POS(35)] $BOOL; ENCRYPT$V_XABPRO : [POS(36)] $BOOL; ENCRYPT$V_PROACL : [POS(37)] $BOOL; ENCRYPT$V_XABSUM : [POS(38)] $BOOL; ENCRYPT$V_UNASSIGNED : [POS(39)] $BIT25; ) END; (* *) (* While other attributes are stored as whole xabs, attributes from the *) (* fab are copied to the xab-like structure FAB_ATTRIBUTES. *) (* *) (* COD structure code *) (* BLN structure length *) (* fill_50 spare *) (* fill_51 address of next structure *) (* ORG file organization *) (* RFM record format *) (* RAT record attributes *) (* FSZ vfc header size *) (* BKS bucket size *) (* RTV retrieval pointer count *) (* fill_52 spare *) (* MRS maximum record size *) (* GBC global buffer count *) (* MRN maximum record number *) (* FOP file operations *) TYPE FAB_ATTRIBUTES$TYPE = RECORD FABATR$B_COD : $UBYTE; FABATR$B_BLN : $UBYTE; FABATR$w_fill_50 : $WORD; FABATR$l_fill_51 : INTEGER; FABATR$B_ORG : $UBYTE; FABATR$B_RFM : $UBYTE; FABATR$B_RAT : $UBYTE; FABATR$B_FSZ : $UBYTE; FABATR$B_BKS : $UBYTE; FABATR$B_RTV : $UBYTE; FABATR$b_fill_52 : ARRAY [1..2] OF $BYTE; FABATR$W_MRS : $UWORD; FABATR$W_GBC : $UWORD; FABATR$L_MRN : UNSIGNED; FABATR$L_FOP : UNSIGNED; END; (* EXCESS_DATA Holds data beyond plaintext EOF *) (* EXCESS_CRC CRC of file *) TYPE EXCESS_DATA$TYPE = RECORD ENCRYPT$W_EXCESS_CRC : $UWORD; ENCRYPT$T_EXCESS_RESERVED : PACKED ARRAY [1..32] OF CHAR; END; (* *) (* Feature block *) (* *) CONST ENCRYPT$M_PRODUCT_VERSION_MIN = 255; ENCRYPT$M_PRODUCT_VERSION_MAJ = 65280; TYPE FEATURE$TYPE = RECORD CASE INTEGER OF 1: (ENCRYPT$L_FEATURE_CODE : UNSIGNED; ENCRYPT$R_VERSION_OVERLAY : [BYTE(2)] RECORD END; ENCRYPT$W_FEATURE_LENGTH : $UWORD; ENCRYPT$T_FEATURE_VALUE : RECORD END ; ); 2: (ENCRYPT$W_PRODUCT_VERSION : [POS(32)] $UWORD; ); 3: (ENCRYPT$R_PV_BITS : [POS(32), BYTE(2)] RECORD END; ); 4: (ENCRYPT$V_PRODUCT_VERSION_MIN : [POS(32)] $BIT8; ENCRYPT$V_PRODUCT_VERSION_MAJ : [POS(40)] $BIT8; ) END; CONST ENCRYPT$M_FTR_REQUIRED = 1; ENCRYPT$M_FTR_COMMENT = 2; ENCRYPT$M_FTR_DEBUG = 4; ENCRYPT$M_FTR_SILENT = 8; TYPE FEATURE_CODE_BITS$TYPE = RECORD ENCRYPT$V_FTR_REQUIRED : [POS(0)] $BOOL; ENCRYPT$V_FTR_COMMENT : [POS(1)] $BOOL; ENCRYPT$V_FTR_DEBUG : [POS(2)] $BOOL; ENCRYPT$V_FTR_SILENT : [POS(3)] $BOOL; ENCRYPT$V_FTR_NUMBER : [POS(4)] $BIT12; ENCRYPT$V_FTR_UNUSED : [POS(16)] $BIT16; END; (* *) (* CRC checking feature block value definitions *) (* *) CONST ENCRYPT$K_FEATURE_CRC = 33; (* *) (* Semantic tag feature block value definitions *) (* *) CONST ENCRYPT$K_FEATURE_SEMTAG = 17; TYPE FEATURE_SEMTAG_$TYPE = RECORD ENCRYPT$W_SEMTAG_LENGTH : $UWORD; ENCRYPT$T_SEMTAG_VALUE : PACKED ARRAY [1..64] OF CHAR; END; CONST ENCRYPT$K_FEATURES_MAX_LEN = 86; (* *) (* Define the encrypted file structure version of the current implementation *) (* *) (* Bumped FILE_VERSION for Encrypt-AES from 3 to 4 *) (* *) CONST ENCRYPT$K_FILE_VERSION = 4; (* *) (* Statistics record returned by encrypt$statistics() *) (* *) TYPE STAT_RECORD$TYPE = RECORD (* *) (* Format returned for statistics type code = 1 *) (* *) (* STAT_TOTAL_RECORDS statistics: total records *) (* STAT_TOTAL_BYTES statistics: total bytes through stream *) (* STAT_TOTAL_TIME statistics: total time in facility *) (* STAT_FILL_10 statistics: expansion *) ENCRYPT$L_STAT_TOTAL_RECORDS : UNSIGNED; ENCRYPT$Q_STAT_TOTAL_BYTES : $UQUAD; ENCRYPT$Q_STAT_TOTAL_TIME : $UQUAD; ENCRYPT$Q_STAT_FILL_10 : $QUAD; END; END.