/***************************************************************************/
/**                                                                       **/
/** HP CONFIDENTIAL. This software is confidential proprietary software   **/
/** licensed by Hewlett-Packard Development Company, L.P., and is not     **/
/** authorized to be used, duplicated OR disclosed to anyone without the  **/
/** prior written permission of HP.                                       **/
/** © 2021 Copyright Hewlett-Packard Development Company, L.P.            **/
/**                                                                       **/
/** VMS SOFTWARE, INC. CONFIDENTIAL. This software is confidential        **/
/** proprietary software licensed by VMS Software, Inc., and is not       **/
/** authorized to be used, duplicated or disclosed to anyone without      **/
/** the prior written permission of VMS Software, Inc.                    **/
/** © 2021 Copyright VMS Software, Inc.                                   **/
/**                                                                       **/
/***************************************************************************/
/********************************************************************************************************************************/
/* Created:  9-Mar-2021 22:27:20 by OpenVMS SDL EV3-3      */
/* Source:  21-SEP-2005 15:44:14 $1$DGA8085:[ENCRYPT.SRC]ENCRYPT_STRUCTURES.SDL;/ */
/********************************************************************************************************************************/
 
/*** 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               */
%replace ENCRYPT$M_KEY_SYSTEM by '10000000000000000000000000000000'b;
%replace ENCRYPT$M_KEY_GROUP by '01000000000000000000000000000000'b;
%replace ENCRYPT$M_KEY_PROCESS by '00100000000000000000000000000000'b;
%replace ENCRYPT$M_KEY_JOB by '00010000000000000000000000000000'b;
%replace ENCRYPT$m_avail1 by '00001000000000000000000000000000'b;
%replace ENCRYPT$M_KEY_LITERAL by '00000100000000000000000000000000'b;
%replace ENCRYPT$M_KEY_AES by '00000010000000000000000000000000'b;
 
%replace ENCRYPT$S_KEY_BITS by 1;
dcl 1 KEY_BITS  based,
     2 ENCRYPT$V_KEY_SYSTEM bit(1),
     2 ENCRYPT$V_KEY_GROUP bit(1),
     2 ENCRYPT$V_KEY_PROCESS bit(1),
     2 ENCRYPT$V_KEY_JOB bit(1),
     2 ENCRYPT$v_avail1 bit(1),
     2 ENCRYPT$V_KEY_LITERAL bit(1),
     2 ENCRYPT$V_KEY_AES bit(1),
     2 ENCRYPT$V_FILL_0_ bit(1);
%replace ENCRYPT$M_VALID_KEY_BITS by 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               */
%replace ENCRYPT$K_KEY$SYSTEM by 0;
%replace ENCRYPT$K_KEY$GROUP by 1;
%replace ENCRYPT$K_KEY$PROCESS by 2;
%replace ENCRYPT$K_KEY$JOB by 3;
%replace ENCRYPT$k_avail1 by 4;
%replace ENCRYPT$K_KEY$LITERAL by 5;
%replace ENCRYPT$K_KEY$AES by 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                          */
%replace ENCRYPT$M_FILE_ENCRYPT by '10000000000000000000000000000000'b;
%replace ENCRYPT$M_FILE_DELETE by '01000000000000000000000000000000'b;
%replace ENCRYPT$M_FILE_ERASE by '00100000000000000000000000000000'b;
%replace ENCRYPT$M_FILE_LOG by '00010000000000000000000000000000'b;
%replace ENCRYPT$M_FILE_UNUSED by '00001000000000000000000000000000'b;
%replace ENCRYPT$M_FILE_STATISTICS by '00000100000000000000000000000000'b;
%replace ENCRYPT$M_FILE_COMPRESS by '00000010000000000000000000000000'b;
%replace ENCRYPT$M_FILE_EXTLOG by '00000001000000000000000000000000'b;
%replace ENCRYPT$M_FILE_IGNORE_CRC by '00000000100000000000000000000000'b;
%replace ENCRYPT$M_FILE_V011 by '00000000010000000000000000000000'b;
%replace ENCRYPT$M_FILE_KEY_VALUE by '00000000001000000000000000000000'b;
%replace ENCRYPT$M_FILE_AES by '00000000000100000000000000000000'b;
 
