-
Notifications
You must be signed in to change notification settings - Fork 0
/
SHA2.IPO
58 lines (50 loc) · 2.09 KB
/
SHA2.IPO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%DCL PPV_SHA2_224 FIXED; %PPV_SHA2_224 = 1;
%DCL PPV_SHA2_256 FIXED; %PPV_SHA2_256 = 1;
%DCL PPV_SHA2_384 FIXED; %PPV_SHA2_384 = 1;
%DCL PPV_SHA2_512 FIXED; %PPV_SHA2_512 = 1;
%DCL PPV_SHA2_512_224 FIXED; %PPV_SHA2_512_224 = 1;
%DCL PPV_SHA2_512_256 FIXED; %PPV_SHA2_512_256 = 1;
/*********************************************************************/
/* TYPE DEFINITIONS FOR THE SHA2 ALGORITHM */
/*********************************************************************/
DEFINE ORDINAL SHA2_FUNCTIONS (
%IF PPV_SHA2_224 THEN DO; SHA2_224, %END;
%IF PPV_SHA2_256 THEN DO; SHA2_256, %END;
%IF PPV_SHA2_384 THEN DO; SHA2_384, %END;
%IF PPV_SHA2_512 THEN DO; SHA2_512, %END;
%IF PPV_SHA2_512_224 THEN DO; SHA2_512_224, %END;
%IF PPV_SHA2_512_256 THEN DO; SHA2_512_256 %END;
);
DEFINE ALIAS SHA224_DIGEST_TYPE CHAR(28);
DEFINE ALIAS SHA256_DIGEST_TYPE CHAR(32);
DEFINE ALIAS SHA384_DIGEST_TYPE CHAR(48);
DEFINE ALIAS SHA512_DIGEST_TYPE CHAR(64);
DEFINE ALIAS SHA512_224_DIGEST_TYPE CHAR(28);
DEFINE ALIAS SHA512_256_DIGEST_TYPE CHAR(32);
DEFINE ALIAS SHA2_DIGEST_TYPE CHAR(64) VAR;
DEFINE STRUCTURE
1 SHA256_CTX_TYPE,
3 UP ALIGNED,
5 COUNT_LO BIN FIXED(32) UNSIGNED,
5 COUNT_HI BIN FIXED(32) UNSIGNED,
5 HASH(0:7) BIN FIXED(32) UNSIGNED,
5 WBUF(0:15) BIN FIXED(32) UNSIGNED;
DEFINE ALIAS
SHA224_CTX_TYPE TYPE SHA256_CTX_TYPE;
DEFINE STRUCTURE
1 SHA512_CTX_TYPE,
3 UP ALIGNED,
5 COUNT_LO BIN FIXED(64) UNSIGNED,
5 COUNT_HI BIN FIXED(64) UNSIGNED,
5 HASH(0:7) BIN FIXED(64) UNSIGNED,
5 WBUF(0:15) BIN FIXED(64) UNSIGNED;
DEFINE ALIAS
SHA384_CTX_TYPE TYPE SHA512_CTX_TYPE;
DEFINE ALIAS
SHA512_224_CTX_TYPE TYPE SHA512_CTX_TYPE;
DEFINE ALIAS
SHA512_256_CTX_TYPE TYPE SHA512_CTX_TYPE;
DEFINE STRUCTURE
1 SHA2_CTX_TYPE UNION,
2 SHA256_CTX TYPE SHA256_CTX_TYPE,
2 SHA512_CTX TYPE SHA512_CTX_TYPE;