1*0a6a1f1dSLionel Sambuc /* $NetBSD: test_bn.c,v 1.1.1.2 2014/04/24 12:45:30 pettai Exp $ */
2ebfedea0SLionel Sambuc
3ebfedea0SLionel Sambuc /*
4ebfedea0SLionel Sambuc * Copyright (c) 2006 - 2007 Kungliga Tekniska Högskolan
5ebfedea0SLionel Sambuc * (Royal Institute of Technology, Stockholm, Sweden).
6ebfedea0SLionel Sambuc * All rights reserved.
7ebfedea0SLionel Sambuc *
8ebfedea0SLionel Sambuc * Redistribution and use in source and binary forms, with or without
9ebfedea0SLionel Sambuc * modification, are permitted provided that the following conditions
10ebfedea0SLionel Sambuc * are met:
11ebfedea0SLionel Sambuc *
12ebfedea0SLionel Sambuc * 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc *
15ebfedea0SLionel Sambuc * 2. Redistributions in binary form must reproduce the above copyright
16ebfedea0SLionel Sambuc * notice, this list of conditions and the following disclaimer in the
17ebfedea0SLionel Sambuc * documentation and/or other materials provided with the distribution.
18ebfedea0SLionel Sambuc *
19ebfedea0SLionel Sambuc * 3. Neither the name of the Institute nor the names of its contributors
20ebfedea0SLionel Sambuc * may be used to endorse or promote products derived from this software
21ebfedea0SLionel Sambuc * without specific prior written permission.
22ebfedea0SLionel Sambuc *
23ebfedea0SLionel Sambuc * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24ebfedea0SLionel Sambuc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25ebfedea0SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26ebfedea0SLionel Sambuc * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27ebfedea0SLionel Sambuc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28ebfedea0SLionel Sambuc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29ebfedea0SLionel Sambuc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30ebfedea0SLionel Sambuc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31ebfedea0SLionel Sambuc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32ebfedea0SLionel Sambuc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33ebfedea0SLionel Sambuc * SUCH DAMAGE.
34ebfedea0SLionel Sambuc */
35ebfedea0SLionel Sambuc
36ebfedea0SLionel Sambuc #include <config.h>
37ebfedea0SLionel Sambuc
38ebfedea0SLionel Sambuc #include <sys/types.h>
39ebfedea0SLionel Sambuc #include <limits.h>
40ebfedea0SLionel Sambuc #include <stdio.h>
41ebfedea0SLionel Sambuc #include <stdlib.h>
42ebfedea0SLionel Sambuc #include <string.h>
43ebfedea0SLionel Sambuc
44ebfedea0SLionel Sambuc #include <bn.h>
45ebfedea0SLionel Sambuc #include <rand.h>
46ebfedea0SLionel Sambuc
47ebfedea0SLionel Sambuc static int
set_get(unsigned long num)48ebfedea0SLionel Sambuc set_get(unsigned long num)
49ebfedea0SLionel Sambuc {
50ebfedea0SLionel Sambuc BIGNUM *bn;
51ebfedea0SLionel Sambuc
52ebfedea0SLionel Sambuc bn = BN_new();
53ebfedea0SLionel Sambuc if (!BN_set_word(bn, num))
54ebfedea0SLionel Sambuc return 1;
55ebfedea0SLionel Sambuc
56ebfedea0SLionel Sambuc if (BN_get_word(bn) != num)
57ebfedea0SLionel Sambuc return 1;
58ebfedea0SLionel Sambuc
59ebfedea0SLionel Sambuc BN_free(bn);
60ebfedea0SLionel Sambuc return 0;
61ebfedea0SLionel Sambuc }
62ebfedea0SLionel Sambuc
63ebfedea0SLionel Sambuc #define CHECK(x) do { ret += x; } while(0)
64ebfedea0SLionel Sambuc
65ebfedea0SLionel Sambuc static int
test_BN_set_get(void)66ebfedea0SLionel Sambuc test_BN_set_get(void)
67ebfedea0SLionel Sambuc {
68ebfedea0SLionel Sambuc int ret = 0;
69ebfedea0SLionel Sambuc CHECK(set_get(0));
70ebfedea0SLionel Sambuc CHECK(set_get(1));
71ebfedea0SLionel Sambuc CHECK(set_get(0xff));
72ebfedea0SLionel Sambuc CHECK(set_get(0x1ff));
73ebfedea0SLionel Sambuc CHECK(set_get(0xffff));
74ebfedea0SLionel Sambuc CHECK(set_get(0xf000));
75ebfedea0SLionel Sambuc CHECK(set_get(ULONG_MAX / 2));
76ebfedea0SLionel Sambuc CHECK(set_get(ULONG_MAX - 1));
77ebfedea0SLionel Sambuc
78ebfedea0SLionel Sambuc return ret;
79ebfedea0SLionel Sambuc }
80ebfedea0SLionel Sambuc
81ebfedea0SLionel Sambuc static int
test_BN_bit(void)82ebfedea0SLionel Sambuc test_BN_bit(void)
83ebfedea0SLionel Sambuc {
84ebfedea0SLionel Sambuc BIGNUM *bn;
85ebfedea0SLionel Sambuc int ret = 0;
86ebfedea0SLionel Sambuc
87ebfedea0SLionel Sambuc bn = BN_new();
88ebfedea0SLionel Sambuc
89ebfedea0SLionel Sambuc /* test setting and getting of "word" */
90ebfedea0SLionel Sambuc if (!BN_set_word(bn, 1))
91ebfedea0SLionel Sambuc return 1;
92ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 0))
93ebfedea0SLionel Sambuc ret += 1;
94ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 0))
95ebfedea0SLionel Sambuc ret += 1;
96ebfedea0SLionel Sambuc
97ebfedea0SLionel Sambuc if (!BN_set_word(bn, 2))
98ebfedea0SLionel Sambuc return 1;
99ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 1))
100ebfedea0SLionel Sambuc ret += 1;
101ebfedea0SLionel Sambuc
102ebfedea0SLionel Sambuc if (!BN_set_word(bn, 3))
103ebfedea0SLionel Sambuc return 1;
104ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 0))
105ebfedea0SLionel Sambuc ret += 1;
106ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 1))
107ebfedea0SLionel Sambuc ret += 1;
108ebfedea0SLionel Sambuc
109ebfedea0SLionel Sambuc if (!BN_set_word(bn, 0x100))
110ebfedea0SLionel Sambuc return 1;
111ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 8))
112ebfedea0SLionel Sambuc ret += 1;
113ebfedea0SLionel Sambuc
114ebfedea0SLionel Sambuc if (!BN_set_word(bn, 0x1000))
115ebfedea0SLionel Sambuc return 1;
116ebfedea0SLionel Sambuc if (!BN_is_bit_set(bn, 12))
117ebfedea0SLionel Sambuc ret += 1;
118ebfedea0SLionel Sambuc
119ebfedea0SLionel Sambuc /* test bitsetting */
120ebfedea0SLionel Sambuc if (!BN_set_word(bn, 1))
121ebfedea0SLionel Sambuc return 1;
122ebfedea0SLionel Sambuc if (!BN_set_bit(bn, 1))
123ebfedea0SLionel Sambuc return 1;
124ebfedea0SLionel Sambuc if (BN_get_word(bn) != 3)
125ebfedea0SLionel Sambuc return 1;
126ebfedea0SLionel Sambuc if (!BN_clear_bit(bn, 0))
127ebfedea0SLionel Sambuc return 1;
128ebfedea0SLionel Sambuc if (BN_get_word(bn) != 2)
129ebfedea0SLionel Sambuc return 1;
130ebfedea0SLionel Sambuc
131ebfedea0SLionel Sambuc /* test bitsetting past end of current end */
132ebfedea0SLionel Sambuc BN_clear(bn);
133ebfedea0SLionel Sambuc if (!BN_set_bit(bn, 12))
134ebfedea0SLionel Sambuc return 1;
135ebfedea0SLionel Sambuc if (BN_get_word(bn) != 0x1000)
136ebfedea0SLionel Sambuc return 1;
137ebfedea0SLionel Sambuc
138ebfedea0SLionel Sambuc /* test bit and byte counting functions */
139ebfedea0SLionel Sambuc if (BN_num_bits(bn) != 13)
140ebfedea0SLionel Sambuc return 1;
141ebfedea0SLionel Sambuc if (BN_num_bytes(bn) != 2)
142ebfedea0SLionel Sambuc return 1;
143ebfedea0SLionel Sambuc
144ebfedea0SLionel Sambuc BN_free(bn);
145ebfedea0SLionel Sambuc return ret;
146ebfedea0SLionel Sambuc }
147ebfedea0SLionel Sambuc
148ebfedea0SLionel Sambuc struct ietest {
149ebfedea0SLionel Sambuc char *data;
150ebfedea0SLionel Sambuc size_t len;
151ebfedea0SLionel Sambuc unsigned long num;
152ebfedea0SLionel Sambuc } ietests[] = {
153ebfedea0SLionel Sambuc { "", 0, 0 },
154ebfedea0SLionel Sambuc { "\x01", 1, 1 },
155ebfedea0SLionel Sambuc { "\x02", 1, 2 },
156ebfedea0SLionel Sambuc { "\xf2", 1, 0xf2 },
157ebfedea0SLionel Sambuc { "\x01\x00", 2, 256 }
158ebfedea0SLionel Sambuc };
159ebfedea0SLionel Sambuc
160ebfedea0SLionel Sambuc static int
test_BN_import_export(void)161ebfedea0SLionel Sambuc test_BN_import_export(void)
162ebfedea0SLionel Sambuc {
163ebfedea0SLionel Sambuc BIGNUM *bn;
164ebfedea0SLionel Sambuc int ret = 0;
165ebfedea0SLionel Sambuc int i;
166ebfedea0SLionel Sambuc
167ebfedea0SLionel Sambuc bn = BN_new();
168ebfedea0SLionel Sambuc
169ebfedea0SLionel Sambuc for (i = 0; i < sizeof(ietests)/sizeof(ietests[0]); i++) {
170ebfedea0SLionel Sambuc size_t len;
171ebfedea0SLionel Sambuc unsigned char *p;
172ebfedea0SLionel Sambuc if (!BN_bin2bn((unsigned char*)ietests[i].data, ietests[i].len, bn))
173ebfedea0SLionel Sambuc return 1;
174ebfedea0SLionel Sambuc if (BN_get_word(bn) != ietests[i].num)
175ebfedea0SLionel Sambuc return 1;
176ebfedea0SLionel Sambuc len = BN_num_bytes(bn);
177ebfedea0SLionel Sambuc if (len != ietests[i].len)
178ebfedea0SLionel Sambuc return 1;
179ebfedea0SLionel Sambuc p = malloc(len + 1);
180ebfedea0SLionel Sambuc p[len] = 0xf4;
181ebfedea0SLionel Sambuc BN_bn2bin(bn, p);
182ebfedea0SLionel Sambuc if (p[len] != 0xf4)
183ebfedea0SLionel Sambuc return 1;
184ebfedea0SLionel Sambuc if (memcmp(p, ietests[i].data, ietests[i].len) != 0)
185ebfedea0SLionel Sambuc return 1;
186ebfedea0SLionel Sambuc free(p);
187ebfedea0SLionel Sambuc }
188ebfedea0SLionel Sambuc
189ebfedea0SLionel Sambuc BN_free(bn);
190ebfedea0SLionel Sambuc return ret;
191ebfedea0SLionel Sambuc }
192ebfedea0SLionel Sambuc
193ebfedea0SLionel Sambuc static int
test_BN_uadd(void)194ebfedea0SLionel Sambuc test_BN_uadd(void)
195ebfedea0SLionel Sambuc {
196ebfedea0SLionel Sambuc BIGNUM *a, *b, *c;
197ebfedea0SLionel Sambuc char *p;
198ebfedea0SLionel Sambuc
199ebfedea0SLionel Sambuc a = BN_new();
200ebfedea0SLionel Sambuc b = BN_new();
201ebfedea0SLionel Sambuc c = BN_new();
202ebfedea0SLionel Sambuc
203ebfedea0SLionel Sambuc BN_set_word(a, 1);
204ebfedea0SLionel Sambuc BN_set_word(b, 2);
205ebfedea0SLionel Sambuc
206ebfedea0SLionel Sambuc BN_uadd(c, a, b);
207ebfedea0SLionel Sambuc
208ebfedea0SLionel Sambuc if (BN_get_word(c) != 3)
209ebfedea0SLionel Sambuc return 1;
210ebfedea0SLionel Sambuc
211ebfedea0SLionel Sambuc BN_uadd(c, b, a);
212ebfedea0SLionel Sambuc
213ebfedea0SLionel Sambuc if (BN_get_word(c) != 3)
214ebfedea0SLionel Sambuc return 1;
215ebfedea0SLionel Sambuc
216ebfedea0SLionel Sambuc BN_set_word(b, 0xff);
217ebfedea0SLionel Sambuc
218ebfedea0SLionel Sambuc BN_uadd(c, a, b);
219ebfedea0SLionel Sambuc if (BN_get_word(c) != 0x100)
220ebfedea0SLionel Sambuc return 1;
221ebfedea0SLionel Sambuc
222ebfedea0SLionel Sambuc BN_uadd(c, b, a);
223ebfedea0SLionel Sambuc if (BN_get_word(c) != 0x100)
224ebfedea0SLionel Sambuc return 1;
225ebfedea0SLionel Sambuc
226ebfedea0SLionel Sambuc BN_set_word(a, 0xff);
227ebfedea0SLionel Sambuc
228ebfedea0SLionel Sambuc BN_uadd(c, a, b);
229ebfedea0SLionel Sambuc if (BN_get_word(c) != 0x1fe)
230ebfedea0SLionel Sambuc return 1;
231ebfedea0SLionel Sambuc
232ebfedea0SLionel Sambuc BN_uadd(c, b, a);
233ebfedea0SLionel Sambuc if (BN_get_word(c) != 0x1fe)
234ebfedea0SLionel Sambuc return 1;
235ebfedea0SLionel Sambuc
236ebfedea0SLionel Sambuc
237ebfedea0SLionel Sambuc BN_free(a);
238ebfedea0SLionel Sambuc BN_free(b);
239ebfedea0SLionel Sambuc
240ebfedea0SLionel Sambuc BN_hex2bn(&a, "50212A3B611D46642C825A16A354CE0FD4D85DD2");
241ebfedea0SLionel Sambuc BN_hex2bn(&b, "84B6C7E8D28ACA1614954DA");
242ebfedea0SLionel Sambuc
243ebfedea0SLionel Sambuc BN_uadd(c, b, a);
244ebfedea0SLionel Sambuc p = BN_bn2hex(c);
245ebfedea0SLionel Sambuc if (strcmp(p, "50212A3B611D466434CDC695307D7AB13621B2AC") != 0) {
246ebfedea0SLionel Sambuc free(p);
247ebfedea0SLionel Sambuc return 1;
248ebfedea0SLionel Sambuc }
249ebfedea0SLionel Sambuc free(p);
250ebfedea0SLionel Sambuc
251ebfedea0SLionel Sambuc BN_uadd(c, a, b);
252ebfedea0SLionel Sambuc p = BN_bn2hex(c);
253ebfedea0SLionel Sambuc if (strcmp(p, "50212A3B611D466434CDC695307D7AB13621B2AC") != 0) {
254ebfedea0SLionel Sambuc free(p);
255ebfedea0SLionel Sambuc return 1;
256ebfedea0SLionel Sambuc }
257ebfedea0SLionel Sambuc free(p);
258ebfedea0SLionel Sambuc
259ebfedea0SLionel Sambuc BN_free(a);
260ebfedea0SLionel Sambuc BN_free(b);
261ebfedea0SLionel Sambuc BN_free(c);
262ebfedea0SLionel Sambuc
263ebfedea0SLionel Sambuc return 0;
264ebfedea0SLionel Sambuc }
265ebfedea0SLionel Sambuc
266ebfedea0SLionel Sambuc static int
test_BN_cmp(void)267ebfedea0SLionel Sambuc test_BN_cmp(void)
268ebfedea0SLionel Sambuc {
269ebfedea0SLionel Sambuc BIGNUM *a, *b;
270ebfedea0SLionel Sambuc
271ebfedea0SLionel Sambuc a = BN_new();
272ebfedea0SLionel Sambuc b = BN_new();
273ebfedea0SLionel Sambuc
274ebfedea0SLionel Sambuc if (!BN_set_word(a, 1))
275ebfedea0SLionel Sambuc return 1;
276ebfedea0SLionel Sambuc if (!BN_set_word(b, 1))
277ebfedea0SLionel Sambuc return 1;
278ebfedea0SLionel Sambuc
279ebfedea0SLionel Sambuc if (BN_cmp(a, b) != 0)
280ebfedea0SLionel Sambuc return 1;
281ebfedea0SLionel Sambuc if (BN_cmp(b, a) != 0)
282ebfedea0SLionel Sambuc return 1;
283ebfedea0SLionel Sambuc
284ebfedea0SLionel Sambuc if (!BN_set_word(b, 2))
285ebfedea0SLionel Sambuc return 1;
286ebfedea0SLionel Sambuc
287ebfedea0SLionel Sambuc if (BN_cmp(a, b) >= 0)
288ebfedea0SLionel Sambuc return 1;
289ebfedea0SLionel Sambuc if (BN_cmp(b, a) <= 0)
290ebfedea0SLionel Sambuc return 1;
291ebfedea0SLionel Sambuc
292ebfedea0SLionel Sambuc BN_set_negative(b, 1);
293ebfedea0SLionel Sambuc
294ebfedea0SLionel Sambuc if (BN_cmp(a, b) <= 0)
295ebfedea0SLionel Sambuc return 1;
296ebfedea0SLionel Sambuc if (BN_cmp(b, a) >= 0)
297ebfedea0SLionel Sambuc return 1;
298ebfedea0SLionel Sambuc
299ebfedea0SLionel Sambuc BN_free(a);
300ebfedea0SLionel Sambuc BN_free(b);
301ebfedea0SLionel Sambuc
302ebfedea0SLionel Sambuc BN_hex2bn(&a, "50212A3B611D46642C825A16A354CE0FD4D85DD1");
303ebfedea0SLionel Sambuc BN_hex2bn(&b, "50212A3B611D46642C825A16A354CE0FD4D85DD2");
304ebfedea0SLionel Sambuc
305ebfedea0SLionel Sambuc if (BN_cmp(a, b) >= 0)
306ebfedea0SLionel Sambuc return 1;
307ebfedea0SLionel Sambuc if (BN_cmp(b, a) <= 0)
308ebfedea0SLionel Sambuc return 1;
309ebfedea0SLionel Sambuc
310ebfedea0SLionel Sambuc BN_set_negative(b, 1);
311ebfedea0SLionel Sambuc
312ebfedea0SLionel Sambuc if (BN_cmp(a, b) <= 0)
313ebfedea0SLionel Sambuc return 1;
314ebfedea0SLionel Sambuc if (BN_cmp(b, a) >= 0)
315ebfedea0SLionel Sambuc return 1;
316ebfedea0SLionel Sambuc
317ebfedea0SLionel Sambuc BN_free(a);
318ebfedea0SLionel Sambuc BN_free(b);
319ebfedea0SLionel Sambuc return 0;
320ebfedea0SLionel Sambuc }
321ebfedea0SLionel Sambuc
322ebfedea0SLionel Sambuc static int
test_BN_rand(void)323ebfedea0SLionel Sambuc test_BN_rand(void)
324ebfedea0SLionel Sambuc {
325ebfedea0SLionel Sambuc BIGNUM *bn;
326ebfedea0SLionel Sambuc
327ebfedea0SLionel Sambuc if (RAND_status() != 1)
328ebfedea0SLionel Sambuc return 0;
329ebfedea0SLionel Sambuc
330ebfedea0SLionel Sambuc bn = BN_new();
331ebfedea0SLionel Sambuc if (bn == NULL)
332ebfedea0SLionel Sambuc return 1;
333ebfedea0SLionel Sambuc
334ebfedea0SLionel Sambuc if (!BN_rand(bn, 1024, 0, 0))
335ebfedea0SLionel Sambuc return 1;
336ebfedea0SLionel Sambuc
337ebfedea0SLionel Sambuc BN_free(bn);
338ebfedea0SLionel Sambuc return 0;
339ebfedea0SLionel Sambuc }
340ebfedea0SLionel Sambuc
341ebfedea0SLionel Sambuc #define testnum 100
342ebfedea0SLionel Sambuc #define testnum2 10
343ebfedea0SLionel Sambuc
344ebfedea0SLionel Sambuc static int
test_BN_CTX(void)345ebfedea0SLionel Sambuc test_BN_CTX(void)
346ebfedea0SLionel Sambuc {
347ebfedea0SLionel Sambuc unsigned int i, j;
348ebfedea0SLionel Sambuc BIGNUM *bn;
349ebfedea0SLionel Sambuc BN_CTX *c;
350ebfedea0SLionel Sambuc
351ebfedea0SLionel Sambuc if ((c = BN_CTX_new()) == NULL)
352ebfedea0SLionel Sambuc return 1;
353ebfedea0SLionel Sambuc
354ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++) {
355ebfedea0SLionel Sambuc BN_CTX_start(c);
356ebfedea0SLionel Sambuc BN_CTX_end(c);
357ebfedea0SLionel Sambuc }
358ebfedea0SLionel Sambuc
359ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++)
360ebfedea0SLionel Sambuc BN_CTX_start(c);
361ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++)
362ebfedea0SLionel Sambuc BN_CTX_end(c);
363ebfedea0SLionel Sambuc
364ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++) {
365ebfedea0SLionel Sambuc BN_CTX_start(c);
366ebfedea0SLionel Sambuc if ((bn = BN_CTX_get(c)) == NULL)
367ebfedea0SLionel Sambuc return 1;
368ebfedea0SLionel Sambuc BN_CTX_end(c);
369ebfedea0SLionel Sambuc }
370ebfedea0SLionel Sambuc
371ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++) {
372ebfedea0SLionel Sambuc BN_CTX_start(c);
373ebfedea0SLionel Sambuc for (j = 0; j < testnum2; j++)
374ebfedea0SLionel Sambuc if ((bn = BN_CTX_get(c)) == NULL)
375ebfedea0SLionel Sambuc return 1;
376ebfedea0SLionel Sambuc }
377ebfedea0SLionel Sambuc for (i = 0; i < testnum; i++)
378ebfedea0SLionel Sambuc BN_CTX_end(c);
379ebfedea0SLionel Sambuc
380ebfedea0SLionel Sambuc BN_CTX_free(c);
381ebfedea0SLionel Sambuc return 0;
382ebfedea0SLionel Sambuc }
383ebfedea0SLionel Sambuc
384ebfedea0SLionel Sambuc
385ebfedea0SLionel Sambuc int
main(int argc,char ** argv)386ebfedea0SLionel Sambuc main(int argc, char **argv)
387ebfedea0SLionel Sambuc {
388ebfedea0SLionel Sambuc int ret = 0;
389ebfedea0SLionel Sambuc
390ebfedea0SLionel Sambuc ret += test_BN_set_get();
391ebfedea0SLionel Sambuc ret += test_BN_bit();
392ebfedea0SLionel Sambuc ret += test_BN_import_export();
393ebfedea0SLionel Sambuc ret += test_BN_uadd();
394ebfedea0SLionel Sambuc ret += test_BN_cmp();
395ebfedea0SLionel Sambuc ret += test_BN_rand();
396ebfedea0SLionel Sambuc ret += test_BN_CTX();
397ebfedea0SLionel Sambuc
398ebfedea0SLionel Sambuc return ret;
399ebfedea0SLionel Sambuc }
400