%replace ENCRYPT$S_FILE_OPS by 2;
dcl 1 FILE_OPS  based,
     2 ENCRYPT$V_FILE_ENCRYPT bit(1),
     2 ENCRYPT$V_FILE_DELETE bit(1),
     2 ENCRYPT$V_FILE_ERASE bit(1),
     2 ENCRYPT$V_FILE_LOG bit(1),
     2 ENCRYPT$V_FILE_UNUSED bit(1),
     2 ENCRYPT$V_FILE_STATISTICS bit(1),
     2 ENCRYPT$V_FILE_COMPRESS bit(1),
     2 ENCRYPT$V_FILE_EXTLOG bit(1),
     2 ENCRYPT$V_FILE_IGNORE_CRC bit(1),
     2 ENCRYPT$V_FILE_V011 bit(1),
     2 ENCRYPT$V_FILE_KEY_VALUE bit(1),
     2 ENCRYPT$V_FILE_AES bit(1),
     2 ENCRYPT$V_FILL_1_ bit(4);
%replace ENCRYPT$M_VALID_FILE_BITS by 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                           */
%replace encrypt$m_keyf_is_compressed by '10000000000000000000000000000000'b;
%replace encrypt$m_keyf_literal by '01000000000000000000000000000000'b;
%replace encrypt$m_keyf_tobe_compressed by '00100000000000000000000000000000'b;
%replace encrypt$m_keyf_aes by '00010000000000000000000000000000'b;
 
%replace encrypt$s_stored_key_flags by 4;
dcl 1 stored_key_flags  based,
     2 encrypt$w_key_length bit(16) aligned,
     2 encrypt$r_key_flags_u union,
      3 encrypt$r_key_flags_w ,
       4 encrypt$w_key_flags bit(16) aligned,
      3 encrypt$r_key_flags_b ,
       4 encrypt$v_keyf_is_compressed bit(1),
       4 encrypt$v_keyf_literal bit(1),
       4 encrypt$v_keyf_tobe_compressed bit(1),
       4 encrypt$v_keyf_aes bit(1),
       4 encrypt$v_keyf_unused bit(12);
%replace ENCRYPT$M_VALID_DES_KEY_FLAGS by 7;
%replace ENCRYPT$M_VALID_AES_KEY_FLAGS by 15;
/*                                                                          */
/* Programmable interface itemlist item codes                               */
/*                                                                          */
/*      Algorithm specific optional parameters. For example with the        */
/*      DES based algorithms, <optparm_one> 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                     */
%replace encrypt$k_optparam_one by 1;
%replace encrypt$k_optparam_two by 2;
%replace encrypt$k_optparam_three by 3;
%replace encrypt$k_optparam_four by 4;
%replace encrypt$k_optparam_five by 5;
%replace encrypt$k_optparam_six by 6;
%replace encrypt$k_optparam_seven by 7;
%replace encrypt$k_optparam_eight by 8;
%replace encrypt$k_key_name by 9;
%replace encrypt$k_key_value by 10;
%replace encrypt$k_key_flags by 11;
%replace encrypt$k_algorithm_spec by 12;
%replace encrypt$k_algorithm_type by 13;
%replace encrypt$k_data_algorithm by 14;
%replace encrypt$k_qual_context by 15;
%replace encrypt$k_max by 16;
/*                                                                          */
/* Key name/value switch                                                    */
/*                                                                          */
%replace encrypt$k_name_specified by 0;
%replace encrypt$k_value_specified by 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                          */
%replace ENCRYPT$M_FIL_COMPRESSED by '10000000000000000000000000000000'b;
%replace ENCRYPT$M_FIL_LONGCHECKSUM by '01000000000000000000000000000000'b;
 
