! !************************************************************************* !* * !* © 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:32 by OpenVMS SDL EV3-3 ! Source: 21-SEP-2005 15:44:14 $1$DGA7374:[ENCRYPT.SRC]ENCRYPT_STRUCTURES.SDL;/ !******************************************************************************************************************************** ! *** PREDECLARED TYPES %IF %DECLARED(%BASIC$QUADWORD_DECLARED) = 0 %THEN RECORD BASIC$QUADWORD LONG FILL(2) END RECORD %LET %BASIC$QUADWORD_DECLARED = 1 %END %IF %IF %DECLARED(%BASIC$OCTAWORD_DECLARED) = 0 %THEN RECORD BASIC$OCTAWORD LONG FILL(4) END RECORD %LET %BASIC$OCTAWORD_DECLARED = 1 %END %IF %IF %DECLARED(%BASIC$HFLOAT_AXP_DECLARED) = 0 %THEN RECORD BASIC$HFLOAT_AXP LONG FILL(4) END RECORD %LET %BASIC$HFLOAT_AXP_DECLARED = 1 %END %IF %IF %DECLARED(%BASIC$F_FLOATING_COMPLEX_DECL) = 0 %THEN RECORD BASIC$F_FLOATING_COMPLEX SINGLE REAL_PART SINGLE IMAGINARY_PART END RECORD %LET %BASIC$F_FLOATING_COMPLEX_DECL = 1 %END %IF %IF %DECLARED(%BASIC$D_FLOATING_COMPLEX_DECL) = 0 %THEN RECORD BASIC$D_FLOATING_COMPLEX DOUBLE REAL_PART DOUBLE IMAGINARY_PART END RECORD %LET %BASIC$D_FLOATING_COMPLEX_DECL = 1 %END %IF %IF %DECLARED(%BASIC$G_FLOATING_COMPLEX_DECL) = 0 %THEN RECORD BASIC$G_FLOATING_COMPLEX GFLOAT REAL_PART GFLOAT IMAGINARY_PART END RECORD %LET %BASIC$G_FLOATING_COMPLEX_DECL = 1 %END %IF %IF %DECLARED(%BASIC$H_FLOAT_AXP_CMPLX_DCL) = 0 %THEN RECORD BASIC$H_FLOATING_COMPLEX_AXP BASIC$HFLOAT_AXP REAL_PART BASIC$HFLOAT_AXP IMAGINARY_PART END RECORD %LET %BASIC$H_FLOAT_AXP_CMPLX_DCL = 1 %END %IF !*** 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 DECLARE LONG CONSTANT ENCRYPT$M_KEY_SYSTEM = x'00000001' DECLARE LONG CONSTANT ENCRYPT$M_KEY_GROUP = x'00000002' DECLARE LONG CONSTANT ENCRYPT$M_KEY_PROCESS = x'00000004' DECLARE LONG CONSTANT ENCRYPT$M_KEY_JOB = x'00000008' DECLARE LONG CONSTANT ENCRYPT$m_avail1 = x'00000010' DECLARE LONG CONSTANT ENCRYPT$M_KEY_LITERAL = x'00000020' DECLARE LONG CONSTANT ENCRYPT$M_KEY_AES = x'00000040' DECLARE LONG CONSTANT ENCRYPT$S_KEY_BITS = 1 record KEY_BITS BYTE KEY_SYSTEM_bits ! COMMENT ADDED BY SDL - KEY_SYSTEM_bits contains bits KEY_SYSTEM through FILL_0_ end record KEY_BITS DECLARE LONG CONSTANT 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 DECLARE LONG CONSTANT ENCRYPT$K_KEY$SYSTEM = 0 DECLARE LONG CONSTANT ENCRYPT$K_KEY$GROUP = 1 DECLARE LONG CONSTANT ENCRYPT$K_KEY$PROCESS = 2 DECLARE LONG CONSTANT ENCRYPT$K_KEY$JOB = 3 DECLARE LONG CONSTANT ENCRYPT$k_avail1 = 4 DECLARE LONG CONSTANT ENCRYPT$K_KEY$LITERAL = 5 DECLARE LONG CONSTANT 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 DECLARE LONG CONSTANT ENCRYPT$M_FILE_ENCRYPT = x'00000001' DECLARE LONG CONSTANT ENCRYPT$M_FILE_DELETE = x'00000002' DECLARE LONG CONSTANT ENCRYPT$M_FILE_ERASE = x'00000004' DECLARE LONG CONSTANT ENCRYPT$M_FILE_LOG = x'00000008' DECLARE LONG CONSTANT ENCRYPT$M_FILE_UNUSED = x'00000010' DECLARE LONG CONSTANT ENCRYPT$M_FILE_STATISTICS = x'00000020' DECLARE LONG CONSTANT ENCRYPT$M_FILE_COMPRESS = x'00000040' DECLARE LONG CONSTANT ENCRYPT$M_FILE_EXTLOG = x'00000080' DECLARE LONG CONSTANT ENCRYPT$M_FILE_IGNORE_CRC = x'00000100' DECLARE LONG CONSTANT ENCRYPT$M_FILE_V011 = x'00000200' DECLARE LONG CONSTANT ENCRYPT$M_FILE_KEY_VALUE = x'00000400' DECLARE LONG CONSTANT ENCRYPT$M_FILE_AES = x'00000800' DECLARE LONG CONSTANT ENCRYPT$S_FILE_OPS = 2 record FILE_OPS WORD FILE_ENCRYPT_bits ! COMMENT ADDED BY SDL - FILE_ENCRYPT_bits contains bits FILE_ENCRYPT through FILL_1_ end record FILE_OPS DECLARE LONG CONSTANT 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 DECLARE LONG CONSTANT encrypt$m_keyf_is_compressed = x'00000001' DECLARE LONG CONSTANT encrypt$m_keyf_literal = x'00000002' DECLARE LONG CONSTANT encrypt$m_keyf_tobe_compressed = x'00000004' DECLARE LONG CONSTANT encrypt$m_keyf_aes = x'00000008' DECLARE LONG CONSTANT encrypt$s_stored_key_flags = 4 record stored_key_flags WORD encrypt$w_key_length group encrypt$r_key_flags_u variant case group encrypt$r_key_flags_w WORD encrypt$w_key_flags end group encrypt$r_key_flags_w case group encrypt$r_key_flags_b WORD keyf_is_compressed_bits ! COMMENT ADDED BY SDL - keyf_is_compressed_bits contains bits & ! keyf_is_compressed through keyf_unused end group encrypt$r_key_flags_b end variant end group encrypt$r_key_flags_u end record stored_key_flags DECLARE LONG CONSTANT ENCRYPT$M_VALID_DES_KEY_FLAGS = 7 DECLARE LONG CONSTANT 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 DECLARE LONG CONSTANT encrypt$k_optparam_one = 1 DECLARE LONG CONSTANT encrypt$k_optparam_two = 2 DECLARE LONG CONSTANT encrypt$k_optparam_three = 3 DECLARE LONG CONSTANT encrypt$k_optparam_four = 4 DECLARE LONG CONSTANT encrypt$k_optparam_five = 5 DECLARE LONG CONSTANT encrypt$k_optparam_six = 6 DECLARE LONG CONSTANT encrypt$k_optparam_seven = 7 DECLARE LONG CONSTANT encrypt$k_optparam_eight = 8 DECLARE LONG CONSTANT encrypt$k_key_name = 9 DECLARE LONG CONSTANT encrypt$k_key_value = 10 DECLARE LONG CONSTANT encrypt$k_key_flags = 11 DECLARE LONG CONSTANT encrypt$k_algorithm_spec = 12 DECLARE LONG CONSTANT encrypt$k_algorithm_type = 13 DECLARE LONG CONSTANT encrypt$k_data_algorithm = 14 DECLARE LONG CONSTANT encrypt$k_qual_context = 15 DECLARE LONG CONSTANT encrypt$k_max = 16 ! ! Key name/value switch ! DECLARE LONG CONSTANT encrypt$k_name_specified = 0 DECLARE LONG CONSTANT 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 DECLARE LONG CONSTANT ENCRYPT$M_FIL_COMPRESSED = x'00000001' DECLARE LONG CONSTANT ENCRYPT$M_FIL_LONGCHECKSUM = x'00000002' DECLARE LONG CONSTANT ENCRYPT$S_FIL_RECORD = 256 record FIL_RECORD WORD ENCRYPT$W_FIL_BUFLEN BYTE ENCRYPT$B_FIL_FILEVER BYTE ENCRYPT$B_FIL_FILEUPD BASIC$QUADWORD ENCRYPT$Q_FIL_KEY BASIC$QUADWORD ENCRYPT$Q_FIL_IV LONG ENCRYPT$L_FIL_ALGCODE group ENCRYPT$R_FIL_FLAGS_OVERLAY variant case LONG ENCRYPT$L_FIL_FLAGS case group ENCRYPT$R_FIL_FLAGS_BITS LONG FIL_COMPRESSED_bits ! COMMENT ADDED BY SDL - FIL_COMPRESSED_bits contains bits FIL_COMPRESSED through & ! FILL_2_ end group ENCRYPT$R_FIL_FLAGS_BITS end variant end group ENCRYPT$R_FIL_FLAGS_OVERLAY WORD ENCRYPT$W_FIL_ATR_LEN WORD ENCRYPT$W_FIL_COMPRESS_MAX WORD ENCRYPT$W_FIL_ENCRYPT_MAX group ENCRYPT$R_FIL_DCXLEN_OVERLAY variant case LONG ENCRYPT$L_FIL_DCXMAP_LEN case group ENCRYPT$R_FIL_DCXMAP_LEN_WORD WORD ENCRYPT$W_FIL_DCXMAP_LEN_LOW WORD ENCRYPT$W_FIL_DCXMAP_LEN_HIGH end group ENCRYPT$R_FIL_DCXMAP_LEN_WORD end variant end group ENCRYPT$R_FIL_DCXLEN_OVERLAY WORD ENCRYPT$W_FIL_ALGNAM_LEN STRING ENCRYPT$T_FIL_ALGNAM_STR = 6 BYTE ENCRYPT$B_FIL_XKEY(1 to 80) BYTE ENCRYPT$B_FIL_XIV(1 to 80) WORD ENCRYPT$W_FIL_XALGNAM_LEN STRING ENCRYPT$T_FIL_XALGNAM_STR = 16 BYTE ENCRYPT$B_FIL_FILLER(1 to 28) LONG ENCRYPT$L_FIL_CHECKSUM end record FIL_RECORD ! ! 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 DECLARE LONG CONSTANT ENCRYPT$M_FABATR = x'00000001' DECLARE LONG CONSTANT ENCRYPT$M_XABALL = x'00000002' DECLARE LONG CONSTANT ENCRYPT$M_XABDAT = x'00000004' DECLARE LONG CONSTANT ENCRYPT$M_XABFHC = x'00000008' DECLARE LONG CONSTANT ENCRYPT$M_XABPRO = x'00000010' DECLARE LONG CONSTANT ENCRYPT$M_PROACL = x'00000020' DECLARE LONG CONSTANT ENCRYPT$M_XABSUM = x'00000040' DECLARE LONG CONSTANT ENCRYPT$M_UNASSIGNED = x'FFFFFF80' DECLARE LONG CONSTANT ENCRYPT$S_ATR_RECORD = 256 record ATR_RECORD WORD ENCRYPT$W_FILATR_LENGTH WORD ENCRYPT$W_FILATR_FILL_60 group ENCRYPT$R_FILATR_OVERLAY variant case LONG ENCRYPT$L_FILATR case group ENCRYPT$R_FILATR_BITS LONG FABATR_bits ! COMMENT ADDED BY SDL - FABATR_bits contains bits FABATR through UNASSIGNED end group ENCRYPT$R_FILATR_BITS end variant end group ENCRYPT$R_FILATR_OVERLAY BYTE ENCRYPT$B_ATR_FILLER(1 to 248) end record ATR_RECORD ! ! 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 DECLARE LONG CONSTANT FABATR$S_FAB_ATTRIBUTES = 28 record FAB_ATTRIBUTES BYTE FABATR$B_COD BYTE FABATR$B_BLN WORD FABATR$w_fill_50 LONG FABATR$l_fill_51 BYTE FABATR$B_ORG BYTE FABATR$B_RFM BYTE FABATR$B_RAT BYTE FABATR$B_FSZ BYTE FABATR$B_BKS BYTE FABATR$B_RTV BYTE FABATR$b_fill_52(1 to 2) WORD FABATR$W_MRS WORD FABATR$W_GBC LONG FABATR$L_MRN LONG FABATR$L_FOP end record FAB_ATTRIBUTES ! EXCESS_DATA Holds data beyond plaintext EOF ! EXCESS_CRC CRC of file DECLARE LONG CONSTANT ENCRYPT$S_EXCESS_DATA = 34 record EXCESS_DATA WORD ENCRYPT$W_EXCESS_CRC STRING ENCRYPT$T_EXCESS_RESERVED = 32 end record EXCESS_DATA ! ! Feature block ! DECLARE LONG CONSTANT ENCRYPT$M_PRODUCT_VERSION_MIN = x'000000FF' DECLARE LONG CONSTANT ENCRYPT$M_PRODUCT_VERSION_MAJ = x'0000FF00' DECLARE LONG CONSTANT ENCRYPT$S_FEATURE = 8 record FEATURE LONG ENCRYPT$L_FEATURE_CODE group ENCRYPT$R_VERSION_OVERLAY variant case WORD ENCRYPT$W_PRODUCT_VERSION case group ENCRYPT$R_PV_BITS WORD PRODUCT_VERSION_MIN_bits ! COMMENT ADDED BY SDL - PRODUCT_VERSION_MIN_bits contains bits & ! PRODUCT_VERSION_MIN through PRODUCT_VERSION_MAJ end group ENCRYPT$R_PV_BITS end variant end group ENCRYPT$R_VERSION_OVERLAY WORD ENCRYPT$W_FEATURE_LENGTH STRING ENCRYPT$T_FEATURE_VALUE = 0 end record FEATURE DECLARE LONG CONSTANT ENCRYPT$M_FTR_REQUIRED = x'00000001' DECLARE LONG CONSTANT ENCRYPT$M_FTR_COMMENT = x'00000002' DECLARE LONG CONSTANT ENCRYPT$M_FTR_DEBUG = x'00000004' DECLARE LONG CONSTANT ENCRYPT$M_FTR_SILENT = x'00000008' DECLARE LONG CONSTANT ENCRYPT$S_FEATURE_CODE_BITS = 4 record FEATURE_CODE_BITS LONG FTR_REQUIRED_bits ! COMMENT ADDED BY SDL - FTR_REQUIRED_bits contains bits FTR_REQUIRED through FTR_UNUSED end record FEATURE_CODE_BITS ! ! CRC checking feature block value definitions ! DECLARE LONG CONSTANT ENCRYPT$K_FEATURE_CRC = 33 ! ! Semantic tag feature block value definitions ! DECLARE LONG CONSTANT ENCRYPT$K_FEATURE_SEMTAG = 17 DECLARE LONG CONSTANT ENCRYPT$S_FEATURE_SEMTAG_ = 66 record FEATURE_SEMTAG_ WORD ENCRYPT$W_SEMTAG_LENGTH STRING ENCRYPT$T_SEMTAG_VALUE = 64 end record FEATURE_SEMTAG_ DECLARE LONG CONSTANT 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 ! DECLARE LONG CONSTANT ENCRYPT$K_FILE_VERSION = 4 ! ! Statistics record returned by encrypt$statistics() ! DECLARE LONG CONSTANT ENCRYPT$S_STAT_RECORD = 28 record STAT_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 LONG ENCRYPT$L_STAT_TOTAL_RECORDS BASIC$QUADWORD ENCRYPT$Q_STAT_TOTAL_BYTES BASIC$QUADWORD ENCRYPT$Q_STAT_TOTAL_TIME BASIC$QUADWORD ENCRYPT$Q_STAT_FILL_10 end record STAT_RECORD