util/mknum.pl: Really allow unset ordinals in development
[openssl.git] / test / params_test.c
1 /*
2  * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * https://www.openssl.org/source/license.html
8  * or in the file LICENSE in the source distribution.
9  */
10
11 /*
12  * This program tests the use of OSSL_PARAM, currently in raw form.
13  */
14
15 #include <string.h>
16 #include <openssl/bn.h>
17 #include <openssl/core.h>
18 #include <openssl/params.h>
19 #include "internal/numbers.h"
20 #include "internal/nelem.h"
21 #include "testutil.h"
22
23 /*-
24  * PROVIDER SECTION
25  * ================
26  *
27  * Even though it's not necessarily ONLY providers doing this part,
28  * they are naturally going to be the most common users of
29  * set_params and get_params functions.
30  */
31
32 /*
33  * In real use cases, setters and getters would take an object with
34  * which the parameters are associated.  This structure is a cheap
35  * simulation.
36  */
37 struct object_st {
38     /*
39      * Documented as a native integer, of the size given by sizeof(int).
40      * Assumed data type OSSL_PARAM_INTEGER
41      */
42     int p1;
43     /*
44      * Documented as a native double, of the size given by sizeof(double).
45      * Assumed data type OSSL_PARAM_REAL
46      */
47     double p2;
48     /*
49      * Documented as an arbitrarly large unsigned integer.
50      * The data size must be large enough to accommodate.
51      * Assumed data type OSSL_PARAM_UNSIGNED_INTEGER
52      */
53     BIGNUM *p3;
54     /*
55      * Documented as a C string.
56      * The data size must be large enough to accommodate.
57      * Assumed data type OSSL_PARAM_UTF8_STRING
58      */
59     char *p4;
60     size_t p4_l;
61     /*
62      * Documented as a C string.
63      * Assumed data type OSSL_PARAM_UTF8_STRING
64      */
65     char p5[256];
66     size_t p5_l;
67     /*
68      * Documented as a pointer to a constant C string.
69      * Assumed data type OSSL_PARAM_UTF8_PTR
70      */
71     const char *p6;
72     size_t p6_l;
73 };
74
75 #define p1_init 42                              /* The ultimate answer */
76 #define p2_init 6.283                           /* Magic number */
77 /* Stolen from evp_data, BLAKE2s256 test */
78 #define p3_init                                 \
79     "4142434445464748494a4b4c4d4e4f50"          \
80     "5152535455565758595a616263646566"          \
81     "6768696a6b6c6d6e6f70717273747576"          \
82     "7778797a30313233343536373839"
83 #define p4_init "BLAKE2s256"                    /* Random string */
84 #define p5_init "Hellow World"                  /* Random string */
85 #define p6_init OPENSSL_FULL_VERSION_STR        /* Static string */
86
87 static void cleanup_object(void *vobj)
88 {
89     struct object_st *obj = vobj;
90
91     BN_free(obj->p3);
92     obj->p3 = NULL;
93     OPENSSL_free(obj->p4);
94     obj->p4 = NULL;
95     OPENSSL_free(obj);
96 }
97
98 static void *init_object(void)
99 {
100     struct object_st *obj = OPENSSL_zalloc(sizeof(*obj));
101
102     obj->p1 = p1_init;
103     obj->p2 = p2_init;
104     if (!TEST_true(BN_hex2bn(&obj->p3, p3_init)))
105         goto fail;
106     if (!TEST_ptr(obj->p4 = OPENSSL_strdup(p4_init)))
107         goto fail;
108     strcpy(obj->p5, p5_init);
109     obj->p6 = p6_init;
110
111     return obj;
112  fail:
113     cleanup_object(obj);
114     obj = NULL;
115
116     return NULL;
117 }
118
119 /*
120  * RAW provider, which handles the parameters in a very raw manner,
121  * with no fancy API and very minimal checking.  The application that
122  * calls these to set or request parameters MUST get its OSSL_PARAM
123  * array right.
124  */
125
126 static int raw_set_params(void *vobj, const OSSL_PARAM *params)
127 {
128     struct object_st *obj = vobj;
129
130     for (; params->key != NULL; params++)
131         if (strcmp(params->key, "p1") == 0) {
132             obj->p1 = *(int *)params->data;
133         } else if (strcmp(params->key, "p2") == 0) {
134             obj->p2 = *(double *)params->data;
135         } else if (strcmp(params->key, "p3") == 0) {
136             BN_free(obj->p3);
137             if (!TEST_ptr(obj->p3 = BN_native2bn(params->data,
138                                                  params->data_size, NULL)))
139                 return 0;
140         } else if (strcmp(params->key, "p4") == 0) {
141             OPENSSL_free(obj->p4);
142             if (!TEST_ptr(obj->p4 = OPENSSL_strndup(params->data,
143                                                     params->data_size)))
144                 return 0;
145             obj->p4_l = strlen(obj->p4);
146         } else if (strcmp(params->key, "p5") == 0) {
147             /*
148              * Protect obj->p5 against too much data.  This should not
149              * happen, we don't use that long strings.
150              */
151             size_t data_length =
152                 OPENSSL_strnlen(params->data, params->data_size);
153
154             if (!TEST_size_t_lt(data_length, sizeof(obj->p5)))
155                 return 0;
156             strncpy(obj->p5, params->data, data_length);
157             obj->p5[data_length] = '\0';
158             obj->p5_l = strlen(obj->p5);
159         } else if (strcmp(params->key, "p6") == 0) {
160             obj->p6 = *(const char **)params->data;
161             obj->p6_l = params->data_size;
162         }
163
164     return 1;
165 }
166
167 static int raw_get_params(void *vobj, OSSL_PARAM *params)
168 {
169     struct object_st *obj = vobj;
170
171     for (; params->key != NULL; params++)
172         if (strcmp(params->key, "p1") == 0) {
173             params->return_size = sizeof(obj->p1);
174             *(int *)params->data = obj->p1;
175         } else if (strcmp(params->key, "p2") == 0) {
176             params->return_size = sizeof(obj->p2);
177             *(double *)params->data = obj->p2;
178         } else if (strcmp(params->key, "p3") == 0) {
179             params->return_size = BN_num_bytes(obj->p3);
180             if (!TEST_size_t_ge(params->data_size, params->return_size))
181                 return 0;
182             BN_bn2nativepad(obj->p3, params->data, params->return_size);
183         } else if (strcmp(params->key, "p4") == 0) {
184             params->return_size = strlen(obj->p4);
185             if (!TEST_size_t_gt(params->data_size, params->return_size))
186                 return 0;
187             strcpy(params->data, obj->p4);
188         } else if (strcmp(params->key, "p5") == 0) {
189             params->return_size = strlen(obj->p5);
190             if (!TEST_size_t_gt(params->data_size, params->return_size))
191                 return 0;
192             strcpy(params->data, obj->p5);
193         } else if (strcmp(params->key, "p6") == 0) {
194             params->return_size = strlen(obj->p6);
195             *(const char **)params->data = obj->p6;
196         }
197
198     return 1;
199 }
200
201 /*
202  * API provider, which handles the parameters using the API from params.h
203  */
204
205 static int api_set_params(void *vobj, const OSSL_PARAM *params)
206 {
207     struct object_st *obj = vobj;
208     const OSSL_PARAM *p = NULL;
209
210     if ((p = OSSL_PARAM_locate_const(params, "p1")) != NULL
211         && !TEST_true(OSSL_PARAM_get_int(p, &obj->p1)))
212         return 0;
213     if ((p = OSSL_PARAM_locate_const(params, "p2")) != NULL
214         && !TEST_true(OSSL_PARAM_get_double(p, &obj->p2)))
215         return 0;
216     if ((p = OSSL_PARAM_locate_const(params, "p3")) != NULL
217         && !TEST_true(OSSL_PARAM_get_BN(p, &obj->p3)))
218         return 0;
219     if ((p = OSSL_PARAM_locate_const(params, "p4")) != NULL) {
220         OPENSSL_free(obj->p4);
221         obj->p4 = NULL;
222         /* If the value pointer is NULL, we get it automatically allocated */
223         if (!TEST_true(OSSL_PARAM_get_utf8_string(p, &obj->p4, 0)))
224             return 0;
225     }
226     if ((p = OSSL_PARAM_locate_const(params, "p5")) != NULL) {
227         char *p5_ptr = obj->p5;
228         if (!TEST_true(OSSL_PARAM_get_utf8_string(p, &p5_ptr, sizeof(obj->p5))))
229             return 0;
230         obj->p5_l = strlen(obj->p5);
231     }
232     if ((p = OSSL_PARAM_locate_const(params, "p6")) != NULL) {
233         if (!TEST_true(OSSL_PARAM_get_utf8_ptr(p, &obj->p6)))
234             return 0;
235         obj->p6_l = strlen(obj->p6);
236     }
237
238     return 1;
239 }
240
241 static int api_get_params(void *vobj, OSSL_PARAM *params)
242 {
243     struct object_st *obj = vobj;
244     OSSL_PARAM *p = NULL;
245
246     if ((p = OSSL_PARAM_locate(params, "p1")) != NULL
247         && !TEST_true(OSSL_PARAM_set_int(p, obj->p1)))
248         return 0;
249     if ((p = OSSL_PARAM_locate(params, "p2")) != NULL
250         && !TEST_true(OSSL_PARAM_set_double(p, obj->p2)))
251         return 0;
252     if ((p = OSSL_PARAM_locate(params, "p3")) != NULL
253         && !TEST_true(OSSL_PARAM_set_BN(p, obj->p3)))
254         return 0;
255     if ((p = OSSL_PARAM_locate(params, "p4")) != NULL
256         && !TEST_true(OSSL_PARAM_set_utf8_string(p, obj->p4)))
257         return 0;
258     if ((p = OSSL_PARAM_locate(params, "p5")) != NULL
259         && !TEST_true(OSSL_PARAM_set_utf8_string(p, obj->p5)))
260         return 0;
261     if ((p = OSSL_PARAM_locate(params, "p6")) != NULL
262         && !TEST_true(OSSL_PARAM_set_utf8_ptr(p, obj->p6)))
263         return 0;
264
265     return 1;
266 }
267
268 /*
269  * This structure only simulates a provider dispatch, the real deal is
270  * a bit more code that's not necessary in these tests.
271  */
272 struct provider_dispatch_st {
273     int (*set_params)(void *obj, const OSSL_PARAM *params);
274     int (*get_params)(void *obj, OSSL_PARAM *params);
275 };
276
277 /* "raw" provider */
278 static const struct provider_dispatch_st provider_raw = {
279     raw_set_params, raw_get_params
280 };
281
282 /* "api" provider */
283 static const struct provider_dispatch_st provider_api = {
284     api_set_params, api_get_params
285 };
286
287 /*-
288  * APPLICATION SECTION
289  * ===================
290  */
291
292 /* In all our tests, these are variables that get manipulated as parameters
293  *
294  * These arrays consistently do nothing with the "p2" parameter, and
295  * always include a "foo" parameter.  This is to check that the
296  * set_params and get_params calls ignore the lack of parameters that
297  * the application isn't interested in, as well as ignore parameters
298  * they don't understand (the application may have one big bag of
299  * parameters).
300  */
301 static int app_p1;                    /* "p1" */
302 static double app_p2;                 /* "p2" is ignored */
303 static BIGNUM *app_p3 = NULL;         /* "p3" */
304 static unsigned char bignumbin[4096]; /* "p3" */
305 static char app_p4[256];              /* "p4" */
306 static char app_p5[256];              /* "p5" */
307 static const char *app_p6 = NULL;     /* "p6" */
308 static unsigned char foo[1];          /* "foo" */
309
310 #define app_p1_init 17           /* A random number */
311 #define app_p2_init 47.11        /* Another random number */
312 #define app_p3_init "deadbeef"   /* Classic */
313 #define app_p4_init "Hello"
314 #define app_p5_init "World"
315 #define app_p6_init "Cookie"
316 #define app_foo_init 'z'
317
318 static int cleanup_app_variables(void)
319 {
320     BN_free(app_p3);
321     app_p3 = NULL;
322     return 1;
323 }
324
325 static int init_app_variables(void)
326 {
327     int l = 0;
328
329     cleanup_app_variables();
330
331     app_p1 = app_p1_init;
332     app_p2 = app_p2_init;
333     if (!BN_hex2bn(&app_p3, app_p3_init)
334         || (l = BN_bn2nativepad(app_p3, bignumbin, sizeof(bignumbin))) < 0)
335         return 0;
336     strcpy(app_p4, app_p4_init);
337     strcpy(app_p5, app_p5_init);
338     app_p6 = app_p6_init;
339     foo[0] = app_foo_init;
340
341     return 1;
342 }
343
344 /*
345  * Here, we define test OSSL_PARAM arrays
346  */
347
348 /* An array of OSSL_PARAM, specific in the most raw manner possible */
349 static OSSL_PARAM static_raw_params[] = {
350     { "p1", OSSL_PARAM_INTEGER, &app_p1, sizeof(app_p1), 0 },
351     { "p3", OSSL_PARAM_UNSIGNED_INTEGER, &bignumbin, sizeof(bignumbin), 0 },
352     { "p4", OSSL_PARAM_UTF8_STRING, &app_p4, sizeof(app_p4), 0 },
353     { "p5", OSSL_PARAM_UTF8_STRING, &app_p5, sizeof(app_p5), 0 },
354     /* sizeof(app_p6_init) - 1, because we know that's what we're using */
355     { "p6", OSSL_PARAM_UTF8_PTR, &app_p6, sizeof(app_p6_init) - 1, 0 },
356     { "foo", OSSL_PARAM_OCTET_STRING, &foo, sizeof(foo), 0 },
357     { NULL, 0, NULL, 0, 0 }
358 };
359
360 /* The same array of OSSL_PARAM, specified with the macros from params.h */
361 static OSSL_PARAM static_api_params[] = {
362     OSSL_PARAM_int("p1", &app_p1),
363     OSSL_PARAM_BN("p3", &bignumbin, sizeof(bignumbin)),
364     OSSL_PARAM_DEFN("p4", OSSL_PARAM_UTF8_STRING, &app_p4, sizeof(app_p4)),
365     OSSL_PARAM_DEFN("p5", OSSL_PARAM_UTF8_STRING, &app_p5, sizeof(app_p5)),
366     /* sizeof(app_p6_init), because we know that's what we're using */
367     OSSL_PARAM_DEFN("p6", OSSL_PARAM_UTF8_PTR, &app_p6,
368                     sizeof(app_p6_init) - 1),
369     OSSL_PARAM_DEFN("foo", OSSL_PARAM_OCTET_STRING, &foo, sizeof(foo)),
370     OSSL_PARAM_END
371 };
372
373 /*
374  * The same array again, but constructed at run-time
375  * This exercises the OSSL_PARAM constructor functions
376  */
377 static OSSL_PARAM *construct_api_params(void)
378 {
379     size_t n = 0;
380     static OSSL_PARAM params[10];
381
382     params[n++] = OSSL_PARAM_construct_int("p1", &app_p1);
383     params[n++] = OSSL_PARAM_construct_BN("p3", bignumbin, sizeof(bignumbin));
384     params[n++] = OSSL_PARAM_construct_utf8_string("p4", app_p4,
385                                                    sizeof(app_p4));
386     params[n++] = OSSL_PARAM_construct_utf8_string("p5", app_p5,
387                                                    sizeof(app_p5));
388     /* sizeof(app_p6_init), because we know that's what we're using */
389     params[n++] = OSSL_PARAM_construct_utf8_ptr("p6", (char **)&app_p6,
390                                                 sizeof(app_p6_init));
391     params[n++] = OSSL_PARAM_construct_octet_string("foo", &foo, sizeof(foo));
392     params[n++] = OSSL_PARAM_construct_end();
393
394     return params;
395 }
396
397 struct param_owner_st {
398     OSSL_PARAM *static_params;
399     OSSL_PARAM *(*constructed_params)(void);
400 };
401
402 static const struct param_owner_st raw_params = {
403     static_raw_params, NULL
404 };
405
406 static const struct param_owner_st api_params = {
407     static_api_params, construct_api_params
408 };
409
410 /*-
411  * TESTING
412  * =======
413  */
414
415 /*
416  * Test cases to combine parameters with "provider side" functions
417  */
418 static struct {
419     const struct provider_dispatch_st *prov;
420     const struct param_owner_st *app;
421     const char *desc;
422 } test_cases[] = {
423     /* Tests within specific methods */
424     { &provider_raw, &raw_params, "raw provider vs raw params" },
425     { &provider_api, &api_params, "api provider vs api params" },
426
427     /* Mixed methods */
428     { &provider_raw, &api_params, "raw provider vs api params" },
429     { &provider_api, &raw_params, "api provider vs raw params" },
430 };
431
432 /* Generic tester of combinations of "providers" and params */
433 static int test_case_variant(OSSL_PARAM *params, const struct provider_dispatch_st *prov)
434 {
435     BIGNUM *verify_p3 = NULL;
436     void *obj = NULL;
437     int errcnt = 0;
438     OSSL_PARAM *p;
439
440     /*
441      * Initialize
442      */
443     if (!TEST_ptr(obj = init_object())
444         || !TEST_true(BN_hex2bn(&verify_p3, p3_init))) {
445         errcnt++;
446         goto fin;
447     }
448
449     /*
450      * Get parameters a first time, just to see that getting works and
451      * gets us the values we expect.
452      */
453     init_app_variables();
454
455     if (!TEST_true(prov->get_params(obj, params))
456         || !TEST_int_eq(app_p1, p1_init)        /* "provider" value */
457         || !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
458         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
459         || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
460         || !TEST_BN_eq(app_p3, verify_p3)       /* "provider" value */
461         || !TEST_str_eq(app_p4, p4_init)        /* "provider" value */
462         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))
463         || !TEST_size_t_eq(p->return_size,
464                            sizeof(p5_init) - 1) /* "provider" value */
465         || !TEST_str_eq(app_p5, p5_init)        /* "provider" value */
466         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p6"))
467         || !TEST_size_t_eq(p->return_size,
468                            sizeof(p6_init) - 1) /* "provider" value */
469         || !TEST_str_eq(app_p6, p6_init)        /* "provider" value */
470         || !TEST_char_eq(foo[0], app_foo_init)  /* Should remain untouched */
471         || !TEST_ptr(p = OSSL_PARAM_locate(params, "foo")))
472         errcnt++;
473
474     /*
475      * Set parameters, then sneak into the object itself and check
476      * that its attributes got set (or ignored) properly.
477      */
478     init_app_variables();
479
480     if (!TEST_true(prov->set_params(obj, params))) {
481         errcnt++;
482     } else {
483         struct object_st *sneakpeek = obj;
484
485         if (!TEST_int_eq(sneakpeek->p1, app_p1)         /* app value set */
486             || !TEST_double_eq(sneakpeek->p2, p2_init)  /* Should remain untouched */
487             || !TEST_BN_eq(sneakpeek->p3, app_p3)       /* app value set */
488             || !TEST_str_eq(sneakpeek->p4, app_p4)      /* app value set */
489             || !TEST_str_eq(sneakpeek->p5, app_p5)      /* app value set */
490             || !TEST_str_eq(sneakpeek->p6, app_p6))     /* app value set */
491             errcnt++;
492     }
493
494     /*
495      * Get parameters again, checking that we get different values
496      * than earlier where relevant.
497      */
498     BN_free(verify_p3);
499     verify_p3 = NULL;
500
501     if (!TEST_true(BN_hex2bn(&verify_p3, app_p3_init))) {
502         errcnt++;
503         goto fin;
504     }
505
506     if (!TEST_true(prov->get_params(obj, params))
507         || !TEST_int_eq(app_p1, app_p1_init)    /* app value */
508         || !TEST_double_eq(app_p2, app_p2_init) /* Should remain untouched */
509         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p3"))
510         || !TEST_ptr(BN_native2bn(bignumbin, p->return_size, app_p3))
511         || !TEST_BN_eq(app_p3, verify_p3)       /* app value */
512         || !TEST_str_eq(app_p4, app_p4_init)    /* app value */
513         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p5"))
514         || !TEST_size_t_eq(p->return_size,
515                            sizeof(app_p5_init) - 1) /* app value */
516         || !TEST_str_eq(app_p5, app_p5_init)    /* app value */
517         || !TEST_ptr(p = OSSL_PARAM_locate(params, "p6"))
518         || !TEST_size_t_eq(p->return_size,
519                            sizeof(app_p6_init) - 1) /* app value */
520         || !TEST_str_eq(app_p6, app_p6_init)    /* app value */
521         || !TEST_char_eq(foo[0], app_foo_init)  /* Should remain untouched */
522         || !TEST_ptr(p = OSSL_PARAM_locate(params, "foo")))
523         errcnt++;
524
525  fin:
526     BN_free(verify_p3);
527     verify_p3 = NULL;
528     cleanup_app_variables();
529     cleanup_object(obj);
530
531     return errcnt == 0;
532 }
533
534 static int test_case(int i)
535 {
536     TEST_info("Case: %s", test_cases[i].desc);
537
538     return test_case_variant(test_cases[i].app->static_params,
539                              test_cases[i].prov)
540         && (test_cases[i].app->constructed_params == NULL
541             || test_case_variant(test_cases[i].app->constructed_params(),
542                                  test_cases[i].prov));
543 }
544
545 /*-
546  * OSSL_PARAM_allocate_from_text() tests
547  * =====================================
548  */
549
550 static const OSSL_PARAM params_from_text[] = {
551     OSSL_PARAM_int32("int", NULL),
552     OSSL_PARAM_DEFN("short", OSSL_PARAM_INTEGER, NULL, sizeof(int16_t)),
553     OSSL_PARAM_DEFN("ushort", OSSL_PARAM_UNSIGNED_INTEGER, NULL, sizeof(uint16_t)),
554     OSSL_PARAM_END,
555 };
556
557 struct int_from_text_test_st {
558     const char *argname;
559     const char *strval;
560     long int intval;
561     int res;
562 };
563
564 static struct int_from_text_test_st int_from_text_test_cases[] = {
565     { "int",               "",          0, 0 },
566     { "int",              "0",          0, 1 },
567     { "int",            "101",        101, 1 },
568     { "int",           "-102",       -102, 1 },
569     { "int",            "12A",         12, 1 }, /* incomplete */
570     { "int",          "0x12B",      0x12B, 1 },
571     { "hexint",         "12C",      0x12C, 1 },
572     { "hexint",       "0x12D",          0, 1 }, /* zero */
573     /* test check of the target buffer size */
574     { "int",     "0x7fffffff",  INT32_MAX, 1 },
575     { "int",     "2147483647",  INT32_MAX, 1 },
576     { "int",     "2147483648",          0, 0 }, /* too small buffer */
577     { "int",    "-2147483648",  INT32_MIN, 1 },
578     { "int",    "-2147483649",          0, 0 }, /* too small buffer */
579     { "short",       "0x7fff",  INT16_MAX, 1 },
580     { "short",        "32767",  INT16_MAX, 1 },
581     { "short",        "32768",          0, 0 }, /* too small buffer */
582     { "ushort",      "0xffff", UINT16_MAX, 1 },
583     { "ushort",       "65535", UINT16_MAX, 1 },
584     { "ushort",       "65536",          0, 0 }, /* too small buffer */
585 };
586
587 static int check_int_from_text(const struct int_from_text_test_st a)
588 {
589     OSSL_PARAM param;
590     long int val = 0;
591     int res;
592
593     if (!OSSL_PARAM_allocate_from_text(&param, params_from_text,
594                                        a.argname, a.strval, 0, NULL)) {
595         if (a.res)
596             TEST_error("errant %s param \"%s\"", a.argname, a.strval);
597         return !a.res;
598     }
599
600     res = OSSL_PARAM_get_long(&param, &val);
601     OPENSSL_free(param.data);
602
603     if (res ^ a.res || val != a.intval) {
604         TEST_error("errant %s \"%s\" %li != %li",
605                    a.argname, a.strval, a.intval, val);
606         return 0;
607     }
608
609     return a.res;
610 }
611
612 static int test_allocate_from_text(int i)
613 {
614     return check_int_from_text(int_from_text_test_cases[i]);
615 }
616
617 int setup_tests(void)
618 {
619     ADD_ALL_TESTS(test_case, OSSL_NELEM(test_cases));
620     ADD_ALL_TESTS(test_allocate_from_text, OSSL_NELEM(int_from_text_test_cases));
621     return 1;
622 }