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