%replace ENCRYPT$S_FIL_RECORD by 256;
dcl 1 FIL_RECORD  based,
     2 ENCRYPT$W_FIL_BUFLEN bit(16) aligned,
     2 ENCRYPT$B_FIL_FILEVER bit(8) aligned,
     2 ENCRYPT$B_FIL_FILEUPD bit(8) aligned,
     2 ENCRYPT$Q_FIL_KEY bit(64) aligned,
     2 ENCRYPT$Q_FIL_IV bit(64) aligned,
     2 ENCRYPT$L_FIL_ALGCODE bit(32) aligned,
     2 ENCRYPT$R_FIL_FLAGS_OVERLAY union,
      3 ENCRYPT$L_FIL_FLAGS bit(32) aligned,
      3 ENCRYPT$R_FIL_FLAGS_BITS ,
       4 ENCRYPT$V_FIL_COMPRESSED bit(1),
       4 ENCRYPT$V_FIL_LONGCHECKSUM bit(1),
       4 ENCRYPT$V_FILL_2_ bit(30),
     2 ENCRYPT$W_FIL_ATR_LEN bit(16) aligned,
     2 ENCRYPT$W_FIL_COMPRESS_MAX bit(16) aligned,
     2 ENCRYPT$W_FIL_ENCRYPT_MAX bit(16) aligned,
     2 ENCRYPT$R_FIL_DCXLEN_OVERLAY union,
      3 ENCRYPT$L_FIL_DCXMAP_LEN bit(32) aligned,
      3 ENCRYPT$R_FIL_DCXMAP_LEN_WORD ,
       4 ENCRYPT$W_FIL_DCXMAP_LEN_LOW bit(16) aligned,
       4 ENCRYPT$W_FIL_DCXMAP_LEN_HIGH bit(16) aligned,
     2 ENCRYPT$W_FIL_ALGNAM_LEN bit(16) aligned,
     2 ENCRYPT$T_FIL_ALGNAM_STR character(6),
     2 ENCRYPT$B_FIL_XKEY (1:80) bit(8) aligned,
     2 ENCRYPT$B_FIL_XIV (1:80) bit(8) aligned,
     2 ENCRYPT$W_FIL_XALGNAM_LEN bit(16) aligned,
     2 ENCRYPT$T_FIL_XALGNAM_STR character(16),
     2 ENCRYPT$B_FIL_FILLER (1:28) fixed binary(7),
     2 ENCRYPT$L_FIL_CHECKSUM bit(32) aligned;
/*                                                                          */
/* 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                  */
%replace ENCRYPT$M_FABATR by '10000000000000000000000000000000'b;
%replace ENCRYPT$M_XABALL by '01000000000000000000000000000000'b;
%replace ENCRYPT$M_XABDAT by '00100000000000000000000000000000'b;
%replace ENCRYPT$M_XABFHC by '00010000000000000000000000000000'b;
%replace ENCRYPT$M_XABPRO by '00001000000000000000000000000000'b;
%replace ENCRYPT$M_PROACL by '00000100000000000000000000000000'b;
%replace ENCRYPT$M_XABSUM by '00000010000000000000000000000000'b;
%replace ENCRYPT$M_UNASSIGNED by '00000001111111111111111111111111'b;
 
%replace ENCRYPT$S_ATR_RECORD by 256;
dcl 1 ATR_RECORD  based,
     2 ENCRYPT$W_FILATR_LENGTH bit(16) aligned,
     2 ENCRYPT$W_FILATR_FILL_60 fixed binary(15),
     2 ENCRYPT$R_FILATR_OVERLAY union,
      3 ENCRYPT$L_FILATR bit(32) aligned,
      3 ENCRYPT$R_FILATR_BITS ,
       4 ENCRYPT$V_FABATR bit(1),
       4 ENCRYPT$V_XABALL bit(1),
       4 ENCRYPT$V_XABDAT bit(1),
       4 ENCRYPT$V_XABFHC bit(1),
       4 ENCRYPT$V_XABPRO bit(1),
       4 ENCRYPT$V_PROACL bit(1),
       4 ENCRYPT$V_XABSUM bit(1),
       4 ENCRYPT$V_UNASSIGNED bit(25),
     2 ENCRYPT$B_ATR_FILLER (1:248) fixed binary(7);
/*                                                                          */
/* 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                                     */
 
%replace FABATR$S_FAB_ATTRIBUTES by 28;
dcl 1 FAB_ATTRIBUTES  based,
     2 FABATR$B_COD bit(8) aligned,
     2 FABATR$B_BLN bit(8) aligned,
     2 FABATR$w_fill_50 fixed binary(15),
     2 FABATR$l_fill_51 fixed binary(31),
     2 FABATR$B_ORG bit(8) aligned,
     2 FABATR$B_RFM bit(8) aligned,
     2 FABATR$B_RAT bit(8) aligned,
     2 FABATR$B_FSZ bit(8) aligned,
     2 FABATR$B_BKS bit(8) aligned,
     2 FABATR$B_RTV bit(8) aligned,
     2 FABATR$b_fill_52 (1:2) fixed binary(7),
     2 FABATR$W_MRS bit(16) aligned,
     2 FABATR$W_GBC bit(16) aligned,
     2 FABATR$L_MRN bit(32) aligned,
     2 FABATR$L_FOP bit(32) aligned;
