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