Fix warnings.
[openssl.git] / engines / ccgost / gost2814789t.c
1 /* vim: set fileencoding=ascii : Charset: ASCII */
2 /* test/gostr2814789t.c */
3 /* ====================================================================
4  * Copyright (c) 2012 Crypto-Pro, Ltd., Serguei E. Leontiev,
5  *                    lse@cryptopro.ru
6  *
7  * This file is distributed under the same license as OpenSSL
8  * ====================================================================
9  */
10 #include <stdio.h>
11
12 #if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_NO_GOST)
13 int main(int argc, char *argv[])
14 {
15     printf("No GOST 28147-89 support\n");
16     return 0;
17 }
18 #else
19
20 #include <stdlib.h>
21 #include <string.h>
22 #include <openssl/conf.h>
23 #include <openssl/crypto.h>
24 #include <openssl/engine.h>
25 #include <openssl/err.h>
26 #include <openssl/evp.h>
27 #include <openssl/hmac.h>
28 #include <openssl/obj_mac.h>
29
30 #define CCGOST_ID "gost"
31 #define CCGOST_DIR "../engines/ccgost"
32
33 #include "../engines/ccgost/gost89.h"
34
35 #define G89_MAX_TC_LEN  (2048)
36 #define G89_BLOCK_LEN (8)
37
38 typedef enum g89_mode_ {
39     G89_ECB,
40     G89_CFB,
41     G89_CNT,
42     G89_IMIT
43 }   g89_mode;
44
45 typedef struct g89_tc_ {
46     unsigned long long ullLen;          // ullLen > G89_MAX_TC_LEN
47                                         //     Clear text ullLen
48                                         //     of zero bytes
49     const byte bIn[G89_MAX_TC_LEN];     // Clear text, when
50                                         //     ullLen <= G89_MAX_TC_LEN
51     const char *szParamSet;             // S-Box ID
52     const char *szDerive;               // String for derive bRawKey
53     const byte bRawKey[EVP_MAX_KEY_LENGTH];
54     g89_mode gMode;                     // Mode of encryption or MAC
55     const byte bIV[EVP_MAX_IV_LENGTH];  // IV for CFB or CNT mode
56     const byte bOut[G89_MAX_TC_LEN];    // Cipher text for ECB/CFB/CNT
57                                         // mode, when ullLen <= G89_MAX_TC_LEN;
58                                         // Last 16 byte of cipher text for
59                                         // ECB/CFB/CNT, when ullLen >
60                                         // G89_MAX_TC_LEN;
61                                         // 4 byte MAC for imitovstavka
62 }   g89_tc;
63
64 const g89_tc tcs[] = {
65   /* 
66    * GOST R 34.11-94 Test cases 
67    */
68     { /* see p. A.3.1 [GOSTR341194], p. 7.3.1 [ENG-GOSTR341194] */
69       /* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
70       /* Iteration 1, K[1], see Errata for RFC 5831 */
71         8, 
72         { 
73             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
74         },
75         "id-GostR3410-94-TestParamSet",
76         NULL,
77         {
78             0x54, 0x6d, 0x20, 0x33, 0x68, 0x65, 0x6c, 0x32,
79             0x69, 0x73, 0x65, 0x20, 0x73, 0x73, 0x6e, 0x62,
80             0x20, 0x61, 0x67, 0x79, 0x69, 0x67, 0x74, 0x74,
81             0x73, 0x65, 0x68, 0x65, 0x20, 0x2c, 0x3d, 0x73
82         },
83         G89_ECB,
84         { 0 },
85         {
86             0x1b, 0x0b, 0xbc, 0x32, 0xce, 0xbc, 0xab, 0x42
87         }
88     },
89     { /* see p. A.3.1 [GOSTR341194], p. 7.3.1 [ENG-GOSTR341194] */
90       /* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
91       /* Iteration 1, K[4] */
92         8, 
93         { 
94             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 
95         },
96         "id-GostR3410-94-TestParamSet",
97         NULL,
98         {
99             0xec, 0x0a, 0x8b, 0xa1, 0x5e, 0xc0, 0x04, 0xa8,
100             0xba, 0xc5, 0x0c, 0xac, 0x0c, 0x62, 0x1d, 0xee,
101             0xe1, 0xc7, 0xb8, 0xe7, 0x00, 0x7a, 0xe2, 0xec,
102             0xf2, 0x73, 0x1b, 0xff, 0x4e, 0x80, 0xe2, 0xa0
103         },
104         G89_ECB,
105         { 0 },
106         {
107             0x2d, 0x56, 0x2a, 0x0d, 0x19, 0x04, 0x86, 0xe7
108         }
109     },
110     { /* see p. A.3.1 [GOSTR341194], p. 7.3.1 [ENG-GOSTR341194] */
111       /* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
112       /* Iteration 2, K[1] */
113         8, 
114         { 
115             0x34, 0xc0, 0x15, 0x33, 0xe3, 0x7d, 0x1c, 0x56
116         },
117         "id-GostR3410-94-TestParamSet",
118         NULL,
119         {
120             0x34, 0x87, 0x24, 0xa4, 0xc1, 0xa6, 0x76, 0x67,
121             0x15, 0x3d, 0xde, 0x59, 0x33, 0x88, 0x42, 0x50,
122             0xe3, 0x24, 0x8c, 0x65, 0x7d, 0x41, 0x3b, 0x8c,
123             0x1c, 0x9c, 0xa0, 0x9a, 0x56, 0xd9, 0x68, 0xcf
124         },
125         G89_ECB,
126         { 0 },
127         {
128             0x86, 0x3e, 0x78, 0xdd, 0x2d, 0x60, 0xd1, 0x3c
129         }
130     },
131   /* 
132    * id-Gost28147-89-CryptoPro-A-ParamSet (1.2.643.2.2.31.1)
133    * Test cases
134    */
135     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
136         16,
137         {
138             0x74, 0x3d, 0x76, 0xf9, 0x1b, 0xee, 0x35, 0x3c,
139             0xa2, 0x5c, 0x3b, 0x10, 0xeb, 0x64, 0xcf, 0xf5
140         },
141         "id-Gost28147-89-CryptoPro-A-ParamSet",
142         "testecb1",
143         {
144             0xbb, 0xf1, 0xed, 0xd3, 0x20, 0xaf, 0x8a, 0x62,
145             0x8e, 0x11, 0xc8, 0xa9, 0x51, 0xcc, 0xbe, 0x81,
146             0x47, 0x7b, 0x41, 0xa1, 0x6a, 0xf6, 0x7f, 0x05,
147             0xe8, 0x51, 0x2f, 0x9e, 0x01, 0xf8, 0xcf, 0x49
148         },
149         G89_ECB,
150         { 0 },
151         {
152             0xc3, 0x73, 0x90, 0x95, 0x35, 0x58, 0x08, 0x63,
153             0xcb, 0x68, 0x85, 0x96, 0x77, 0xe8, 0xfb, 0xa9
154         }
155     },
156     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
157         16,
158         {
159             0xd2, 0xfd, 0xf8, 0x3a, 0xc1, 0xb4, 0x39, 0x23,
160             0x2e, 0xaa, 0xcc, 0x98, 0x0a, 0x02, 0xda, 0x33
161         },
162         "id-Gost28147-89-CryptoPro-A-ParamSet",
163         "testcfb1",
164         {
165             0x8d, 0x5a, 0x2c, 0x83, 0xa7, 0xc7, 0x0a, 0x61,
166             0xd6, 0x1b, 0x34, 0xb5, 0x1f, 0xdf, 0x42, 0x68,
167             0x66, 0x71, 0xa3, 0x5d, 0x87, 0x4c, 0xfd, 0x84,
168             0x99, 0x36, 0x63, 0xb6, 0x1e, 0xd6, 0x0d, 0xad
169         },
170         G89_CFB,
171         {
172             0x46, 0x60, 0x6f, 0x0d, 0x88, 0x34, 0x23, 0x5a
173         },
174         {
175             0x88, 0xb7, 0x75, 0x16, 0x74, 0xa5, 0xee, 0x2d,
176             0x14, 0xfe, 0x91, 0x67, 0xd0, 0x5c, 0xcc, 0x40
177         }
178     },
179     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
180         16,
181         {
182             0x90, 0xa2, 0x39, 0x66, 0xae, 0x01, 0xb9, 0xa3,
183             0x52, 0x4e, 0xc8, 0xed, 0x6c, 0xdd, 0x88, 0x30
184         },
185         "id-Gost28147-89-CryptoPro-A-ParamSet",
186         "testcnt1",
187         {
188             0x59, 0x9f, 0x84, 0xba, 0xc3, 0xf3, 0xd2, 0xf1,
189             0x60, 0xe1, 0xe3, 0xf2, 0x6a, 0x96, 0x1a, 0xf9,
190             0x9c, 0x48, 0xb2, 0x4e, 0xbc, 0xbb, 0xbf, 0x7c,
191             0xd8, 0xf3, 0xac, 0xcd, 0x96, 0x8d, 0x28, 0x6a
192         },
193         G89_CNT,
194         {
195             0x8d, 0xaf, 0xa8, 0xd1, 0x58, 0xed, 0x05, 0x8d
196         },
197         {
198             0x6e, 0x72, 0x62, 0xcc, 0xe3, 0x59, 0x36, 0x90,
199             0x83, 0x3a, 0xfe, 0xa9, 0x1b, 0xc9, 0xbe, 0xce
200         }
201     },
202     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
203         16,
204         {
205             0xb5, 0xa1, 0xf0, 0xe3, 0xce, 0x2f, 0x02, 0x1d,
206             0x67, 0x61, 0x94, 0x34, 0x5c, 0x41, 0xe3, 0x6e
207         },
208         "id-Gost28147-89-CryptoPro-A-ParamSet",
209         "testimit1",
210         {
211             0x9d, 0x05, 0xb7, 0x9e, 0x90, 0xca, 0xd0, 0x0a,
212             0x2c, 0xda, 0xd2, 0x2e, 0xf4, 0xe8, 0x6f, 0x5c,
213             0xf5, 0xdc, 0x37, 0x68, 0x19, 0x85, 0xb3, 0xbf,
214             0xaa, 0x18, 0xc1, 0xc3, 0x05, 0x0a, 0x91, 0xa2
215         },
216         G89_IMIT,
217         { 0 },
218         {
219             0xf8, 0x1f, 0x08, 0xa3
220         }
221     },
222   /* 
223    * Other paramsets and key meshing test cases.
224    */
225     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
226         1039,
227         {
228             0x8c, 0x9c, 0x44, 0x35, 0xfb, 0xe9, 0xa5, 0xa3,
229             0xa0, 0xae, 0x28, 0x56, 0x91, 0x10, 0x8e, 0x1e ,
230             0xd2, 0xbb, 0x18, 0x53, 0x81, 0x27, 0x0d, 0xa6,
231             0x68, 0x59, 0x36, 0xc5, 0x81, 0x62, 0x9a, 0x8e,
232             0x7d, 0x50, 0xf1, 0x6f, 0x97, 0x62, 0x29, 0xec,
233             0x80, 0x51, 0xe3, 0x7d, 0x6c, 0xc4, 0x07, 0x95,
234             0x28, 0x63, 0xdc, 0xb4, 0xb9, 0x2d, 0xb8, 0x13,
235             0xb1, 0x05, 0xb5, 0xf9, 0xeb, 0x75, 0x37, 0x4e,
236             0xf7, 0xbf, 0x51, 0xf1, 0x98, 0x86, 0x43, 0xc4,
237             0xe4, 0x3d, 0x3e, 0xa7, 0x62, 0xec, 0x41, 0x59,
238             0xe0, 0xbd, 0xfb, 0xb6, 0xfd, 0xec, 0xe0, 0x77,
239             0x13, 0xd2, 0x59, 0x90, 0xa1, 0xb8, 0x97, 0x6b,
240             0x3d, 0x8b, 0x7d, 0xfc, 0x9d, 0xca, 0x82, 0x73,
241             0x32, 0x70, 0x0a, 0x74, 0x03, 0xc6, 0x0c, 0x26,
242             0x7f, 0x56, 0xf0, 0x9d, 0xb2, 0xeb, 0x71, 0x40,
243             0xd7, 0xc3, 0xb1, 0xa7, 0xc5, 0x1e, 0x20, 0x17,
244             0xb3, 0x50, 0x1d, 0x8a, 0x6e, 0x19, 0xcb, 0xbe,
245             0x20, 0x86, 0x2b, 0xd6, 0x1c, 0xfd, 0xb4, 0xb7,
246             0x5d, 0x9a, 0xb3, 0xe3, 0x7d, 0x15, 0x7a, 0x35,
247             0x01, 0x9f, 0x5d, 0x65, 0x89, 0x4b, 0x34, 0xc6,
248             0xf4, 0x81, 0x3f, 0x78, 0x30, 0xcf, 0xe9, 0x15,
249             0x90, 0x9a, 0xf9, 0xde, 0xba, 0x63, 0xd0, 0x19,
250             0x14, 0x66, 0x3c, 0xb9, 0xa4, 0xb2, 0x84, 0x94,
251             0x02, 0xcf, 0xce, 0x20, 0xcf, 0x76, 0xe7, 0xc5,
252             0x48, 0xf7, 0x69, 0x3a, 0x5d, 0xec, 0xaf, 0x41,
253             0xa7, 0x12, 0x64, 0x83, 0xf5, 0x99, 0x1e, 0x9e,
254             0xb2, 0xab, 0x86, 0x16, 0x00, 0x23, 0x8e, 0xe6,
255             0xd9, 0x80, 0x0b, 0x6d, 0xc5, 0x93, 0xe2, 0x5c,
256             0x8c, 0xd8, 0x5e, 0x5a, 0xae, 0x4a, 0x85, 0xfd,
257             0x76, 0x01, 0xea, 0x30, 0xf3, 0x78, 0x34, 0x10,
258             0x72, 0x51, 0xbc, 0x9f, 0x76, 0xce, 0x1f, 0xd4,
259             0x8f, 0x33, 0x50, 0x34, 0xc7, 0x4d, 0x7b, 0xcf,
260             0x91, 0x63, 0x7d, 0x82, 0x9e, 0xa1, 0x23, 0x45,
261             0xf5, 0x45, 0xac, 0x98, 0x7a, 0x48, 0xff, 0x64,
262             0xd5, 0x59, 0x47, 0xde, 0x2b, 0x3f, 0xfa, 0xec,
263             0x50, 0xe0, 0x81, 0x60, 0x8b, 0xc3, 0xfc, 0x80,
264             0x98, 0x17, 0xc7, 0xa3, 0xc2, 0x57, 0x3d, 0xab,
265             0x91, 0x67, 0xf5, 0xc4, 0xab, 0x92, 0xc8, 0xd6,
266             0x3b, 0x6b, 0x3f, 0xff, 0x15, 0x6b, 0xcf, 0x53,
267             0x65, 0x02, 0xf1, 0x74, 0xca, 0xa9, 0xbe, 0x24,
268             0xd2, 0xf0, 0xb7, 0x26, 0xa8, 0xd7, 0x6d, 0xed,
269             0x90, 0x36, 0x7b, 0x3e, 0x41, 0xa9, 0x7f, 0xa3,
270             0x1b, 0xf4, 0x43, 0xc5, 0x51, 0xbe, 0x28, 0x59,
271             0xe9, 0x45, 0x26, 0x49, 0x38, 0x32, 0xf8, 0xf3,
272             0x92, 0x6e, 0x30, 0xcc, 0xb0, 0xa0, 0xf9, 0x01,
273             0x14, 0xc8, 0xba, 0xd9, 0xf0, 0x2a, 0x29, 0xe2,
274             0x52, 0x9a, 0x76, 0x95, 0x3a, 0x16, 0x32, 0xec,
275             0xf4, 0x10, 0xec, 0xee, 0x47, 0x00, 0x70, 0x19,
276             0xe4, 0x72, 0x35, 0x66, 0x44, 0x53, 0x2d, 0xa2,
277             0xf3, 0xaa, 0x7e, 0x8a, 0x33, 0x13, 0xcd, 0xc8,
278             0xbf, 0x0e, 0x40, 0x90, 0x00, 0xe4, 0x42, 0xc3,
279             0x09, 0x84, 0xe1, 0x66, 0x17, 0xa2, 0xaf, 0x03,
280             0xab, 0x6b, 0xa1, 0xec, 0xfb, 0x17, 0x72, 0x81,
281             0xfe, 0x9a, 0x9f, 0xf4, 0xb2, 0x33, 0x1f, 0xae,
282             0x0c, 0xd1, 0x6a, 0xae, 0x19, 0xb8, 0xaf, 0xec,
283             0xe3, 0xea, 0x00, 0xf8, 0xac, 0x87, 0x07, 0x5f,
284             0x6d, 0xb0, 0xac, 0x6b, 0x22, 0x48, 0x36, 0xbf,
285             0x22, 0x18, 0xb0, 0x03, 0x9f, 0x6c, 0x70, 0x45,
286             0x36, 0xf0, 0x6b, 0xc6, 0xc2, 0xa5, 0x72, 0x2c,
287             0xd8, 0xe0, 0x27, 0x3d, 0xec, 0x56, 0x07, 0x05,
288             0x7d, 0x83, 0xa1, 0x65, 0x7d, 0x41, 0x5b, 0xcd,
289             0x77, 0x24, 0xe5, 0xaa, 0x76, 0x47, 0xd0, 0x50,
290             0xf6, 0xe7, 0xb5, 0x59, 0x75, 0x31, 0x27, 0xef,
291             0xd8, 0xa6, 0x4e, 0x7f, 0xb8, 0x40, 0xb1, 0xdf,
292             0x53, 0x14, 0xed, 0xf1, 0x68, 0x5f, 0xfc, 0x3f,
293             0x02, 0xdb, 0x05, 0xeb, 0x31, 0xe4, 0x2c, 0x7f,
294             0x32, 0xb5, 0x70, 0x8e, 0x75, 0x85, 0xa4, 0x5c,
295             0x16, 0x23, 0x37, 0xf2, 0x10, 0x79, 0xcb, 0xdc,
296             0xf8, 0x1c, 0x25, 0xc2, 0xa1, 0x3d, 0x9c, 0x33,
297             0x6c, 0xed, 0xc3, 0xe7, 0xf3, 0x02, 0x87, 0x82,
298             0x4e, 0xfb, 0xac, 0xb3, 0x2d, 0xfc, 0xf8, 0x0d,
299             0x1d, 0x4a, 0x39, 0xd4, 0xb3, 0x09, 0xbb, 0xe9,
300             0x25, 0xc7, 0xec, 0x6a, 0x87, 0x72, 0x84, 0xed,
301             0x12, 0x60, 0x19, 0x64, 0xeb, 0x16, 0x2a, 0x5b,
302             0x10, 0x76, 0x27, 0xff, 0x7b, 0xe4, 0xae, 0xe5,
303             0xa4, 0x04, 0x02, 0x7f, 0xbb, 0x0a, 0xb5, 0xf4,
304             0x05, 0xa5, 0x56, 0x1c, 0x53, 0x31, 0x7a, 0x93,
305             0xba, 0x16, 0x15, 0xab, 0x62, 0x60, 0xfc, 0xde,
306             0x72, 0x36, 0x6e, 0x28, 0xaf, 0x98, 0x0d, 0xe6,
307             0xf4, 0xde, 0x60, 0xa7, 0x7e, 0x06, 0x07, 0x86,
308             0xf3, 0x94, 0xb6, 0x6d, 0x0d, 0x93, 0xa6, 0xbc,
309             0x60, 0x70, 0x33, 0xac, 0x3f, 0xa1, 0xa8, 0x4a,
310             0x20, 0x61, 0xb6, 0xb5, 0x43, 0xa3, 0x15, 0x5a,
311             0x00, 0xbe, 0x76, 0x98, 0x57, 0x72, 0xab, 0x7a,
312             0x0e, 0x18, 0x93, 0x82, 0x3a, 0x18, 0x78, 0x6e,
313             0x71, 0x7b, 0x78, 0x4f, 0x7e, 0x8c, 0xde, 0x7a,
314             0x62, 0xb5, 0x0a, 0x7c, 0x45, 0x1d, 0x16, 0xd5,
315             0xc3, 0x8c, 0x9b, 0x25, 0xb4, 0x50, 0x90, 0xcd,
316             0x96, 0x93, 0xad, 0x0f, 0xd4, 0x43, 0xcb, 0x49,
317             0x0f, 0xfc, 0x5a, 0x31, 0xf4, 0x19, 0xb7, 0xd4,
318             0xeb, 0x4d, 0x40, 0x58, 0xd0, 0x3b, 0xc8, 0xe0,
319             0x4a, 0x54, 0x2f, 0xdb, 0x22, 0xc3, 0x29, 0x7b,
320             0x40, 0x90, 0x61, 0x43, 0xd3, 0x7e, 0xe2, 0x30,
321             0x2b, 0x48, 0x3c, 0xce, 0x90, 0x93, 0xb1, 0x8b,
322             0x31, 0x96, 0x65, 0x6d, 0x57, 0x8b, 0x9d, 0x4d,
323             0x53, 0xf0, 0x83, 0x1c, 0xe5, 0xa1, 0x9d, 0x55,
324             0xe3, 0xbf, 0x7e, 0xca, 0x1a, 0x74, 0x66, 0x14,
325             0xcc, 0x47, 0x43, 0xd9, 0xbb, 0xef, 0x97, 0x7d,
326             0xb7, 0x6e, 0xff, 0xf1, 0x22, 0xf8, 0x10, 0x2d,
327             0x3f, 0xcd, 0x49, 0x96, 0xd9, 0x09, 0x11, 0xb8,
328             0x33, 0xd0, 0x23, 0x9a, 0xfa, 0x16, 0xcb, 0x50,
329             0x26, 0x57, 0x24, 0x5c, 0x0e, 0xba, 0xf0, 0x3f,
330             0x37, 0x2f, 0xa3, 0xf7, 0x18, 0x57, 0x48, 0x48,
331             0x95, 0xcf, 0xef, 0x87, 0x67, 0x2a, 0xe9, 0xb6,
332             0x8a, 0x21, 0x36, 0x7f, 0xff, 0x48, 0x6c, 0x46,
333             0x35, 0x57, 0xf2, 0xbc, 0x48, 0x67, 0x8f, 0x63,
334             0x23, 0x78, 0x11, 0x2b, 0xc2, 0x08, 0xde, 0x51,
335             0xe8, 0x8b, 0x92, 0x29, 0xf9, 0x9a, 0x9e, 0xad,
336             0xed, 0x0f, 0xeb, 0xa2, 0xd2, 0x40, 0x92, 0xd4,
337             0xde, 0x62, 0x95, 0x76, 0xfd, 0x6e, 0x3c, 0xbf,
338             0xc0, 0xd7, 0x0d, 0xe5, 0x1b, 0xa4, 0xc7, 0x18,
339             0xe1, 0x58, 0xa4, 0x56, 0xef, 0x2e, 0x17, 0x1b,
340             0x75, 0xcb, 0xbc, 0xf9, 0x2a, 0x95, 0x71, 0xa7,
341             0x1d, 0x7f, 0xe7, 0x73, 0x63, 0x05, 0x6b, 0x19,
342             0x4c, 0xf4, 0x22, 0x14, 0xc4, 0x59, 0x88, 0x66,
343             0x92, 0x86, 0x61, 0x5c, 0x6a, 0xae, 0xec, 0x58,
344             0xff, 0xc9, 0xf2, 0x44, 0xd4, 0xa2, 0xf5, 0x98,
345             0xeb, 0x5f, 0x09, 0xbc, 0x8a, 0xbf, 0x3c, 0xb4,
346             0x3e, 0xb1, 0x20, 0x05, 0x44, 0x96, 0x79, 0x0a,
347             0x40, 0x92, 0x7f, 0x9d, 0xd1, 0xaf, 0xbc, 0x90,
348             0x95, 0x0a, 0x81, 0xd4, 0xa7, 0xc6, 0xb8, 0xe0,
349             0xe4, 0x39, 0x30, 0x1d, 0x79, 0xc0, 0xe5, 0xfa,
350             0xb4, 0xe9, 0x63, 0xb4, 0x09, 0x72, 0x3b, 0x3e,
351             0xd9, 0xf6, 0xd9, 0x10, 0x21, 0x18, 0x7e, 0xe5,
352             0xad, 0x81, 0xd7, 0xd5, 0x82, 0xd0, 0x8c, 0x3b,
353             0x38, 0x95, 0xf8, 0x92, 0x01, 0xa9, 0x92, 0x00,
354             0x70, 0xd1, 0xa7, 0x88, 0x77, 0x1f, 0x3a, 0xeb,
355             0xb5, 0xe4, 0xf5, 0x9d, 0xc7, 0x37, 0x86, 0xb2,
356             0x12, 0x46, 0x34, 0x19, 0x72, 0x8c, 0xf5, 0x8c,
357             0xf6, 0x78, 0x98, 0xe0, 0x7c, 0xd3, 0xf4
358         },
359         "id-Gost28147-89-CryptoPro-B-ParamSet",
360         "testcfb2",
361         {
362             0x48, 0x0c, 0x74, 0x1b, 0x02, 0x6b, 0x55, 0xd5,
363             0xb6, 0x6d, 0xd7, 0x1d, 0x40, 0x48, 0x05, 0x6b,
364             0x6d, 0xeb, 0x3c, 0x29, 0x0f, 0x84, 0x80, 0x23,
365             0xee, 0x0d, 0x47, 0x77, 0xe3, 0xfe, 0x61, 0xc9
366         },
367         G89_CFB,
368         {
369             0x1f, 0x3f, 0x82, 0x1e, 0x0d, 0xd8, 0x1e, 0x22
370         },
371         {
372             0x23, 0xc6, 0x7f, 0x20, 0xa1, 0x23, 0x58, 0xbc,
373             0x7b, 0x05, 0xdb, 0x21, 0x15, 0xcf, 0x96, 0x41,
374             0xc7, 0x88, 0xef, 0x76, 0x5c, 0x49, 0xdb, 0x42,
375             0xbf, 0xf3, 0xc0, 0xf5, 0xbd, 0x5d, 0xd9, 0x8e,
376             0xaf, 0x3d, 0xf4, 0xe4, 0xda, 0x88, 0xbd, 0xbc,
377             0x47, 0x5d, 0x76, 0x07, 0xc9, 0x5f, 0x54, 0x1d,
378             0x1d, 0x6a, 0xa1, 0x2e, 0x18, 0xd6, 0x60, 0x84,
379             0x02, 0x18, 0x37, 0x92, 0x92, 0x15, 0xab, 0x21,
380             0xee, 0x21, 0xcc, 0x71, 0x6e, 0x51, 0xd9, 0x2b,
381             0xcc, 0x81, 0x97, 0x3f, 0xeb, 0x45, 0x99, 0xb8,
382             0x1b, 0xda, 0xff, 0x90, 0xd3, 0x41, 0x06, 0x9c,
383             0x3f, 0xfb, 0xe4, 0xb2, 0xdc, 0xc9, 0x03, 0x0d,
384             0xa7, 0xae, 0xd7, 0x7d, 0x02, 0xb8, 0x32, 0xab,
385             0xf3, 0x65, 0xa3, 0x65, 0x6c, 0x4e, 0xe4, 0xa2,
386             0x5e, 0x9e, 0xee, 0xcd, 0xde, 0x79, 0x36, 0x6b,
387             0x1b, 0xe1, 0x3c, 0xdf, 0x10, 0xad, 0x4f, 0x02,
388             0xe1, 0x14, 0xaa, 0x09, 0xb4, 0x0b, 0x76, 0xeb,
389             0x69, 0x38, 0x20, 0x02, 0xcb, 0x8e, 0xc0, 0xdf,
390             0xca, 0x48, 0x74, 0xc3, 0x31, 0xad, 0x42, 0x2c,
391             0x51, 0x9b, 0xd0, 0x6a, 0xc1, 0x36, 0xd7, 0x21,
392             0xdf, 0xb0, 0x45, 0xba, 0xca, 0x7f, 0x35, 0x20,
393             0x28, 0xbb, 0xc1, 0x76, 0xfd, 0x43, 0x5d, 0x23,
394             0x7d, 0x31, 0x84, 0x1a, 0x97, 0x4d, 0x83, 0xaa,
395             0x7e, 0xf1, 0xc4, 0xe6, 0x83, 0xac, 0x0d, 0xef,
396             0xef, 0x3c, 0xa4, 0x7c, 0x48, 0xe4, 0xc8, 0xca,
397             0x0d, 0x7d, 0xea, 0x7c, 0x45, 0xd7, 0x73, 0x50,
398             0x25, 0x1d, 0x01, 0xc4, 0x02, 0x1a, 0xcd, 0xe0,
399             0x38, 0x5b, 0xa8, 0x5a, 0x16, 0x9a, 0x10, 0x59,
400             0x74, 0xd7, 0x19, 0xc6, 0xf3, 0xb5, 0x17, 0xf6,
401             0x59, 0x8d, 0x62, 0xaf, 0x44, 0xe8, 0xdc, 0xe9,
402             0xc1, 0x76, 0xf1, 0xd0, 0xbd, 0x29, 0xd7, 0xec,
403             0x1d, 0xac, 0x57, 0xdb, 0x1a, 0x3f, 0xd8, 0xf6,
404             0x6e, 0xb6, 0xe6, 0xdf, 0x36, 0xe7, 0x89, 0xce,
405             0x56, 0x35, 0x43, 0x1c, 0x7d, 0x57, 0x79, 0x0e,
406             0xd8, 0xf4, 0xd7, 0xa7, 0x0d, 0xc6, 0x8f, 0x91,
407             0x66, 0x67, 0x82, 0x0f, 0x49, 0xc9, 0xc5, 0x65,
408             0x81, 0xa1, 0x39, 0x5a, 0x53, 0x9f, 0x02, 0xa5,
409             0xd5, 0x36, 0x22, 0xa8, 0xa8, 0x1c, 0x37, 0x0e,
410             0x76, 0x46, 0xdf, 0xbd, 0x6a, 0xdb, 0xfc, 0x1b,
411             0xbd, 0x10, 0xb8, 0xb1, 0xbc, 0x72, 0x4c, 0x58,
412             0x4a, 0xda, 0x6d, 0x66, 0x00, 0xda, 0x7a, 0x66,
413             0xa0, 0xe7, 0x3b, 0x39, 0xa3, 0xf7, 0x05, 0x07,
414             0xfa, 0x21, 0x4b, 0xc7, 0x94, 0xc0, 0xd3, 0x7b,
415             0x19, 0x02, 0x5d, 0x4a, 0x10, 0xf1, 0xc2, 0x0f,
416             0x19, 0x68, 0x27, 0xc7, 0x7d, 0xbf, 0x55, 0x03,
417             0x57, 0x7d, 0xaf, 0x77, 0xae, 0x80, 0x2f, 0x7a,
418             0xe6, 0x1f, 0x4b, 0xdc, 0x15, 0x18, 0xc0, 0x62,
419             0xa1, 0xe8, 0xd9, 0x1c, 0x9e, 0x8c, 0x96, 0x39,
420             0xc1, 0xc4, 0x88, 0xf7, 0x0c, 0xe1, 0x04, 0x84,
421             0x68, 0x51, 0xce, 0xf1, 0x90, 0xda, 0x7f, 0x76,
422             0xc8, 0xc0, 0x88, 0xef, 0x8e, 0x15, 0x25, 0x3e,
423             0x7b, 0xe4, 0x79, 0xb5, 0x66, 0x2d, 0x9c, 0xd1,
424             0x13, 0xda, 0xd0, 0xd5, 0x46, 0xd5, 0x8d, 0x46,
425             0x18, 0x07, 0xee, 0xd8, 0xc9, 0x64, 0xe3, 0xbe,
426             0x0e, 0x68, 0x27, 0x09, 0x96, 0x26, 0xf6, 0xe2,
427             0x19, 0x61, 0x3f, 0xf4, 0x58, 0x27, 0x0a, 0xeb,
428             0xce, 0x7c, 0xb6, 0x68, 0x92, 0xe7, 0x12, 0x3b,
429             0x31, 0xd4, 0x48, 0xdf, 0x35, 0x8d, 0xf4, 0x86,
430             0x42, 0x2a, 0x15, 0x4b, 0xe8, 0x19, 0x1f, 0x26,
431             0x65, 0x9b, 0xa8, 0xda, 0x4b, 0x79, 0x1f, 0x8e,
432             0xe6, 0x13, 0x7e, 0x49, 0x8f, 0xc1, 0xce, 0xdc,
433             0x5e, 0x64, 0x74, 0xce, 0x02, 0x78, 0xe0, 0xcf,
434             0xa0, 0xed, 0x5e, 0x31, 0x74, 0xd1, 0xd0, 0xb4,
435             0xee, 0x70, 0x19, 0x14, 0x3c, 0x8f, 0x16, 0xa6,
436             0xcf, 0x12, 0x93, 0x15, 0x88, 0xeb, 0x91, 0x65,
437             0x76, 0x98, 0xfd, 0xa1, 0x94, 0x30, 0xba, 0x43,
438             0x62, 0x65, 0x40, 0x04, 0x77, 0x9e, 0xd6, 0xab,
439             0x8b, 0x0d, 0x93, 0x80, 0x50, 0x5f, 0xa2, 0x76,
440             0x20, 0xa7, 0xd6, 0x9c, 0x27, 0x15, 0x27, 0xbc,
441             0xa5, 0x5a, 0xbf, 0xe9, 0x92, 0x82, 0x05, 0xa8,
442             0x41, 0xe9, 0xb5, 0x60, 0xd5, 0xc0, 0xd7, 0x4b,
443             0xad, 0x38, 0xb2, 0xe9, 0xd1, 0xe5, 0x51, 0x5f,
444             0x24, 0x78, 0x24, 0x9a, 0x23, 0xd2, 0xc2, 0x48,
445             0xbd, 0x0e, 0xf1, 0x37, 0x72, 0x91, 0x87, 0xb0,
446             0x4e, 0xbd, 0x99, 0x6b, 0x2c, 0x01, 0xb6, 0x79,
447             0x69, 0xec, 0x0c, 0xed, 0xe5, 0x3f, 0x50, 0x64,
448             0x7c, 0xb9, 0xdd, 0xe1, 0x92, 0x81, 0xb5, 0xd0,
449             0xcb, 0x17, 0x83, 0x86, 0x8b, 0xea, 0x4f, 0x93,
450             0x08, 0xbc, 0x22, 0x0c, 0xef, 0xe8, 0x0d, 0xf5,
451             0x9e, 0x23, 0xe1, 0xf9, 0xb7, 0x6b, 0x45, 0x0b,
452             0xcb, 0xa9, 0xb6, 0x4d, 0x28, 0x25, 0xba, 0x3e,
453             0x86, 0xf2, 0x75, 0x47, 0x5d, 0x9d, 0x6b, 0xf6,
454             0x8a, 0x05, 0x58, 0x73, 0x3d, 0x00, 0xde, 0xfd,
455             0x69, 0xb1, 0x61, 0x16, 0xf5, 0x2e, 0xb0, 0x9f,
456             0x31, 0x6a, 0x00, 0xb9, 0xef, 0x71, 0x63, 0x47,
457             0xa3, 0xca, 0xe0, 0x40, 0xa8, 0x7e, 0x02, 0x04,
458             0xfe, 0xe5, 0xce, 0x48, 0x73, 0xe3, 0x94, 0xcf,
459             0xe2, 0xff, 0x29, 0x7e, 0xf6, 0x32, 0xbb, 0xb7,
460             0x55, 0x12, 0x21, 0x7a, 0x9c, 0x75, 0x04, 0x0c,
461             0xb4, 0x7c, 0xb0, 0x3d, 0x40, 0xb3, 0x11, 0x9a,
462             0x7a, 0x9a, 0x13, 0xfb, 0x77, 0xa7, 0x51, 0x68,
463             0xf7, 0x05, 0x47, 0x3b, 0x0f, 0x52, 0x5c, 0xe6,
464             0xc2, 0x99, 0x3a, 0x37, 0x54, 0x5c, 0x4f, 0x2b,
465             0xa7, 0x01, 0x08, 0x74, 0xbc, 0x91, 0xe3, 0xe2,
466             0xfe, 0x65, 0x94, 0xfd, 0x3d, 0x18, 0xe0, 0xf0,
467             0x62, 0xed, 0xc2, 0x10, 0x82, 0x9c, 0x58, 0x7f,
468             0xb2, 0xa3, 0x87, 0x8a, 0x74, 0xd9, 0xc1, 0xfb,
469             0x84, 0x28, 0x17, 0xc7, 0x2b, 0xcb, 0x53, 0x1f,
470             0x4e, 0x8a, 0x82, 0xfc, 0xb4, 0x3f, 0xc1, 0x47,
471             0x25, 0xf3, 0x21, 0xdc, 0x4c, 0x2d, 0x08, 0xfa,
472             0xe7, 0x0f, 0x03, 0xa9, 0x68, 0xde, 0x6b, 0x41,
473             0xa0, 0xf9, 0x41, 0x6c, 0x57, 0x4d, 0x3a, 0x0e,
474             0xea, 0x51, 0xca, 0x9f, 0x97, 0x11, 0x7d, 0xf6,
475             0x8e, 0x88, 0x63, 0x67, 0xc9, 0x65, 0x13, 0xca,
476             0x38, 0xed, 0x35, 0xbe, 0xf4, 0x27, 0xa9, 0xfc,
477             0xa9, 0xe6, 0xc3, 0x40, 0x86, 0x08, 0x39, 0x72,
478             0x37, 0xee, 0xb2, 0x87, 0x09, 0x96, 0xb7, 0x40,
479             0x87, 0x36, 0x92, 0xc1, 0x5d, 0x6a, 0x2c, 0x43,
480             0xca, 0x25, 0xc8, 0x35, 0x37, 0x2d, 0xb5, 0xa9,
481             0x27, 0x44, 0x50, 0xf2, 0x6d, 0x22, 0x75, 0x41,
482             0x77, 0x2a, 0xdb, 0xb1, 0x8c, 0x6d, 0x05, 0xe8,
483             0xc9, 0x99, 0xc7, 0x08, 0xf9, 0x14, 0x8f, 0x78,
484             0xa9, 0x8f, 0xc2, 0x5a, 0x7a, 0x65, 0xc5, 0xd8,
485             0x86, 0xbb, 0x72, 0x69, 0x6b, 0x6b, 0x45, 0x83,
486             0x5b, 0xb1, 0xf7, 0xcd, 0x16, 0x73, 0xee, 0xe9,
487             0x80, 0x85, 0xfe, 0x8e, 0xe1, 0xae, 0x53, 0x8f,
488             0xde, 0xbe, 0x48, 0x8b, 0x59, 0xef, 0xf6, 0x7e,
489             0xd8, 0xb5, 0xa8, 0x47, 0xc0, 0x4e, 0x15, 0x58,
490             0xca, 0xd3, 0x2f, 0xf8, 0x6c, 0xa6, 0x3d, 0x78,
491             0x4d, 0x7a, 0x54, 0xd6, 0x10, 0xe5, 0xcc, 0x05,
492             0xe2, 0x29, 0xb5, 0x86, 0x07, 0x39, 0x7d, 0x78,
493             0x8e, 0x5a, 0x8f, 0x83, 0x4c, 0xe7, 0x3d, 0x68,
494             0x3e, 0xe5, 0x02, 0xe6, 0x64, 0x4f, 0x5e, 0xb4,
495             0x49, 0x77, 0xf0, 0xc0, 0xfa, 0x6f, 0xc8, 0xfb,
496             0x9f, 0x84, 0x6f, 0x55, 0xfb, 0x30, 0x5e, 0x89,
497             0x93, 0xa9, 0xf3, 0xa6, 0xa3, 0xd7, 0x26, 0xbb,
498             0xd8, 0xa8, 0xd9, 0x95, 0x1d, 0xfe, 0xfc, 0xd7,
499             0xa8, 0x93, 0x66, 0x2f, 0x04, 0x53, 0x06, 0x64,
500             0x7f, 0x31, 0x29, 0xae, 0xb7, 0x9f, 0xba, 0xc4,
501             0x6d, 0x68, 0xd1, 0x24, 0x32, 0xf4, 0x11
502         }
503     },
504     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
505         4,
506         {
507             0x07, 0x9c, 0x91, 0xbe
508         },
509         "id-Gost28147-89-CryptoPro-C-ParamSet",
510         "testcfb3",
511         {
512             0x77, 0xc3, 0x45, 0x8e, 0xf6, 0x42, 0xe7, 0x04,
513             0x8e, 0xfc, 0x08, 0xe4, 0x70, 0x96, 0xd6, 0x05,
514             0x93, 0x59, 0x02, 0x6d, 0x6f, 0x97, 0xca, 0xe9,
515             0xcf, 0x89, 0x44, 0x4b, 0xde, 0x6c, 0x22, 0x1d
516         },
517         G89_CFB,
518         {
519             0x43, 0x7c, 0x3e, 0x8e, 0x2f, 0x2a, 0x00, 0x98
520         },
521         {
522             0x19, 0x35, 0x81, 0x34
523         }
524     },
525     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
526         9,
527         {
528             0x2f, 0x31, 0xd8, 0x83, 0xb4, 0x20, 0xe8, 0x6e,
529             0xda
530         },
531         "id-Gost28147-89-CryptoPro-D-ParamSet",
532         "testcfb4",
533         {
534             0x38, 0x9f, 0xe8, 0x37, 0xff, 0x9c, 0x5d, 0x29,
535             0xfc, 0x48, 0x55, 0xa0, 0x87, 0xea, 0xe8, 0x40,
536             0x20, 0x87, 0x5b, 0xb2, 0x01, 0x15, 0x55, 0xa7,
537             0xe3, 0x2d, 0xcb, 0x3d, 0xd6, 0x59, 0x04, 0x73
538         },
539         G89_CFB,
540         {
541             0xc5, 0xa2, 0xd2, 0x1f, 0x2f, 0xdf, 0xb8, 0xeb
542         },
543         {
544             0x6d, 0xa4, 0xed, 0x40, 0x08, 0x88, 0x71, 0xad,
545             0x16
546         }
547     },
548     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
549         5242880+8, 
550         { 0 },
551         "id-Gost28147-89-CryptoPro-A-ParamSet",
552         "test5Mcfb",
553         {
554             0x61, 0x58, 0x44, 0x5a, 0x41, 0xf6, 0xc7, 0x0f,
555             0x6b, 0xdb, 0x51, 0x91, 0x6a, 0xf6, 0x81, 0x30,
556             0x8c, 0xa7, 0x98, 0xdd, 0x38, 0x35, 0x8a, 0x60,
557             0x85, 0xb4, 0xf0, 0xf9, 0x43, 0xa2, 0x7d, 0x9a
558         },
559         G89_CFB,
560         { 
561             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
562         },
563         {
564             0x1c, 0x16, 0xa0, 0xe9, 0x63, 0x94, 0xfe, 0x38,
565             0x37, 0xa7, 0x9b, 0x70, 0x25, 0x2e, 0xd6, 0x00
566         }
567     },
568     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
569         4294967296ULL+16, 
570         { 0 },
571         "id-Gost28147-89-CryptoPro-A-ParamSet",
572         "test4Gcfb",
573         {
574             0xae, 0x57, 0xa2, 0xdd, 0xa4, 0xef, 0x4f, 0x96,
575             0xb8, 0x94, 0xa5, 0xd1, 0x1b, 0xc8, 0x9b, 0x42,
576             0xa5, 0x24, 0xcc, 0x89, 0x5c, 0xb8, 0x92, 0x52,
577             0xc1, 0x12, 0x6a, 0xb0, 0x9a, 0x26, 0xe8, 0x06
578         },
579         G89_CFB,
580         { 
581             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
582         },
583         {
584             0x2e, 0x62, 0xb0, 0x2e, 0xc7, 0x87, 0x4b, 0x29, 
585             0x33, 0x16, 0x6b, 0xb4, 0xd6, 0x61, 0x66, 0xd9
586         }
587     },
588     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
589         1037,
590         {
591             0x3d, 0x0b, 0x69, 0xf7, 0xa8, 0xe4, 0xfc, 0x99,
592             0x22, 0x2e, 0xee, 0xd1, 0x63, 0x12, 0xfe, 0xa8,
593             0x9d, 0xcb, 0x6c, 0x4d, 0x48, 0x8c, 0xe8, 0xbd,
594             0x8b, 0x60, 0xf1, 0xbf, 0x7b, 0xe3, 0x79, 0xd5,
595             0x2b, 0x25, 0x97, 0x13, 0xef, 0x35, 0xda, 0xf4,
596             0xbc, 0x77, 0xce, 0xea, 0xe9, 0x3f, 0xa4, 0xb6,
597             0x01, 0xd5, 0x73, 0x29, 0x58, 0xda, 0xd7, 0x67,
598             0x17, 0xac, 0xe4, 0x75, 0x2f, 0x57, 0x23, 0xac,
599             0x96, 0x21, 0xc7, 0x62, 0x2d, 0xf7, 0x32, 0xb5,
600             0x44, 0x5f, 0x72, 0xb1, 0x5f, 0xba, 0x1b, 0x1e,
601             0xdb, 0x4a, 0x09, 0x8c, 0x92, 0x61, 0xa2, 0xb0,
602             0x49, 0x68, 0xe5, 0xb3, 0xa2, 0x8f, 0x13, 0x4b,
603             0xf5, 0x4d, 0x84, 0xda, 0xab, 0xa0, 0xb6, 0xd1,
604             0x5a, 0x63, 0x19, 0xe8, 0xa2, 0x09, 0xf6, 0x76,
605             0x6f, 0x9b, 0x48, 0x0a, 0x15, 0x5d, 0xb7, 0x20,
606             0x21, 0x9a, 0x2e, 0xb9, 0x6d, 0xfa, 0x1e, 0xc2,
607             0x0e, 0xef, 0x15, 0xab, 0x59, 0x01, 0xfe, 0x43,
608             0x90, 0xf2, 0x62, 0xca, 0x4a, 0x9a, 0x48, 0x38,
609             0xab, 0x6f, 0x9d, 0x21, 0xb3, 0xad, 0xa7, 0x60,
610             0x46, 0xe3, 0xef, 0xd0, 0xe3, 0x1d, 0xc5, 0xe1,
611             0xb8, 0xa1, 0xe2, 0x99, 0x20, 0xc5, 0x76, 0xcc,
612             0xaa, 0x8a, 0xa9, 0x45, 0x55, 0xa0, 0x78, 0x00,
613             0x64, 0xde, 0xcf, 0x5b, 0xdf, 0x26, 0x48, 0xcd,
614             0xba, 0x8a, 0xb5, 0xfb, 0xfd, 0x4a, 0xd5, 0xc4,
615             0xe0, 0x43, 0xa6, 0x71, 0x90, 0xa4, 0x8b, 0xca,
616             0x2e, 0x88, 0x7b, 0xac, 0xb2, 0xdc, 0xf2, 0x01,
617             0xcb, 0xda, 0x6e, 0x91, 0x27, 0x28, 0x44, 0x88,
618             0x9a, 0xd2, 0x12, 0xf1, 0xa6, 0xf5, 0xb7, 0x61,
619             0xce, 0x79, 0x62, 0x52, 0x3c, 0xe6, 0x14, 0x73,
620             0xd1, 0x41, 0x92, 0x50, 0xbd, 0xdc, 0x3b, 0xd0,
621             0xa7, 0x11, 0x8c, 0x3a, 0xe4, 0x2d, 0xf2, 0x52,
622             0xd3, 0x2f, 0x7c, 0x8e, 0x54, 0x90, 0x4e, 0x23,
623             0xae, 0xb3, 0xa0, 0xf3, 0x25, 0x7e, 0x66, 0xaa,
624             0x0f, 0x6f, 0x81, 0x72, 0x77, 0xbb, 0xd3, 0x47,
625             0xe8, 0x05, 0xff, 0xe1, 0x5b, 0xc9, 0x37, 0x50,
626             0x33, 0x49, 0x17, 0xaf, 0xab, 0x1d, 0xe1, 0x15,
627             0xf2, 0xe5, 0x98, 0x5e, 0x2d, 0x05, 0x1f, 0x0d,
628             0x55, 0x97, 0xed, 0xff, 0x5e, 0xe0, 0x0f, 0xc3,
629             0x9c, 0xbd, 0x82, 0xc2, 0x06, 0xbe, 0x45, 0x66,
630             0xae, 0x33, 0xbe, 0x28, 0x48, 0xe9, 0x2d, 0x1a,
631             0xe6, 0x65, 0x8e, 0xdf, 0x76, 0x03, 0x73, 0x4b,
632             0xc0, 0x80, 0x71, 0xf9, 0xac, 0xba, 0xa0, 0xb0,
633             0x19, 0x1a, 0x0a, 0xd4, 0x35, 0x12, 0x88, 0x76,
634             0x05, 0x75, 0x8f, 0x7c, 0xb5, 0xf0, 0x19, 0x75,
635             0x6d, 0x05, 0xcb, 0x0d, 0xbc, 0x8d, 0xe9, 0xf0,
636             0xd4, 0xdb, 0x3c, 0x3c, 0x29, 0x8e, 0x2c, 0x32,
637             0x1d, 0xf7, 0xb6, 0x49, 0xcf, 0xdb, 0x63, 0xee,
638             0x3c, 0xfa, 0x33, 0x73, 0x6f, 0xe4, 0x97, 0x4e,
639             0x2f, 0xc9, 0x4c, 0x5c, 0x65, 0xfe, 0xea, 0xfb,
640             0xc6, 0xdd, 0xc1, 0x1c, 0x47, 0x3f, 0xf4, 0x50,
641             0x2f, 0xde, 0x1b, 0x5b, 0x0b, 0x16, 0xca, 0xb6,
642             0x46, 0x44, 0xf2, 0xc1, 0x0d, 0xa1, 0x1d, 0xa6,
643             0xdb, 0xf0, 0x3d, 0xb1, 0x6c, 0x05, 0x31, 0x85,
644             0x8e, 0x74, 0xae, 0xf2, 0x39, 0x26, 0xf7, 0xc1,
645             0xe7, 0x4c, 0xdd, 0x9d, 0x40, 0xb8, 0xf3, 0xc5,
646             0xc2, 0x16, 0x64, 0x6b, 0xaa, 0xdb, 0x4b, 0x82,
647             0x5c, 0xd3, 0x02, 0xd3, 0x8f, 0x26, 0x79, 0x8d,
648             0xb0, 0x78, 0x70, 0x19, 0x58, 0x0c, 0xb4, 0x31,
649             0x88, 0x44, 0x1c, 0x91, 0x6f, 0xf4, 0x52, 0x39,
650             0xa8, 0xf5, 0xc0, 0x1b, 0xfe, 0xf2, 0x0e, 0x4b,
651             0xac, 0x0a, 0xc2, 0x7e, 0x9c, 0x9b, 0xeb, 0x5d,
652             0x4e, 0x4f, 0x42, 0xd8, 0x71, 0x0a, 0x97, 0x27,
653             0x03, 0x14, 0x96, 0xa6, 0x3d, 0x04, 0xea, 0x9f,
654             0x14, 0x14, 0x27, 0x4c, 0xd9, 0xa2, 0x89, 0x5f,
655             0x65, 0x4a, 0xe1, 0x9d, 0x2c, 0xb8, 0xf8, 0xd4,
656             0x8f, 0x2a, 0x57, 0x36, 0xcc, 0x06, 0x9c, 0x2c,
657             0xc5, 0x13, 0x16, 0xdf, 0xfc, 0xae, 0x22, 0x16,
658             0xa8, 0x2b, 0x71, 0x6f, 0x1d, 0xb3, 0x47, 0x54,
659             0x3f, 0x2d, 0x0a, 0x68, 0x9f, 0x2e, 0xf6, 0x90,
660             0xd8, 0xa1, 0x21, 0x09, 0xd4, 0x97, 0xb9, 0x7b,
661             0x7f, 0x9b, 0x6a, 0xed, 0xd1, 0xf0, 0xe3, 0xb6,
662             0x28, 0xc7, 0x62, 0x82, 0x00, 0xc9, 0x38, 0xa1,
663             0x82, 0x78, 0xce, 0x87, 0xc8, 0x53, 0xac, 0x4f,
664             0x2e, 0x31, 0xb9, 0x50, 0x7f, 0x36, 0x00, 0x4a,
665             0x32, 0xe6, 0xd8, 0xbb, 0x59, 0x45, 0x0e, 0x91,
666             0x1b, 0x38, 0xa9, 0xbc, 0xb9, 0x5e, 0x6c, 0x6a,
667             0x9c, 0x03, 0x01, 0x1c, 0xde, 0xe8, 0x1f, 0x1e,
668             0xe3, 0xde, 0x25, 0xa2, 0x56, 0x79, 0xe1, 0xbd,
669             0x58, 0xc4, 0x93, 0xe6, 0xd0, 0x8a, 0x4d, 0x08,
670             0xab, 0xf7, 0xaa, 0xc3, 0x7d, 0xc1, 0xee, 0x68,
671             0x37, 0xbc, 0x78, 0x0b, 0x19, 0x68, 0x2b, 0x2b,
672             0x2e, 0x6d, 0xc4, 0x6f, 0xaa, 0x3b, 0xc6, 0x19,
673             0xcb, 0xf1, 0x58, 0xb9, 0x60, 0x85, 0x45, 0xae,
674             0x52, 0x97, 0xba, 0x24, 0x32, 0x13, 0x72, 0x16,
675             0x6e, 0x7b, 0xc1, 0x98, 0xac, 0xb1, 0xed, 0xb4,
676             0xcc, 0x6c, 0xcf, 0x45, 0xfc, 0x50, 0x89, 0x80,
677             0x8e, 0x7a, 0xa4, 0xd3, 0x64, 0x50, 0x63, 0x37,
678             0xc9, 0x6c, 0xf1, 0xc4, 0x3d, 0xfb, 0xde, 0x5a,
679             0x5c, 0xa8, 0x21, 0x35, 0xe6, 0x2e, 0x8c, 0x2a,
680             0x3c, 0x12, 0x17, 0x79, 0x9a, 0x0d, 0x2e, 0x79,
681             0xeb, 0x67, 0x1f, 0x2b, 0xf8, 0x6e, 0xca, 0xc1,
682             0xfa, 0x45, 0x18, 0x9e, 0xdf, 0x6a, 0xe6, 0xcb,
683             0xe9, 0x5c, 0xc3, 0x09, 0xaf, 0x93, 0x58, 0x13,
684             0xbf, 0x90, 0x84, 0x87, 0x75, 0xd6, 0x82, 0x28,
685             0x8d, 0xe7, 0x2f, 0xa3, 0xfb, 0x97, 0x74, 0x2a,
686             0x73, 0x04, 0x82, 0x06, 0x76, 0x69, 0xb1, 0x0b,
687             0x19, 0xfc, 0xae, 0xb3, 0xdd, 0x2a, 0xe5, 0xc1,
688             0x05, 0xd8, 0x80, 0x95, 0x22, 0x90, 0x71, 0xfc,
689             0xc2, 0x92, 0x42, 0xfd, 0xf1, 0x70, 0xb4, 0x68,
690             0x88, 0xa4, 0x9e, 0x0a, 0x24, 0x40, 0x13, 0xc8,
691             0xa2, 0x56, 0x4f, 0x39, 0xe6, 0x06, 0xf1, 0xdc,
692             0xf5, 0x13, 0x0e, 0xad, 0x9c, 0x8b, 0xaf, 0xe9,
693             0xe3, 0x88, 0x72, 0xff, 0xa0, 0x6d, 0xda, 0x08,
694             0x70, 0xb9, 0x2e, 0x83, 0xc5, 0xbb, 0x32, 0xa5,
695             0x74, 0xc7, 0xfb, 0x7b, 0x76, 0xaf, 0x02, 0xbb,
696             0x2b, 0xb8, 0x5e, 0x65, 0x02, 0xfe, 0x0e, 0xa0,
697             0x99, 0xce, 0x01, 0x3b, 0x35, 0xe1, 0xb0, 0x22,
698             0xe5, 0x94, 0xbd, 0xdd, 0x8e, 0xbb, 0xf6, 0x75,
699             0xbf, 0xbf, 0xee, 0x7a, 0xb1, 0x58, 0xb4, 0x81,
700             0xb8, 0x39, 0x3e, 0xb6, 0x1e, 0xde, 0xda, 0x1b,
701             0xd5, 0xf7, 0xdd, 0x7d, 0x65, 0x9c, 0xaa, 0x56,
702             0x93, 0xb8, 0xaf, 0x48, 0x53, 0xc7, 0x22, 0xe4,
703             0x1c, 0xdf, 0xe9, 0x79, 0xb4, 0x20, 0x89, 0xcc,
704             0x2a, 0x79, 0x2c, 0x09, 0xbe, 0x78, 0xcf, 0xcc,
705             0xf2, 0x90, 0xd6, 0x65, 0xc5, 0x29, 0xfc, 0xda,
706             0x69, 0xfc, 0xc0, 0xd6, 0x70, 0x99, 0x61, 0x3f,
707             0x60, 0x02, 0xd8, 0x12, 0x22, 0xc8, 0x34, 0xc6,
708             0x3b, 0xb3, 0xc2, 0x33, 0xa1, 0x5c, 0x8f, 0x4c,
709             0xd1, 0x52, 0x72, 0xf2, 0x42, 0x05, 0x8e, 0x18,
710             0x1f, 0x16, 0xda, 0xb8, 0x53, 0xa1, 0x5f, 0x01,
711             0x32, 0x1b, 0x90, 0xb3, 0x53, 0x9b, 0xd0, 0x85,
712             0x61, 0x2d, 0x17, 0xed, 0x0a, 0xa4, 0xa5, 0x27,
713             0x09, 0x75, 0x7c, 0xbc, 0x30, 0xf7, 0x5e, 0x59,
714             0x9a, 0x07, 0x96, 0x84, 0x28, 0x86, 0x4b, 0xa7,
715             0x22, 0x35, 0x28, 0xc7, 0xed, 0x0d, 0xc3, 0xce,
716             0x98, 0xcc, 0x2d, 0xec, 0xd4, 0x98, 0x09, 0x8e,
717             0x52, 0x5f, 0x2b, 0x9a, 0x13, 0xbe, 0x99, 0x16,
718             0x73, 0xd1, 0x1f, 0x81, 0xe5, 0xa2, 0x08, 0x78,
719             0xcb, 0x0c, 0x20, 0xd4, 0xa5, 0xea, 0x4b, 0x5b,
720             0x95, 0x5a, 0x92, 0x9a, 0x52
721         },
722         "id-Gost28147-89-CryptoPro-A-ParamSet",
723         "testcnt2",
724         {
725             0x1b, 0x5d, 0xdb, 0x77, 0xcf, 0xf9, 0xec, 0x95,
726             0x5e, 0xcc, 0x67, 0x9f, 0x5d, 0x28, 0xad, 0x4a,
727             0x27, 0xf4, 0x32, 0xc6, 0xb2, 0xcb, 0xb1, 0x45,
728             0x6a, 0x88, 0x14, 0x0c, 0x9b, 0x9b, 0x5f, 0x48
729         },
730         G89_CNT,
731         {
732             0x71, 0x58, 0x8c, 0xe1, 0x55, 0xf4, 0xf6, 0xb3
733         },
734         {
735             0x8e, 0xcd, 0x8f, 0xc8, 0xac, 0xe1, 0x15, 0x48,
736             0x2d, 0xae, 0x24, 0x8a, 0xc7, 0xfb, 0xba, 0x0f,
737             0x1d, 0x8a, 0x95, 0xa2, 0x43, 0xef, 0xcb, 0xdc,
738             0x59, 0x57, 0xa7, 0xc7, 0x0e, 0xe3, 0xe2, 0xb9,
739             0x0d, 0x86, 0x29, 0x62, 0xcb, 0x83, 0x4d, 0x07,
740             0x0c, 0x40, 0xd4, 0x7b, 0x2e, 0xca, 0xba, 0xbf,
741             0x4a, 0x60, 0x3b, 0x31, 0x98, 0xc8, 0x88, 0x47,
742             0xd9, 0x82, 0xab, 0xfc, 0x8f, 0x48, 0xe2, 0x46,
743             0xab, 0xd3, 0xa1, 0xab, 0x8a, 0x05, 0x22, 0x8c,
744             0xf4, 0xec, 0x9a, 0x1e, 0x76, 0xab, 0x1a, 0x60,
745             0xd9, 0x25, 0x6b, 0xb8, 0x56, 0xe5, 0xb2, 0xea,
746             0x10, 0xf3, 0x62, 0x04, 0x32, 0x5e, 0xaa, 0x3b,
747             0x7b, 0x57, 0xbc, 0x3b, 0x8b, 0x43, 0x47, 0xf2,
748             0xd5, 0x03, 0x7e, 0x51, 0x01, 0xff, 0x77, 0x28,
749             0xca, 0x90, 0xa3, 0xfe, 0x7e, 0x2e, 0x70, 0x16,
750             0x75, 0x18, 0x44, 0xf0, 0x1b, 0x85, 0x05, 0xea,
751             0xe3, 0x21, 0xf7, 0x26, 0x86, 0x76, 0x3c, 0x67,
752             0x9d, 0xfc, 0xbc, 0x10, 0x7f, 0x77, 0xe4, 0xed,
753             0xd3, 0x12, 0xf8, 0x83, 0x00, 0x1f, 0x4b, 0x92,
754             0x95, 0x92, 0x5c, 0xf3, 0x5a, 0xf3, 0xb7, 0xd0,
755             0xa9, 0x5f, 0xf2, 0x18, 0xc4, 0x66, 0x62, 0xc1,
756             0x84, 0x0e, 0x66, 0xe8, 0x80, 0x7d, 0x1f, 0xf0,
757             0xba, 0x01, 0x9b, 0x71, 0xae, 0x93, 0xcc, 0x27,
758             0x54, 0x34, 0x9a, 0xbd, 0xca, 0xee, 0x52, 0x09,
759             0x92, 0x9d, 0xb0, 0xd5, 0xd9, 0xba, 0x2f, 0xb9,
760             0x96, 0xdc, 0xfa, 0xbd, 0xce, 0xea, 0x1a, 0x7b,
761             0x9a, 0x1d, 0x13, 0xa7, 0x11, 0xe2, 0x9a, 0x64,
762             0xf6, 0xd3, 0xee, 0xc6, 0x33, 0xb7, 0x6e, 0xef,
763             0x25, 0x9e, 0x1e, 0x7c, 0xe3, 0x1f, 0x2c, 0x6e,
764             0xa9, 0xc0, 0xf8, 0xc1, 0xbf, 0x3b, 0xf8, 0x34,
765             0x03, 0x9b, 0xa1, 0x40, 0x5b, 0x0c, 0x3c, 0x09,
766             0x66, 0x9d, 0x63, 0xe2, 0xe2, 0x04, 0x8f, 0x06,
767             0x84, 0x74, 0x68, 0xb2, 0x5c, 0x3b, 0x4c, 0xad,
768             0x0b, 0x3f, 0x03, 0xb3, 0x07, 0x8a, 0x64, 0xa7,
769             0x36, 0x56, 0x26, 0x39, 0x66, 0xda, 0xe9, 0x6d,
770             0x1b, 0xd5, 0x88, 0xe8, 0x5c, 0xaf, 0x5a, 0x4c,
771             0x49, 0xf7, 0xf5, 0xb7, 0x78, 0xf0, 0xde, 0xec,
772             0xcd, 0x16, 0x23, 0x9e, 0x8c, 0x13, 0xbe, 0x6b,
773             0x6f, 0x9b, 0x07, 0xe5, 0xbb, 0xcc, 0x3a, 0x1b,
774             0x6f, 0x43, 0xdf, 0xff, 0x46, 0x2a, 0xae, 0x47,
775             0x19, 0x18, 0x9a, 0x25, 0x09, 0xc9, 0x24, 0x40,
776             0x0c, 0x4b, 0xa7, 0xda, 0x5e, 0x0d, 0xee, 0xfa,
777             0x62, 0x45, 0x8e, 0xcc, 0x2f, 0x23, 0x08, 0x1d,
778             0x92, 0xf0, 0xfe, 0x82, 0x0f, 0xd7, 0x11, 0x60,
779             0x7e, 0x0b, 0x0b, 0x75, 0xf4, 0xf5, 0x3b, 0xc0,
780             0xa4, 0xe8, 0x72, 0xa5, 0xb6, 0xfa, 0x5a, 0xad,
781             0x5a, 0x4f, 0x39, 0xb5, 0xa2, 0x12, 0x96, 0x0a,
782             0x32, 0x84, 0xb2, 0xa1, 0x06, 0x68, 0x56, 0x57,
783             0x97, 0xa3, 0x7b, 0x22, 0x61, 0x76, 0x5d, 0x30,
784             0x1a, 0x31, 0xab, 0x99, 0x06, 0xc5, 0x1a, 0x96,
785             0xcf, 0xcf, 0x14, 0xff, 0xb2, 0xc4, 0xcc, 0x2b,
786             0xbf, 0x0c, 0x9d, 0x91, 0x8f, 0x79, 0x5b, 0xbc,
787             0xa9, 0x6b, 0x91, 0x6a, 0xb4, 0x93, 0x5c, 0x7b,
788             0x5d, 0xc2, 0x8a, 0x75, 0xc0, 0xc1, 0x08, 0xfa,
789             0x99, 0xf9, 0x4d, 0x5e, 0x0c, 0x06, 0x64, 0x60,
790             0xa9, 0x01, 0x4a, 0x34, 0x0f, 0x33, 0x84, 0x95,
791             0x69, 0x30, 0xc1, 0x1c, 0x36, 0xf8, 0xfc, 0x30,
792             0x23, 0xb2, 0x71, 0xe5, 0x52, 0x4d, 0x12, 0x1a,
793             0xc9, 0xbe, 0xee, 0xc9, 0xcb, 0x01, 0x85, 0xf3,
794             0xdb, 0x30, 0xf9, 0x41, 0xa9, 0x40, 0xb0, 0x06,
795             0x29, 0x77, 0xcd, 0xc5, 0xec, 0x58, 0x02, 0x48,
796             0x83, 0x53, 0x44, 0x6a, 0xd2, 0xca, 0x05, 0xd8,
797             0x5a, 0x08, 0xeb, 0xa9, 0xf4, 0xe6, 0xc7, 0x9d,
798             0xd5, 0x7b, 0x74, 0x0b, 0x31, 0xb7, 0xa5, 0x57,
799             0x7c, 0x7a, 0xfd, 0x1a, 0x0e, 0xd7, 0x97, 0x41,
800             0xbf, 0xdd, 0xc6, 0x19, 0x6c, 0x77, 0x8c, 0x18,
801             0x52, 0x57, 0x83, 0xba, 0x71, 0x25, 0xee, 0x39,
802             0xbb, 0xe2, 0x43, 0xa0, 0x14, 0xdc, 0x0e, 0x84,
803             0xb4, 0x2b, 0xde, 0x3e, 0xe5, 0x36, 0xb7, 0xa2,
804             0x92, 0x98, 0x05, 0xb8, 0x96, 0xe5, 0xd0, 0x8c,
805             0x08, 0x93, 0x35, 0xc2, 0x81, 0xe0, 0xfc, 0x59,
806             0x71, 0xe2, 0x44, 0x49, 0x5d, 0xda, 0xfb, 0x9c,
807             0xaa, 0x70, 0x9f, 0x43, 0xa8, 0xa5, 0xd9, 0x67,
808             0xd9, 0x8f, 0xa3, 0x1e, 0xbe, 0x0e, 0xec, 0xdf,
809             0x12, 0x2b, 0x6a, 0xe7, 0x1c, 0x12, 0x17, 0xe7,
810             0xc4, 0x6d, 0x50, 0xc9, 0x52, 0x7a, 0xd5, 0xe8,
811             0x7f, 0xbc, 0x07, 0x15, 0xac, 0xdb, 0x93, 0x66,
812             0xb1, 0xf0, 0xa7, 0x7b, 0x2f, 0xe9, 0xec, 0xd0,
813             0x47, 0x69, 0x59, 0x87, 0xf1, 0x4c, 0x3e, 0x4b,
814             0x9b, 0x11, 0x79, 0x13, 0xe4, 0x96, 0xf6, 0x56,
815             0x04, 0x6e, 0x0b, 0x33, 0xfc, 0x40, 0xf6, 0xc7,
816             0xc1, 0x43, 0xb1, 0xbf, 0x0e, 0xb3, 0x87, 0xfd,
817             0x0b, 0x1c, 0x63, 0x46, 0x3a, 0xd3, 0xa0, 0x17,
818             0x59, 0x25, 0x94, 0x6c, 0x9c, 0x3d, 0x0c, 0x81,
819             0xce, 0x82, 0x72, 0x42, 0x28, 0xf9, 0x37, 0x6a,
820             0x6d, 0xe4, 0x12, 0xf4, 0x21, 0xaa, 0xf7, 0xfe,
821             0x27, 0x55, 0x40, 0x1a, 0x14, 0xc3, 0x39, 0x5b,
822             0xbf, 0x63, 0xc2, 0x5f, 0x10, 0x1f, 0x14, 0x25,
823             0xd0, 0xce, 0xf3, 0x14, 0x48, 0x13, 0xa5, 0x0b,
824             0x4d, 0x38, 0xcf, 0x0d, 0x34, 0xc0, 0x0a, 0x11,
825             0xb4, 0xb5, 0x72, 0xc8, 0x4b, 0xc2, 0x6f, 0xe7,
826             0x9d, 0x93, 0xf7, 0xdf, 0xb8, 0x43, 0x72, 0x7e,
827             0xda, 0x3e, 0x20, 0x1f, 0xbc, 0x21, 0x2a, 0xce,
828             0x00, 0xfa, 0x96, 0x9f, 0x3d, 0xe5, 0x88, 0x96,
829             0xef, 0x29, 0x84, 0xdf, 0x6c, 0x1c, 0x96, 0xd8,
830             0x58, 0x47, 0xaa, 0x92, 0xf3, 0x07, 0xe5, 0xfb,
831             0xaf, 0xea, 0x95, 0x7e, 0x0b, 0x71, 0xcd, 0x81,
832             0x0f, 0xb7, 0x0a, 0x59, 0x8f, 0x31, 0x4d, 0xd1,
833             0xc3, 0xf3, 0x2f, 0x70, 0x5c, 0x59, 0x18, 0x97,
834             0xaf, 0x77, 0x95, 0x5e, 0xaf, 0x40, 0x06, 0x12,
835             0x81, 0x61, 0x86, 0x08, 0x4e, 0xbc, 0x89, 0x46,
836             0x07, 0x2e, 0x5b, 0x10, 0xaa, 0x12, 0xf0, 0xa7,
837             0x84, 0xe2, 0x9a, 0x08, 0xf1, 0xde, 0x59, 0xe3,
838             0x0e, 0x47, 0x4b, 0xff, 0xc3, 0xc9, 0x18, 0xaf,
839             0x95, 0x9c, 0x67, 0x2a, 0xde, 0x8a, 0x7a, 0x99,
840             0x04, 0xc4, 0xb8, 0x97, 0x4c, 0x04, 0x29, 0x71,
841             0x05, 0xda, 0xb3, 0xd6, 0xdb, 0x6c, 0x71, 0xe6,
842             0xe8, 0x03, 0xbf, 0x94, 0x7d, 0xde, 0x3d, 0xc8,
843             0x44, 0xfa, 0x7d, 0x62, 0xb4, 0x36, 0x03, 0xee,
844             0x36, 0x52, 0x64, 0xb4, 0x85, 0x6d, 0xd5, 0x78,
845             0xf0, 0x6f, 0x67, 0x2d, 0x0e, 0xe0, 0x2c, 0x88,
846             0x9b, 0x55, 0x19, 0x29, 0x40, 0xf6, 0x8c, 0x12,
847             0xbb, 0x2c, 0x83, 0x96, 0x40, 0xc0, 0x36, 0xf5,
848             0x77, 0xff, 0x70, 0x8c, 0x75, 0x92, 0x0b, 0xad,
849             0x05, 0x9b, 0x7e, 0xa2, 0xfc, 0xa9, 0xd1, 0x64,
850             0x76, 0x82, 0x13, 0xba, 0x22, 0x5e, 0x33, 0x0e,
851             0x26, 0x70, 0xa9, 0xbe, 0x74, 0x28, 0xf5, 0xe2,
852             0xc4, 0x96, 0xee, 0x3a, 0xbc, 0x97, 0xa6, 0x2c,
853             0x2a, 0xe0, 0x64, 0x8d, 0x35, 0xc6, 0x1a, 0xca,
854             0xf4, 0x92, 0xfa, 0xc3, 0xf1, 0x1f, 0x98, 0xe4,
855             0x43, 0x88, 0x69, 0x3a, 0x09, 0xbf, 0x63, 0xe5,
856             0x96, 0x29, 0x0b, 0x9b, 0x62, 0x23, 0x14, 0x8a,
857             0x95, 0xe4, 0x1c, 0x5c, 0x0a, 0xa9, 0xc5, 0xb9,
858             0x6f, 0x4f, 0x2b, 0x25, 0x6f, 0x74, 0x1e, 0x18,
859             0xd5, 0xfe, 0x27, 0x7d, 0x3f, 0x6e, 0x55, 0x2c,
860             0x67, 0xe6, 0xde, 0xb5, 0xcc, 0xc0, 0x2d, 0xff,
861             0xc4, 0xe4, 0x06, 0x21, 0xa5, 0xc8, 0xd3, 0xd6,
862             0x6c, 0xa1, 0xc3, 0xfb, 0x88, 0x92, 0xb1, 0x1d,
863             0x90, 0xe1, 0x35, 0x05, 0x9b, 0x29, 0x6d, 0xba,
864             0xf1, 0xf4, 0x1e, 0x23, 0x2e
865         }
866     },
867     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
868         5242880+8, 
869         { 0 },
870         "id-Gost28147-89-CryptoPro-A-ParamSet",
871         "test5Mcnt",
872         {
873             0x07, 0x52, 0x65, 0xe7, 0xca, 0xa3, 0xca, 0x45,
874             0xcf, 0x3a, 0x05, 0x1d, 0x38, 0x03, 0x53, 0x0c,
875             0x22, 0x31, 0xba, 0x99, 0x4f, 0x9b, 0x6a, 0x1b,
876             0x7e, 0x09, 0x9d, 0x4e, 0xb5, 0xc9, 0x84, 0x2e
877         },
878         G89_CNT,
879         { 
880             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
881         },
882         {
883             0x3d, 0x05, 0x07, 0x57, 0xc0, 0x75, 0x89, 0x97,
884             0xd6, 0x94, 0x49, 0x11, 0x1d, 0xd0, 0x91, 0xee
885         }
886     },
887     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
888         4294967296ULL+16, 
889         { 0 },
890         "id-Gost28147-89-CryptoPro-A-ParamSet",
891         "test4Gcnt",
892         {
893             0x75, 0xa3, 0x3c, 0xae, 0x03, 0x6b, 0x10, 0xdb,
894             0xc1, 0x56, 0x50, 0x89, 0x03, 0xd2, 0x9f, 0x91,
895             0xee, 0xe8, 0x64, 0x1d, 0x43, 0xf2, 0x4e, 0xf8,
896             0xf2, 0x6c, 0xed, 0xda, 0x8f, 0xe4, 0x88, 0xe9
897         },
898         G89_CNT,
899         { 
900             0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
901         },
902         {
903             0xfa, 0x6c, 0x96, 0x78, 0xe2, 0xf8, 0xdd, 0xaa, 
904             0x67, 0x5a, 0xc9, 0x5d, 0x57, 0xf1, 0xbd, 0x99
905         }
906     },
907     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
908         1035,
909         {
910             0xd6, 0xcf, 0x31, 0x96, 0x9c, 0xa1, 0xfb, 0xd6,
911             0x8d, 0xa3, 0xdd, 0x01, 0xd9, 0x88, 0xc0, 0x2f,
912             0xbc, 0x46, 0xc7, 0x3a, 0xe4, 0x21, 0x86, 0x96,
913             0x8d, 0xe2, 0xca, 0xb6, 0x37, 0xa2, 0xe1, 0xa8,
914             0x7e, 0xa7, 0x79, 0x2e, 0xa4, 0x56, 0x75, 0x7f,
915             0x3e, 0x55, 0x8b, 0x43, 0xae, 0x65, 0xdf, 0xaa,
916             0x42, 0xb6, 0x00, 0xa6, 0x61, 0x03, 0x0d, 0xd3,
917             0x41, 0x02, 0x27, 0x23, 0x95, 0x79, 0x9b, 0x34,
918             0x81, 0xa9, 0x86, 0xb5, 0xa7, 0x90, 0xe2, 0xae,
919             0xc4, 0x2f, 0xc3, 0x8e, 0x32, 0x56, 0x13, 0xfa,
920             0x4d, 0x4e, 0x9f, 0x15, 0x75, 0x7e, 0x74, 0xdc,
921             0x32, 0x2d, 0xee, 0x4d, 0x67, 0x70, 0x9f, 0x62,
922             0xb9, 0xc4, 0xdb, 0x24, 0x84, 0xcc, 0x16, 0x7b,
923             0xda, 0x22, 0xf7, 0xc5, 0xf3, 0x93, 0x35, 0x73,
924             0xc6, 0x03, 0x1c, 0x77, 0xa5, 0xf2, 0x76, 0x56,
925             0xb4, 0x95, 0xd4, 0x7e, 0x0d, 0x20, 0xc6, 0x6e,
926             0xee, 0x8f, 0x25, 0x48, 0xff, 0x7e, 0x01, 0x3a,
927             0xb4, 0x1f, 0xaa, 0x35, 0xc0, 0x33, 0x58, 0x9c,
928             0xb5, 0xba, 0x65, 0x4b, 0xd3, 0x51, 0x14, 0xec,
929             0x61, 0xce, 0xe4, 0xba, 0x49, 0xba, 0x39, 0x32,
930             0xab, 0xce, 0x81, 0x72, 0xce, 0xab, 0xed, 0xd4,
931             0xd2, 0x19, 0x87, 0x85, 0x92, 0xfa, 0x64, 0x34,
932             0xd8, 0x86, 0xf4, 0x8a, 0x08, 0x3c, 0xde, 0xee,
933             0x97, 0x92, 0x92, 0x69, 0xba, 0x9b, 0x5f, 0x7a,
934             0x03, 0xc1, 0x5d, 0x43, 0x02, 0x8c, 0xbe, 0xd2,
935             0x46, 0x72, 0x81, 0x40, 0x7d, 0x68, 0x98, 0x45,
936             0x0b, 0x54, 0x27, 0x1c, 0xaf, 0x80, 0x42, 0xe4,
937             0xd5, 0xd4, 0xe4, 0xa2, 0x98, 0x07, 0x8f, 0x03,
938             0xf5, 0x2c, 0x8c, 0x88, 0xca, 0x5a, 0xde, 0xe4,
939             0x9f, 0xb1, 0x5f, 0x82, 0xff, 0x20, 0x67, 0x52,
940             0x85, 0x84, 0x4f, 0xc8, 0xfe, 0xa7, 0x9e, 0xae,
941             0x1c, 0xfa, 0xb8, 0x75, 0xd3, 0xf7, 0x9f, 0x0d,
942             0xda, 0x2d, 0xe6, 0xcc, 0x86, 0x6b, 0xa4, 0x14,
943             0x65, 0xc3, 0xf9, 0x15, 0xbc, 0x87, 0xf5, 0xae,
944             0x8c, 0x10, 0xd4, 0xce, 0x5b, 0x9c, 0xe2, 0xdd,
945             0x42, 0x03, 0x09, 0x87, 0x47, 0xed, 0x5d, 0xd0,
946             0x7a, 0x69, 0x4c, 0xfa, 0x43, 0x7d, 0xbf, 0x07,
947             0x85, 0x6a, 0xee, 0x68, 0xe6, 0x7a, 0x57, 0xb2,
948             0x20, 0x8d, 0x80, 0xf2, 0x91, 0x6f, 0x5c, 0x07,
949             0x8c, 0xe4, 0x6a, 0x49, 0x90, 0x85, 0x8b, 0x77,
950             0x29, 0x56, 0x1c, 0x5e, 0xa9, 0x3f, 0xab, 0x8b,
951             0x79, 0xa3, 0x6f, 0x6b, 0x34, 0xcb, 0x61, 0xf6,
952             0xe6, 0x92, 0xd1, 0x48, 0x9e, 0x11, 0xa2, 0x82,
953             0xc0, 0x4e, 0x23, 0xd2, 0x15, 0x0d, 0x8d, 0xff,
954             0xfa, 0x17, 0x9d, 0x81, 0xb8, 0xbc, 0xd7, 0x5b,
955             0x08, 0x81, 0x20, 0x40, 0xc0, 0x3c, 0x06, 0x8b,
956             0x1a, 0x88, 0x0b, 0x4b, 0x7b, 0x31, 0xf5, 0xd4,
957             0x4e, 0x09, 0xd1, 0x4d, 0x0d, 0x7f, 0x45, 0xd1,
958             0x09, 0x35, 0xba, 0xce, 0x65, 0xdd, 0xf2, 0xb8,
959             0xfb, 0x7a, 0xbc, 0xc4, 0x4b, 0xc8, 0x75, 0xda,
960             0x6b, 0xce, 0x3d, 0xe8, 0x94, 0xcc, 0x23, 0x6f,
961             0xb0, 0x3b, 0x4f, 0x7d, 0x07, 0xb9, 0x0f, 0x62,
962             0x92, 0x7e, 0xda, 0x70, 0x50, 0xce, 0xd3, 0x28,
963             0x12, 0x11, 0x00, 0xeb, 0x8d, 0x63, 0x70, 0x78,
964             0xa8, 0x7b, 0x76, 0xab, 0xc6, 0x40, 0xc0, 0x4e,
965             0x80, 0xdd, 0xf0, 0xfe, 0x83, 0x72, 0x56, 0x4c,
966             0x09, 0x4c, 0xf1, 0x72, 0x72, 0x86, 0x26, 0x31,
967             0xc3, 0xc2, 0xdc, 0x8e, 0xc7, 0xf4, 0x35, 0xec,
968             0x17, 0x06, 0x63, 0x47, 0x49, 0x88, 0x47, 0xaf,
969             0xb3, 0x38, 0x4f, 0x7e, 0x44, 0x95, 0xb5, 0xbb,
970             0x1d, 0xbd, 0x5a, 0x91, 0x5b, 0xd0, 0x1a, 0xdf,
971             0x0d, 0x0b, 0x50, 0xd8, 0xe2, 0x0e, 0xc5, 0x00,
972             0x2d, 0x5b, 0x29, 0x19, 0xaa, 0x2b, 0x64, 0xc5,
973             0x40, 0x31, 0x48, 0x11, 0xbc, 0x04, 0xd1, 0xcf,
974             0x6d, 0xf9, 0xa5, 0x2f, 0x4a, 0xc9, 0x82, 0xfa,
975             0x59, 0xe1, 0xfc, 0xab, 0x1c, 0x33, 0x26, 0x0a,
976             0x5f, 0xef, 0xf2, 0x06, 0xd8, 0xd3, 0x7e, 0x16,
977             0x58, 0x16, 0x78, 0x73, 0xae, 0xba, 0xeb, 0xe5,
978             0x3d, 0xb2, 0x0a, 0xb3, 0x32, 0x2d, 0x14, 0xa4,
979             0xfa, 0x3f, 0x1f, 0x43, 0xf9, 0x7b, 0xa9, 0x43,
980             0x98, 0x18, 0x94, 0x07, 0x07, 0xe5, 0x19, 0x34,
981             0xa8, 0x16, 0x5f, 0x71, 0x67, 0xaa, 0x29, 0xe5,
982             0xfa, 0xf0, 0x83, 0x06, 0x1d, 0x9d, 0xfc, 0xfe,
983             0xfe, 0x8c, 0xb5, 0xb2, 0xa9, 0xe7, 0xa0, 0x40,
984             0x60, 0xb6, 0x71, 0x9e, 0xab, 0x5b, 0x83, 0xb9,
985             0x0c, 0x2b, 0x58, 0x23, 0x80, 0x09, 0x9e, 0x5d,
986             0x94, 0x7d, 0x40, 0x76, 0xa9, 0x16, 0x96, 0x9e,
987             0x83, 0xe0, 0x0d, 0xec, 0xa0, 0xec, 0x76, 0x2a,
988             0xb7, 0xa0, 0xff, 0xb8, 0x50, 0x4c, 0x5b, 0xc6,
989             0x8b, 0x0a, 0x65, 0x2e, 0xfe, 0xb4, 0x40, 0x9a,
990             0x01, 0xd8, 0xc6, 0xa3, 0xab, 0x99, 0xa2, 0xc5,
991             0x0c, 0x08, 0xc4, 0xb7, 0xee, 0x4d, 0x1d, 0xc4,
992             0x08, 0x15, 0xd0, 0xdb, 0xaa, 0x63, 0x4f, 0x31,
993             0xeb, 0x14, 0x97, 0x43, 0xbd, 0xc1, 0x94, 0x08,
994             0xe6, 0xde, 0x43, 0x9f, 0x95, 0x0b, 0x96, 0x7e,
995             0x7f, 0x3c, 0x68, 0xba, 0x6f, 0xc4, 0xc9, 0x35,
996             0x2b, 0xc4, 0x0e, 0xda, 0x1f, 0x91, 0x68, 0x64,
997             0x63, 0x34, 0x73, 0xbe, 0x57, 0x75, 0xb9, 0xed,
998             0xf7, 0x2d, 0x3b, 0x05, 0x21, 0x93, 0x28, 0x48,
999             0x96, 0x95, 0x97, 0xa0, 0xd2, 0x7d, 0x78, 0xbb,
1000             0x6a, 0x49, 0x8f, 0x76, 0x55, 0x74, 0x63, 0xb9,
1001             0xc5, 0x36, 0x12, 0x25, 0xbf, 0x03, 0x82, 0x8f,
1002             0xf0, 0xf6, 0x80, 0xbb, 0x33, 0xb4, 0xf4, 0x17,
1003             0x27, 0x1c, 0xf3, 0x4c, 0x10, 0xa3, 0xe4, 0xd1,
1004             0x55, 0xd9, 0x68, 0x21, 0x4e, 0x5a, 0x83, 0x67,
1005             0xbf, 0xf8, 0x3c, 0x7d, 0x4e, 0x62, 0xd3, 0x28,
1006             0xa7, 0x26, 0x6f, 0xe9, 0xee, 0xc2, 0x0b, 0x2d,
1007             0x03, 0x84, 0xb1, 0xff, 0xd6, 0x68, 0x1f, 0xb6,
1008             0xf2, 0xe4, 0x0f, 0xda, 0x2d, 0xee, 0x5f, 0x6e,
1009             0x21, 0xc8, 0xe1, 0xfc, 0xad, 0x6b, 0x0e, 0x04,
1010             0x7d, 0xaf, 0xc2, 0x3b, 0xa5, 0x68, 0x9b, 0x0c,
1011             0xf3, 0x56, 0xf3, 0xda, 0x8d, 0xc8, 0x7d, 0x39,
1012             0xdc, 0xd5, 0x99, 0xc6, 0x01, 0x10, 0xce, 0x42,
1013             0x1b, 0xac, 0x48, 0xdc, 0x97, 0x78, 0x0a, 0xec,
1014             0xb3, 0x8f, 0x47, 0x35, 0xa3, 0x6a, 0x64, 0xb2,
1015             0x8e, 0x63, 0x69, 0x22, 0x66, 0xae, 0x2e, 0xe0,
1016             0x88, 0xf9, 0x40, 0x3c, 0xc9, 0xa2, 0x57, 0x61,
1017             0xf6, 0xad, 0xf0, 0xdc, 0x90, 0x56, 0x3f, 0x06,
1018             0x9b, 0x7d, 0xbd, 0xc2, 0x81, 0x02, 0xab, 0xb8,
1019             0x15, 0x09, 0x88, 0x4a, 0xff, 0x2f, 0x31, 0xbf,
1020             0x5e, 0xfa, 0x6a, 0x7e, 0xf6, 0xc5, 0xa7, 0xf7,
1021             0xd5, 0xab, 0x55, 0xac, 0xae, 0x0d, 0x8c, 0x8d,
1022             0x7f, 0x4b, 0x25, 0xbb, 0x32, 0xff, 0x11, 0x33,
1023             0x2e, 0x37, 0x37, 0x69, 0x96, 0x15, 0x17, 0xb1,
1024             0x17, 0x49, 0xe0, 0x9a, 0x9c, 0xd9, 0x5b, 0x8d,
1025             0x58, 0xa3, 0x1d, 0x92, 0x87, 0xf8, 0x80, 0xb9,
1026             0xbd, 0x5a, 0xec, 0x40, 0xe1, 0x00, 0x33, 0x60,
1027             0xe4, 0x86, 0x16, 0x6d, 0x61, 0x81, 0xf2, 0x28,
1028             0x6a, 0xa7, 0xce, 0x3f, 0x95, 0xae, 0x43, 0xca,
1029             0xe1, 0x3f, 0x81, 0x74, 0x7e, 0x1c, 0x47, 0x17,
1030             0x95, 0xc6, 0x60, 0xda, 0x74, 0x77, 0xd9, 0x9f,
1031             0xfa, 0x92, 0xb4, 0xbe, 0xe1, 0x23, 0x98, 0x18,
1032             0x95, 0x63, 0x03, 0x13, 0x4c, 0x1a, 0x2d, 0x41,
1033             0xcd, 0xe4, 0x84, 0xf7, 0xe6, 0x38, 0xef, 0xff,
1034             0x95, 0xb2, 0xe8, 0x7c, 0x8f, 0x58, 0xb5, 0xb5,
1035             0xed, 0x27, 0x7f, 0x3c, 0x18, 0xab, 0xbe, 0x7f,
1036             0x4f, 0xe2, 0x35, 0x15, 0x71, 0xb7, 0x6f, 0x85,
1037             0x38, 0x9b, 0x88, 0xf6, 0x9c, 0x8d, 0x43, 0xb5,
1038             0x58, 0x9e, 0xf2, 0xd1, 0x96, 0xbe, 0xb7, 0xad,
1039             0x1a, 0xa0, 0x98
1040         },
1041         "id-Gost28147-89-CryptoPro-A-ParamSet",
1042         "testimit2",
1043         {
1044             0x80, 0xd9, 0xa0, 0xdc, 0x21, 0xf9, 0x30, 0x40,
1045             0x75, 0xfe, 0x49, 0x1b, 0x9e, 0x71, 0x90, 0x91,
1046             0x78, 0x88, 0x21, 0x60, 0x39, 0xe7, 0xc9, 0x2b,
1047             0xfb, 0x55, 0x1d, 0xf4, 0xdd, 0x2b, 0x0a, 0x01
1048         },
1049         G89_IMIT,
1050         { 0 },
1051         {
1052             0x90, 0xf2, 0x11, 0x9a
1053         }
1054     },
1055     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1056         10,
1057         {
1058             0x1d, 0xeb, 0xe6, 0x79, 0x0a, 0x59, 0x00, 0xe6,
1059             0x8e, 0x5c
1060         },
1061         "id-Gost28147-89-CryptoPro-A-ParamSet",
1062         "testimit3",
1063         {
1064             0xa9, 0xb6, 0x37, 0xcc, 0x6d, 0x9b, 0x2f, 0x25,
1065             0xb0, 0xdf, 0x47, 0x04, 0x50, 0x68, 0xb0, 0x27,
1066             0x41, 0x27, 0x58, 0x6a, 0xbd, 0x0a, 0x6e, 0x50,
1067             0x2f, 0xc6, 0xfc, 0xc0, 0x3e, 0x29, 0x42, 0xa5
1068         },
1069         G89_IMIT,
1070         { 0 },
1071         {
1072             0x31, 0x7c, 0x16, 0xe4
1073         }
1074     },
1075     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1076         6,
1077         {
1078             0xef, 0x06, 0x8f, 0x14, 0xc9, 0x04
1079         },
1080         "id-Gost28147-89-CryptoPro-A-ParamSet",
1081         "testimit4",
1082         {
1083             0xb0, 0x6c, 0x48, 0x23, 0x0a, 0x6e, 0xf4, 0xec,
1084             0x27, 0x98, 0x01, 0x23, 0xa7, 0xd8, 0xbf, 0x60,
1085             0x89, 0xef, 0xad, 0xe8, 0x8f, 0x79, 0x14, 0x8c,
1086             0x18, 0x5c, 0x9a, 0xda, 0xef, 0x0b, 0xdd, 0xa0
1087         },
1088         G89_IMIT,
1089         { 0 },
1090         {
1091             0xe9, 0x72, 0xae, 0xbf
1092         }
1093     },
1094     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1095         16, 
1096         {
1097             0x02, 0xf8, 0xec, 0x2b, 0x4d, 0x1f, 0xbc, 0x7c,
1098             0x6e, 0x47, 0xe3, 0x87, 0x22, 0x75, 0x41, 0xa7
1099         },
1100         "id-Gost28147-89-CryptoPro-B-ParamSet",
1101         "testimit5",
1102         {
1103             0x33, 0xd3, 0xef, 0x01, 0x19, 0x95, 0x0e, 0x15,
1104             0xa1, 0x69, 0x75, 0xae, 0x56, 0x27, 0x17, 0x79,
1105             0x63, 0x47, 0xab, 0x62, 0x9d, 0x4a, 0xf0, 0x34,
1106             0xd3, 0x1e, 0x69, 0x74, 0xec, 0x31, 0x48, 0xfc
1107         },
1108         G89_IMIT,
1109         { 0 },
1110         {
1111             0xf5, 0x55, 0x1f, 0x28
1112         }
1113     },
1114     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1115         8, 
1116         {
1117             0xf3, 0xb2, 0x29, 0xd2, 0x7a, 0x37, 0x03, 0x12
1118         },
1119         "id-Gost28147-89-CryptoPro-A-ParamSet",
1120         "testimit6",
1121         {
1122             0x42, 0x35, 0x81, 0x91, 0x0b, 0xa9, 0x99, 0xff,
1123             0xd9, 0x43, 0xf8, 0xc6, 0x19, 0x55, 0x1f, 0x2f,
1124             0x2d, 0x45, 0x40, 0x20, 0x1e, 0x1d, 0x32, 0x7a,
1125             0xb1, 0x07, 0x6b, 0x4f, 0x45, 0x90, 0xd9, 0x80
1126         },
1127         G89_IMIT,
1128         { 0 },
1129         {
1130             0x6e, 0x15, 0xfa, 0xe8
1131         }
1132     },
1133     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1134         0, 
1135         {
1136             0
1137         },
1138         "id-Gost28147-89-CryptoPro-A-ParamSet",
1139         "testimit7",
1140         {
1141             0x26, 0xcb, 0xb9, 0xf0, 0x0c, 0x62, 0x9f, 0xaa,
1142             0x4a, 0x1d, 0xb6, 0x30, 0x09, 0x01, 0x56, 0x89,
1143             0x66, 0xd4, 0xe4, 0x0e, 0xfe, 0xf6, 0x10, 0x6b,
1144             0x6c, 0xe8, 0x04, 0x3a, 0xe3, 0x61, 0x4b, 0x19
1145         },
1146         G89_IMIT,
1147         { 0 },
1148         {
1149             0x00, 0x00, 0x00, 0x00
1150         }
1151     },
1152     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1153         5242880, 
1154         { 0 },
1155         "id-Gost28147-89-CryptoPro-A-ParamSet",
1156         "test5Mimit",
1157         {
1158             0xaa, 0x85, 0x84, 0xcd, 0x65, 0x28, 0xe1, 0xdb,
1159             0xb8, 0x20, 0x19, 0x43, 0xe0, 0x36, 0x35, 0x10,
1160             0x19, 0xc3, 0x70, 0x5b, 0x27, 0xc1, 0x9d, 0x84,
1161             0x75, 0xa3, 0xc6, 0x49, 0x46, 0x8f, 0x7c, 0x4e
1162         },
1163         G89_IMIT,
1164         { 0 },
1165         {
1166             0x2a, 0xe6, 0x23, 0xc6
1167         }
1168     },
1169     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1170         3221225472ULL + 16, 
1171         { 0 },
1172         "id-Gost28147-89-CryptoPro-A-ParamSet",
1173         "test3Gimit1",
1174         {
1175             0xd5, 0xda, 0xfe, 0x06, 0x60, 0xdc, 0xf0, 0xb3,
1176             0x49, 0x5a, 0x02, 0x59, 0xc8, 0x2e, 0x4a, 0x2b,
1177             0xcc, 0x9b, 0x98, 0x04, 0xb7, 0xf2, 0x78, 0xb7,
1178             0xce, 0xa3, 0xf2, 0xdb, 0x9e, 0xa8, 0x49, 0x1d
1179         },
1180         G89_IMIT,
1181         { 0 },
1182         {
1183             0xcc, 0x46, 0x67, 0xe4
1184         }
1185     },
1186     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1187         4ULL*1024*1024*1024ULL, 
1188         { 0 },
1189         "id-Gost28147-89-CryptoPro-A-ParamSet",
1190         "test4Gimit3",
1191         {
1192             0x0d, 0xf1, 0xa8, 0x7f, 0x57, 0x03, 0x44, 0xcc,
1193             0xdb, 0x20, 0xde, 0xed, 0x85, 0x50, 0x38, 0xda,
1194             0xc9, 0x44, 0xec, 0x2c, 0x0d, 0x66, 0xb7, 0xdc,
1195             0x17, 0x14, 0x55, 0x95, 0x33, 0x6e, 0x43, 0x3e
1196         },
1197         G89_IMIT,
1198         { 0 },
1199         {
1200             0xb7, 0x21, 0x2e, 0x48
1201         }
1202     },
1203     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1204         4ULL*1024*1024*1024+4ULL, 
1205         { 0 },
1206         "id-Gost28147-89-CryptoPro-A-ParamSet",
1207         "test4Gimit1",
1208         {
1209             0x0c, 0xf3, 0xe9, 0xb0, 0x28, 0x3b, 0x9f, 0x8b,
1210             0xe3, 0x82, 0xb9, 0xa2, 0xa6, 0xbd, 0x80, 0xd2,
1211             0xcd, 0xfa, 0x3f, 0xf7, 0x90, 0xa7, 0x55, 0x06,
1212             0x9b, 0x7a, 0x58, 0xee, 0xe7, 0xf1, 0x9d, 0xbe
1213         },
1214         G89_IMIT,
1215         { 0 },
1216         {
1217             0xda, 0x15, 0x10, 0x73
1218         }
1219     },
1220     { /* Calculated by libcapi10, CryptoPro CSP 3.6R2, Mac OSX */
1221         4ULL*1024*1024*1024+10ULL, 
1222         { 0 },
1223         "id-Gost28147-89-CryptoPro-A-ParamSet",
1224         "test4Gimit2",
1225         {
1226             0x97, 0x1a, 0x42, 0x22, 0xfa, 0x07, 0xb2, 0xca,
1227             0xf9, 0xd2, 0x34, 0x5a, 0x92, 0xb1, 0x1f, 0x6b,
1228             0x53, 0xf8, 0xaf, 0xed, 0x9a, 0x73, 0xc4, 0x38,
1229             0xd7, 0x7d, 0x25, 0x81, 0x00, 0x0d, 0xd4, 0x29
1230         },
1231         G89_IMIT,
1232         { 0 },
1233         {
1234             0x52, 0xaa, 0x22, 0xb4
1235         }
1236     }
1237 };
1238
1239 int main(int argc, char *argv[])
1240 {
1241     unsigned t;
1242     unsigned long long ullMaxLen = 6*1000*1000;
1243     int ignore = 0;
1244     ENGINE *impl = NULL;
1245     EVP_MD_CTX mctx;
1246     EVP_CIPHER_CTX ectx;
1247     EVP_PKEY *mac_key;
1248     byte bDerive[EVP_MAX_KEY_LENGTH];
1249     byte bTest[G89_MAX_TC_LEN];
1250     byte bTest1[G89_MAX_TC_LEN];
1251     unsigned long long ullLeft;
1252     static const byte bZB[40*1024*1024] = { 0 };
1253     static byte bTS[40*1024*1024] = { 0 };
1254     unsigned int mdl = 0;
1255     int enlu = 0;
1256     int enlf = 0;
1257     size_t siglen;
1258     size_t l;
1259
1260     const EVP_MD *md_gost94 = NULL;
1261     const EVP_CIPHER *cp_g89cfb = NULL;
1262     const EVP_CIPHER *cp_g89cnt = NULL;
1263     const EVP_CIPHER *ctype = NULL;
1264     const EVP_MD *md_g89imit = NULL;
1265
1266     long lErrLine;
1267     CONF *pConfig = NCONF_new(NULL);
1268     BIO *bpConf;
1269     char sConf[] = 
1270             "openssl_conf = openssl_def\n"
1271             "\n"
1272             "[openssl_def]\n"
1273             "engines = engine_section\n"
1274             "\n"
1275             "[engine_section]\n"
1276             "gost = gost_section\n"
1277             "\n"
1278             "[gost_section]\n"
1279             "default_algorithms = ALL\n"
1280             "\n"
1281             ;
1282
1283     printf("Testing GOST 28147-89 ");
1284
1285     if(1 < argc) {
1286        if(1 != sscanf(argv[1], "%llu", &ullMaxLen) ||
1287           ( 2 < argc ? 
1288             1 != sscanf(argv[2], "%d", &ignore) : 0)) {
1289            fflush(NULL);
1290            fprintf(stderr, "Usage: %s [maxlen [ignore-error]]\n", 
1291                                argv[0]);
1292            return 1;
1293        }
1294     }
1295
1296     /* 
1297      * Internal function test on GostR3411_94_TestParamSet
1298      */
1299     #ifdef OPENSSL_NO_DYNAMIC_ENGINE
1300     {
1301         gost_ctx ctx;
1302
1303         for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
1304             const gost_subst_block *pSubst = NULL;
1305
1306             if(1024 < tcs[t].ullLen) {
1307                 /* Key meshing check by engine tests */
1308                 continue;
1309             }
1310             memset(bTest, 0xc3, sizeof(bTest));
1311             if(0 == strcmp(tcs[t].szParamSet,
1312                         "id-GostR3410-94-TestParamSet")) {
1313                 pSubst = &GostR3411_94_TestParamSet;
1314             } else if(0 == strcmp(tcs[t].szParamSet,
1315                         "id-Gost28147-89-CryptoPro-A-ParamSet")) {
1316                 pSubst = &Gost28147_CryptoProParamSetA;
1317             } else if(0 == strcmp(tcs[t].szParamSet,
1318                         "id-Gost28147-89-CryptoPro-B-ParamSet")) {
1319                 pSubst = &Gost28147_CryptoProParamSetB;
1320             } else if(0 == strcmp(tcs[t].szParamSet,
1321                         "id-Gost28147-89-CryptoPro-C-ParamSet")) {
1322                 pSubst = &Gost28147_CryptoProParamSetC;
1323             } else if(0 == strcmp(tcs[t].szParamSet,
1324                         "id-Gost28147-89-CryptoPro-D-ParamSet")) {
1325                 pSubst = &Gost28147_CryptoProParamSetD;
1326             }
1327             gost_init(&ctx, pSubst);
1328             gost_key(&ctx, tcs[t].bRawKey);
1329             switch(tcs[t].gMode) {
1330             case G89_ECB:
1331                 gost_enc(&ctx, tcs[t].bIn, bTest,
1332                             (int)((tcs[t].ullLen + G89_BLOCK_LEN - 1)/
1333                                   G89_BLOCK_LEN));
1334                 l = (size_t)tcs[t].ullLen;
1335                 break;
1336             case G89_CFB:
1337                 gost_enc_cfb(&ctx, tcs[t].bIV, tcs[t].bIn,
1338                             bTest,
1339                             (int)((tcs[t].ullLen + G89_BLOCK_LEN - 1)/
1340                                   G89_BLOCK_LEN));
1341                 l = (size_t)tcs[t].ullLen;
1342                 break;
1343             case G89_CNT:
1344                 /* GOST 28147-89 cipher CNT mode check by engine
1345                  * tests
1346                  */
1347                 continue;
1348             case G89_IMIT:
1349                 gost_mac(&ctx, 32, tcs[t].bIn, 
1350                                     (unsigned int)tcs[t].ullLen, 
1351                                     bTest);
1352                 gost_mac_iv(&ctx, 32, tcs[t].bIV, tcs[t].bIn, 
1353                                     (unsigned int)tcs[t].ullLen, 
1354                                     bTest1);
1355                 if(0 != memcmp(bTest, bTest1, 4)) {
1356                     fflush(NULL);
1357                     fprintf(stderr, "\nInternal test t=%d len=%llu "
1358                                     "failed (gost_mac_iv).\n", t,
1359                                     tcs[t].ullLen);
1360                     if(!ignore) {
1361                         return 2;
1362                     }
1363                 }
1364                 l = 4;
1365                 break;
1366             }
1367             gost_destroy(&ctx);
1368
1369             if(0 != memcmp(tcs[t].bOut, bTest, l)) {
1370                 fflush(NULL);
1371                 fprintf(stderr, "\nInternal test t=%d len=%llu "
1372                                 "failed.\n", t,
1373                                 tcs[t].ullLen);
1374                 if(!ignore) {
1375                     return 3;
1376                 }
1377             } else {
1378                 printf(",");
1379                 fflush(NULL);
1380             }
1381         }
1382     }
1383     #endif
1384
1385     /* 
1386      * ccgost engine test on GostR3411_94_CryptoProParamSet
1387      */
1388     #ifndef OPENSSL_NO_DYNAMIC_ENGINE
1389         setenv("OPENSSL_ENGINES", CCGOST_DIR, 1);
1390     #endif
1391     ERR_load_crypto_strings();
1392     ENGINE_load_builtin_engines();
1393     OPENSSL_load_builtin_modules();
1394
1395     bpConf = BIO_new_mem_buf(sConf, -1);
1396     if(!NCONF_load_bio(pConfig, bpConf, &lErrLine)) {
1397         fflush(NULL);
1398         fprintf(stderr, "NCONF_load_bio: ErrLine=%ld: %s\n",
1399                 lErrLine, 
1400                 ERR_error_string(ERR_get_error(), NULL));
1401         return 4;
1402     }
1403     BIO_free(bpConf);
1404
1405     if(!CONF_modules_load(pConfig, NULL, 0)) {
1406         fflush(NULL);
1407         fprintf(stderr, "CONF_modules_load: %s\n",
1408                 ERR_error_string(ERR_get_error(), NULL));
1409         return 5;
1410     }
1411
1412         /* Test load engine */
1413     if(NULL == (impl = ENGINE_by_id(CCGOST_ID))) {
1414         fflush(NULL);
1415         fprintf(stderr, "Can't load engine id \"" CCGOST_ID "\"\n");
1416         if(!ignore) {
1417             return 6;
1418         }
1419     }
1420     if(NULL == (md_gost94 = EVP_get_digestbyname(SN_id_GostR3411_94))) {
1421         fflush(NULL);
1422         fprintf(stderr, "\"" SN_id_GostR3411_94 "\" - not found\n");
1423         if(!ignore) {
1424             return 7;
1425         }
1426     }
1427     if(NULL == (cp_g89cfb = EVP_get_cipherbyname(SN_id_Gost28147_89))) {
1428         fflush(NULL);
1429         fprintf(stderr, "\"" SN_id_Gost28147_89 "\" - not found\n");
1430         if(!ignore) {
1431             return 8;
1432         }
1433     }
1434     if(NULL == (cp_g89cnt = EVP_get_cipherbyname(SN_gost89_cnt))) {
1435         fflush(NULL);
1436         fprintf(stderr, "\"" SN_gost89_cnt "\" - not found\n");
1437         if(!ignore) {
1438             return 9;
1439         }
1440     }
1441     if(NULL == (md_g89imit = EVP_get_digestbyname(SN_id_Gost28147_89_MAC))) {
1442         fflush(NULL);
1443         fprintf(stderr, "\"" SN_id_Gost28147_89_MAC "\" - not found\n");
1444         if(!ignore) {
1445             return 10;
1446         }
1447     }
1448
1449         /* Test cases */
1450     for(t = 0; t < sizeof(tcs)/sizeof(tcs[0]); t++) {
1451         if(NULL == tcs[t].szDerive) {
1452             continue;
1453         }
1454         memset(bDerive, 0x3c, sizeof(bDerive));
1455         mdl = sizeof(bDerive);
1456         EVP_Digest(tcs[t].szDerive, strlen(tcs[t].szDerive), 
1457                         bDerive, &mdl,
1458                         md_gost94, impl);
1459         if(0 != memcmp(tcs[t].bRawKey, bDerive, mdl)) {
1460             fflush(NULL);
1461             fprintf(stderr, "Engine test t=%d "
1462                         "derive key error.\n", t);
1463             if(!ignore) {
1464                 return 12;
1465             }
1466         }
1467         if(ullMaxLen < tcs[t].ullLen) {
1468             continue;
1469         }
1470         memset(bTest, 0xa5, sizeof(bTest));
1471         memset(bTest1, 0x5a, sizeof(bTest1));
1472         if(!ENGINE_ctrl_cmd_string(impl, 
1473                     "CRYPT_PARAMS",
1474                     tcs[t].szParamSet, 0)) {
1475             fflush(NULL);
1476             fprintf(stderr, "ENGINE_ctrl_cmd_string: %s\n",
1477                     ERR_error_string(ERR_get_error(), NULL));
1478             return 11;
1479         }
1480         switch(tcs[t].gMode) {
1481         case G89_ECB:
1482             /* OpenSSL/ccgost not implemented GOST 28147-89 ECB */
1483             continue;
1484         case G89_CFB:
1485             ctype = cp_g89cfb;
1486             goto engine_cipher_check;
1487         case G89_CNT:
1488             if(0 != strcmp("id-Gost28147-89-CryptoPro-A-ParamSet",
1489                                             tcs[t].szParamSet)) {
1490                 /*
1491                  * ccgost engine can't change S-Box for gost-cnt
1492                  */
1493                 continue;
1494             }
1495             ctype = cp_g89cnt;
1496 engine_cipher_check:
1497             EVP_CIPHER_CTX_init(&ectx);
1498             EVP_EncryptInit_ex(&ectx, ctype, impl,
1499                                     bDerive, tcs[t].bIV);
1500             if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
1501                 enlu = sizeof(bTest);
1502                 EVP_EncryptUpdate(&ectx, bTest, &enlu, 
1503                                     tcs[t].bIn, (int)tcs[t].ullLen);
1504                 l = (size_t)tcs[t].ullLen;
1505             } else {
1506                 for(ullLeft = tcs[t].ullLen; 
1507                             ullLeft >= sizeof(bZB); 
1508                                     ullLeft -= sizeof(bZB)) {
1509                     printf("B"); 
1510                     fflush(NULL);
1511                     enlu = sizeof(bTS);
1512                     EVP_EncryptUpdate(&ectx, bTS, &enlu, 
1513                                             bZB, sizeof(bZB));
1514                 }
1515                 printf("b%llu/%llu", ullLeft, tcs[t].ullLen); 
1516                 fflush(NULL);
1517                 EVP_EncryptUpdate(&ectx, bTS, &enlu, 
1518                                         bZB, (int)ullLeft);
1519                 memcpy(bTest, &bTS[enlu-16], 16);
1520                 enlu = (int)tcs[t].ullLen;
1521                 l = 16;
1522             }
1523             enlf = sizeof(bTest1);
1524             EVP_EncryptFinal_ex(&ectx, bTest1, &enlf);
1525             EVP_CIPHER_CTX_cleanup(&ectx);
1526             break;
1527         case G89_IMIT:
1528             if(0 != strcmp("id-Gost28147-89-CryptoPro-A-ParamSet",
1529                                             tcs[t].szParamSet)) {
1530                 /*
1531                  * ccgost engine can't change S-Box for gost-mac
1532                  */
1533                 continue;
1534             }
1535             EVP_MD_CTX_init(&mctx);
1536             mac_key = EVP_PKEY_new_mac_key(
1537                                 NID_id_Gost28147_89_MAC, NULL,
1538                                 bDerive, mdl);
1539             EVP_DigestSignInit(&mctx, NULL, 
1540                                     md_g89imit, impl, mac_key);
1541             if(G89_MAX_TC_LEN >= tcs[t].ullLen) {
1542                 EVP_DigestSignUpdate(&mctx, tcs[t].bIn, 
1543                                     (unsigned int)tcs[t].ullLen);
1544             } else {
1545                 for(ullLeft = tcs[t].ullLen; 
1546                             ullLeft >= sizeof(bZB); 
1547                                     ullLeft -= sizeof(bZB)) {
1548                     printf("B"); 
1549                     fflush(NULL);
1550                     EVP_DigestSignUpdate(&mctx, bZB, sizeof(bZB));
1551                 }
1552                 printf("b%llu/%llu", ullLeft, tcs[t].ullLen); 
1553                 fflush(NULL);
1554                 EVP_DigestSignUpdate(&mctx, bZB, 
1555                                         (unsigned int)ullLeft);
1556             }
1557             siglen = 4;
1558             EVP_DigestSignFinal(&mctx, bTest, &siglen);
1559             EVP_MD_CTX_cleanup(&mctx);
1560             enlu = (int)tcs[t].ullLen;
1561             enlf = 0;
1562             l = siglen;
1563             break;
1564         }
1565         if((int)tcs[t].ullLen != enlu || 0 != enlf ||
1566            0 != memcmp(tcs[t].bOut, bTest, l)) {
1567             fflush(NULL);
1568             fprintf(stderr, "\nEngine test t=%d len=%llu "
1569                             "failed.\n", t, tcs[t].ullLen);
1570             if(!ignore) {
1571                 return 13;
1572             }
1573         } else {
1574             printf(".");
1575             fflush(NULL);
1576         }
1577     }
1578
1579     printf(" passed\n");
1580     fflush(NULL);
1581
1582     return EXIT_SUCCESS;
1583 }
1584 #endif