/*      EXCESS_DATA             Holds data beyond plaintext EOF             */
/*      EXCESS_CRC              CRC of file                                 */
 
%replace ENCRYPT$S_EXCESS_DATA by 34;
dcl 1 EXCESS_DATA  based,
     2 ENCRYPT$W_EXCESS_CRC bit(16) aligned,
     2 ENCRYPT$T_EXCESS_RESERVED character(32);
/*                                                                          */
/* Feature block                                                            */
/*                                                                          */
%replace ENCRYPT$M_PRODUCT_VERSION_MIN by '11111111000000000000000000000000'b;
%replace ENCRYPT$M_PRODUCT_VERSION_MAJ by '00000000111111110000000000000000'b;
 
%replace ENCRYPT$S_FEATURE by 8;
dcl 1 FEATURE  based,
     2 ENCRYPT$L_FEATURE_CODE bit(32) aligned,
     2 ENCRYPT$R_VERSION_OVERLAY union,
      3 ENCRYPT$W_PRODUCT_VERSION bit(16) aligned,
      3 ENCRYPT$R_PV_BITS ,
       4 ENCRYPT$V_PRODUCT_VERSION_MIN bit(8),
       4 ENCRYPT$V_PRODUCT_VERSION_MAJ bit(8),
     2 ENCRYPT$W_FEATURE_LENGTH bit(16) aligned,
     2 ENCRYPT$T_FEATURE_VALUE character(0);
%replace ENCRYPT$M_FTR_REQUIRED by '10000000000000000000000000000000'b;
%replace ENCRYPT$M_FTR_COMMENT by '01000000000000000000000000000000'b;
%replace ENCRYPT$M_FTR_DEBUG by '00100000000000000000000000000000'b;
%replace ENCRYPT$M_FTR_SILENT by '00010000000000000000000000000000'b;
 
%replace ENCRYPT$S_FEATURE_CODE_BITS by 4;
dcl 1 FEATURE_CODE_BITS  based,
     2 ENCRYPT$V_FTR_REQUIRED bit(1),
     2 ENCRYPT$V_FTR_COMMENT bit(1),
     2 ENCRYPT$V_FTR_DEBUG bit(1),
     2 ENCRYPT$V_FTR_SILENT bit(1),
     2 ENCRYPT$V_FTR_NUMBER bit(12),
     2 ENCRYPT$V_FTR_UNUSED bit(16);
/*                                                                          */
/* CRC checking feature block value definitions                             */
/*                                                                          */
%replace ENCRYPT$K_FEATURE_CRC by 33;
/*                                                                          */
/* Semantic tag feature block value definitions                             */
/*                                                                          */
%replace ENCRYPT$K_FEATURE_SEMTAG by 17;
 
%replace ENCRYPT$S_FEATURE_SEMTAG_ by 66;
dcl 1 FEATURE_SEMTAG_  based,
     2 ENCRYPT$W_SEMTAG_LENGTH bit(16) aligned,
     2 ENCRYPT$T_SEMTAG_VALUE character(64);
%replace ENCRYPT$K_FEATURES_MAX_LEN by 86;
/*                                                                          */
/* Define the encrypted file structure version of the current implementation */
/*                                                                          */
/* Bumped FILE_VERSION for Encrypt-AES from 3 to 4                          */
/*                                                                          */
%replace ENCRYPT$K_FILE_VERSION by 4;
/*                                                                          */
/* Statistics record returned by encrypt$statistics()                       */
/*                                                                          */
 
%replace ENCRYPT$S_STAT_RECORD by 28;
dcl 1 STAT_RECORD  based,
/*                                                                          */
/* 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                       */
     2 ENCRYPT$L_STAT_TOTAL_RECORDS bit(32) aligned,
     2 ENCRYPT$Q_STAT_TOTAL_BYTES bit(64) aligned,
     2 ENCRYPT$Q_STAT_TOTAL_TIME bit(64) aligned,
     2 ENCRYPT$Q_STAT_FILL_10 bit(64) aligned;
