(**) (***************************************************************************) (** **) (** © Copyright 2013, 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: 12-Mar-2013 10:27:10 by OpenVMS SDL EV3-3 *) (* Source: 13-JAN-2012 16:21:42 $1$DGA106:[ENCRYPT.SRC]ENCRYPT_DEF.SDL;1 *) (********************************************************************************************************************************) MODULE ENCRYPT_DEF ; [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 encrypt_def IDENT V01.10 ***) (* *) (* Initialize context for encrypt/decrypt operations *) (* Accepts following arguments *) (* context : type - longword integer signed; access - write only; mechanism - by reference *) (* algorithm : type - char_string; access - read/write; mechanism - by descriptor *) (* key-type : type - longword logical unsigned; access - read only; mechanism - by reference *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* [ p1 ] : type - quadword[1] (DES), quadword[2] (AES); access - read only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$init ( VAR context : [VOLATILE] UNSIGNED; algorithm : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; key_type : UNSIGNED; key_descriptor : [CLASS_S] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR; extra_parameter : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Perform encryption of next record of plaintext *) (* Accepts following arguments *) (* context : type - longword integer signed; access - write only; mechanism - by reference *) (* input : type - char_string; access - read only; mechanism - by descriptor *) (* output : type - char_string; access - write only; mechanism - by descriptor *) (* [output-length] : type - word integer; access - write only; mechanism - by reference *) (* [p1] : type - quadword[1] (DES), quadword[2] (AES); access - read only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$encrypt ( context : UNSIGNED; input : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; VAR output_count : [VOLATILE] UNSIGNED := %IMMED 0; extra_parameter : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Perform decryption of next record of plaintext *) (* Accepts following arguments *) (* context : type - longword integer signed; access - write only; mechanism - by reference *) (* input : type - char_string; access - read only; mechanism - by descriptor *) (* output : type - char_string; access - write only; mechanism - by descriptor *) (* [output-length] : type - word integer; access - write only; mechanism - by reference *) (* [p1] : type - quadword[1] (DES), quadword[2] (AES); access - read only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$decrypt ( context : UNSIGNED; input : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; VAR output_count : [VOLATILE] UNSIGNED := %IMMED 0; extra_parameter : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Disassociates the encryption context and releases it *) (* Accepts following arguments *) (* context : type - longword integer signed; access - read/write; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$fini ( VAR context : [VOLATILE] UNSIGNED; extra_parameter : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Gains access to the statistics maintained by the Encryption software *) (* Accepts following arguments *) (* context : type - longword; access - read only; mechanism - by reference *) (* code : type - longword; access - read only; mechanism - by reference *) (* destination : type - char_string; access - write only; mechanism - by descriptor *) (* return-length : type - longword; access - write only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$statistics ( context : UNSIGNED; code : UNSIGNED; VAR destination : [CLASS_S,VOLATILE] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; VAR return_length : [VOLATILE] UNSIGNED) : INTEGER; EXTERNAL; (* *) (* Places a key definition into the process, group, job, or system key storage table *) (* Accepts following arguments *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* key-value : type - char_string; access - read only; mechanism - by descriptor *) (* key-flags : type - longword; access - read only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$define_key ( key_name : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; key_value : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; key_flags : UNSIGNED; key_protection : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Deletes a key definition from a key storage table *) (* Accepts following arguments *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* key-flags : type - longword; access - read only; mechanism - by reference *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$delete_key ( key_name : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; key_flags : UNSIGNED) : INTEGER; EXTERNAL; (* *) (* Encrypts or decrypts data files *) (* Accepts following arguments *) (* input-file : type - char_string; access - read only; mechanism - by descriptor *) (* output-file : type - char_string; access - read only; mechanism - by descriptor *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* algorithm : type - char_string; access - read only; mechanism - by descriptor *) (* file-flags : type - longword; access - read only; mechanism - by reference *) (* [item-list] : type - item_list_3; access - read only; mechanism - by descriptor *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$encrypt_file ( input_file : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; output_file : [CLASS_S] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; key_name : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; algorithm : [CLASS_S] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR; file_flags : UNSIGNED; item_list : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; (* *) (* Encrypts a small amount of data in an encrypt stream *) (* Accepts following arguments *) (* input : type - char_string; access - read only; mechanism - by descriptor *) (* output : type - char_string; access - write only; mechanism - by descriptor *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* algorithm : type - char_string; access - read only; mechanism - by descriptor *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$encrypt_one_record ( input : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; key_name : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; algorithm : [CLASS_S] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR) : INTEGER; EXTERNAL; (* *) (* Decrypts a small amount of data on a decrypt stream *) (* Accepts following arguments *) (* input : type - char_string; access - read only; mechanism - by descriptor *) (* output : type - char_string; access - write only; mechanism - by descriptor *) (* key-name : type - char_string; access - read only; mechanism - by descriptor *) (* algorithm : type - char_string; access - read only; mechanism - by descriptor *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$decrypt_one_record ( input : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR; key_name : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; algorithm : [CLASS_S] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR) : INTEGER; EXTERNAL; (* *) (* Generates a random key value *) (* Accepts following arguments *) (* algorithm-name : type - char_string; access - read only; mechanism - by descriptor *) (* key-length : type - word unsigned; access - read only; mechanism - by reference *) (* [factor-a] : type - char_string; access - read only; mechanism - by descriptor *) (* [factor-b] : type - char_string; access - read only; mechanism - by descriptor *) (* [factor-c] : type - char_string; access - read only; mechanism - by descriptor *) (* [key-buffer] : type - char_string; access - write; mechanism - by descriptor *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$generate_key ( algorithm : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR; key_length : UNSIGNED; factor_a : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; factor_b : [CLASS_S] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR; factor_c : [CLASS_S] PACKED ARRAY [$l5..$u5:INTEGER] OF CHAR; VAR key_buffer : [CLASS_S,VOLATILE] PACKED ARRAY [$l6..$u6:INTEGER] OF CHAR) : INTEGER; EXTERNAL; (* *) (* Unsupported calls *) (* *) [ASYNCHRONOUS] FUNCTION encrypt$init_asyn ( efn : UNSIGNED; VAR context : [VOLATILE] UNSIGNED; %IMMED [UNBOUND, ASYNCHRONOUS] PROCEDURE ast_address; ast_parameter : UNSIGNED; status_block : $QUAD; item_list : UNSIGNED) : INTEGER; EXTERNAL; [ASYNCHRONOUS] FUNCTION encrypt$encrypt_asyn ( efn : UNSIGNED; context : UNSIGNED; input : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR; %IMMED [UNBOUND, ASYNCHRONOUS] PROCEDURE ast_address; ast_parameter : UNSIGNED; status_block : $QUAD; item_list : UNSIGNED) : INTEGER; EXTERNAL; [ASYNCHRONOUS] FUNCTION encrypt$decrypt_asyn ( efn : UNSIGNED; context : UNSIGNED; input : [CLASS_S] PACKED ARRAY [$l3..$u3:INTEGER] OF CHAR; VAR output : [CLASS_S,VOLATILE] PACKED ARRAY [$l4..$u4:INTEGER] OF CHAR; %IMMED [UNBOUND, ASYNCHRONOUS] PROCEDURE ast_address; ast_parameter : UNSIGNED; status_block : $QUAD; item_list : UNSIGNED) : INTEGER; EXTERNAL; [ASYNCHRONOUS] FUNCTION encrypt$fini_asyn ( efn : UNSIGNED; VAR context : [VOLATILE] UNSIGNED; %IMMED [UNBOUND, ASYNCHRONOUS] PROCEDURE ast_address; ast_parameter : UNSIGNED; status_block : $QUAD; item_list : UNSIGNED) : INTEGER; EXTERNAL; [ASYNCHRONOUS] FUNCTION encrypt$sync_asyn ( efn : UNSIGNED; context : UNSIGNED; status_block : $QUAD) : INTEGER; EXTERNAL; END.